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/align_ut.cpp | |
download | ydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz |
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'util/system/align_ut.cpp')
-rw-r--r-- | util/system/align_ut.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/util/system/align_ut.cpp b/util/system/align_ut.cpp new file mode 100644 index 0000000000..3ba3a3442b --- /dev/null +++ b/util/system/align_ut.cpp @@ -0,0 +1,35 @@ +#include "align.h" + +#include <library/cpp/testing/unittest/registar.h> + +class TAlignTest: public TTestBase { + UNIT_TEST_SUITE(TAlignTest); + UNIT_TEST(TestDown) + UNIT_TEST(TestUp) + UNIT_TEST_SUITE_END(); + +private: + inline void TestDown() { + UNIT_ASSERT(AlignDown(0, 4) == 0); + UNIT_ASSERT(AlignDown(1, 4) == 0); + UNIT_ASSERT(AlignDown(2, 4) == 0); + UNIT_ASSERT(AlignDown(3, 4) == 0); + UNIT_ASSERT(AlignDown(4, 4) == 4); + UNIT_ASSERT(AlignDown(5, 4) == 4); + UNIT_ASSERT(AlignDown(0, 8) == 0); + UNIT_ASSERT(AlignDown(1, 8) == 0); + } + + inline void TestUp() { + UNIT_ASSERT(AlignUp(0, 4) == 0); + UNIT_ASSERT(AlignUp(1, 4) == 4); + UNIT_ASSERT(AlignUp(2, 4) == 4); + UNIT_ASSERT(AlignUp(3, 4) == 4); + UNIT_ASSERT(AlignUp(4, 4) == 4); + UNIT_ASSERT(AlignUp(5, 4) == 8); + UNIT_ASSERT(AlignUp(0, 8) == 0); + UNIT_ASSERT(AlignUp(1, 8) == 8); + } +}; + +UNIT_TEST_SUITE_REGISTRATION(TAlignTest); |