aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/cast_ut.cpp
diff options
context:
space:
mode:
authoreeight <eeight@yandex-team.ru>2022-02-10 16:46:19 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:19 +0300
commitbd085aee9b4f7a0bee302ce687964ffb7098f986 (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util/generic/cast_ut.cpp
parent475c0a46f28166e83fd263badc7546377cddcabe (diff)
downloadydb-bd085aee9b4f7a0bee302ce687964ffb7098f986.tar.gz
Restoring authorship annotation for <eeight@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/generic/cast_ut.cpp')
-rw-r--r--util/generic/cast_ut.cpp52
1 files changed, 26 insertions, 26 deletions
diff --git a/util/generic/cast_ut.cpp b/util/generic/cast_ut.cpp
index 1f73066ccd..718a8de79d 100644
--- a/util/generic/cast_ut.cpp
+++ b/util/generic/cast_ut.cpp
@@ -8,7 +8,7 @@ class TGenericCastsTest: public TTestBase {
UNIT_TEST(TestIntegralCast)
UNIT_TEST(TestEnumCast)
UNIT_TEST(TestToUnderlying)
- UNIT_TEST(TestBitCast)
+ UNIT_TEST(TestBitCast)
UNIT_TEST_SUITE_END();
private:
@@ -81,32 +81,32 @@ private:
UNIT_ASSERT_VALUES_EQUAL(static_cast<std::underlying_type_t<B>>(BM1), ToUnderlying(BM1));
UNIT_ASSERT_VALUES_EQUAL(static_cast<std::underlying_type_t<C>>(C::CM1), ToUnderlying(C::CM1));
}
-
- void TestBitCast() {
- // Change sign of float
- {
+
+ void TestBitCast() {
+ // Change sign of float
+ {
const float floatValue = 17.33f;
- ui32 ui32Value = BitCast<ui32>(floatValue);
- ui32Value ^= (ui32)1 << 31;
- UNIT_ASSERT_VALUES_EQUAL(-floatValue, BitCast<float>(ui32Value));
- }
-
- // Unpack ui64 into a struct
- {
- const ui64 value = 0x1122334455667788;
- struct TStruct {
- ui32 a;
- ui16 b;
- ui8 c;
- ui8 d;
- };
- auto structValue = BitCast<TStruct>(value);
- UNIT_ASSERT_VALUES_EQUAL(structValue.a, 0x55667788);
- UNIT_ASSERT_VALUES_EQUAL(structValue.b, 0x3344);
- UNIT_ASSERT_VALUES_EQUAL(structValue.c, 0x22);
- UNIT_ASSERT_VALUES_EQUAL(structValue.d, 0x11);
- }
- }
+ ui32 ui32Value = BitCast<ui32>(floatValue);
+ ui32Value ^= (ui32)1 << 31;
+ UNIT_ASSERT_VALUES_EQUAL(-floatValue, BitCast<float>(ui32Value));
+ }
+
+ // Unpack ui64 into a struct
+ {
+ const ui64 value = 0x1122334455667788;
+ struct TStruct {
+ ui32 a;
+ ui16 b;
+ ui8 c;
+ ui8 d;
+ };
+ auto structValue = BitCast<TStruct>(value);
+ UNIT_ASSERT_VALUES_EQUAL(structValue.a, 0x55667788);
+ UNIT_ASSERT_VALUES_EQUAL(structValue.b, 0x3344);
+ UNIT_ASSERT_VALUES_EQUAL(structValue.c, 0x22);
+ UNIT_ASSERT_VALUES_EQUAL(structValue.d, 0x11);
+ }
+ }
};
UNIT_TEST_SUITE_REGISTRATION(TGenericCastsTest);