diff options
author | Devtools Arcadia <arcadia-devtools@yandex-team.ru> | 2022-02-07 18:08:42 +0300 |
---|---|---|
committer | Devtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net> | 2022-02-07 18:08:42 +0300 |
commit | 1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch) | |
tree | e26c9fed0de5d9873cce7e00bc214573dc2195b7 /util/system/byteorder_ut.cpp | |
download | ydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz |
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'util/system/byteorder_ut.cpp')
-rw-r--r-- | util/system/byteorder_ut.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/util/system/byteorder_ut.cpp b/util/system/byteorder_ut.cpp new file mode 100644 index 0000000000..39b8603d3f --- /dev/null +++ b/util/system/byteorder_ut.cpp @@ -0,0 +1,26 @@ +#include "byteorder.h" + +#include <library/cpp/testing/unittest/registar.h> + +class TByteOrderTest: public TTestBase { + UNIT_TEST_SUITE(TByteOrderTest); + UNIT_TEST(TestSwap16) + UNIT_TEST(TestSwap32) + UNIT_TEST(TestSwap64) + UNIT_TEST_SUITE_END(); + +private: + inline void TestSwap16() { + UNIT_ASSERT_EQUAL((ui16)0x1234, SwapBytes((ui16)0x3412)); + } + + inline void TestSwap32() { + UNIT_ASSERT_EQUAL(0x12345678, SwapBytes(0x78563412)); + } + + inline void TestSwap64() { + UNIT_ASSERT_EQUAL(0x1234567890abcdefULL, SwapBytes((ui64)ULL(0xefcdab9078563412))); + } +}; + +UNIT_TEST_SUITE_REGISTRATION(TByteOrderTest); |