summaryrefslogtreecommitdiffstats
path: root/util/generic/cast_ut.cpp
diff options
context:
space:
mode:
authoreeight <[email protected]>2022-02-10 16:46:18 +0300
committerDaniil Cherednik <[email protected]>2022-02-10 16:46:18 +0300
commit475c0a46f28166e83fd263badc7546377cddcabe (patch)
tree39c5a49b8aaad78fe390b6f1f2886bdbda40f3e7 /util/generic/cast_ut.cpp
parenta6e0145a095c7bb3770d6e07aee301de5c73f96e (diff)
Restoring authorship annotation for <[email protected]>. Commit 1 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 718a8de79de..1f73066ccdb 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);