aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/enumbitset/enumbitset_ut.cpp
diff options
context:
space:
mode:
authornosyrev <nosyrev@yandex-team.ru>2022-02-10 16:49:26 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:26 +0300
commita34560e505da5142d686ed3f02c4651058d032c8 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/enumbitset/enumbitset_ut.cpp
parente1d79fa17b770f65538cb8c3d9a5a59ebb0da04b (diff)
downloadydb-a34560e505da5142d686ed3f02c4651058d032c8.tar.gz
Restoring authorship annotation for <nosyrev@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/enumbitset/enumbitset_ut.cpp')
-rw-r--r--library/cpp/enumbitset/enumbitset_ut.cpp128
1 files changed, 64 insertions, 64 deletions
diff --git a/library/cpp/enumbitset/enumbitset_ut.cpp b/library/cpp/enumbitset/enumbitset_ut.cpp
index 9aacc82d7e..e55b3251c3 100644
--- a/library/cpp/enumbitset/enumbitset_ut.cpp
+++ b/library/cpp/enumbitset/enumbitset_ut.cpp
@@ -1,41 +1,41 @@
-#include "enumbitset.h"
-
+#include "enumbitset.h"
+
#include <library/cpp/testing/unittest/registar.h>
-
-#include <util/stream/str.h>
-#include <util/stream/file.h>
-
-enum ETestEnum {
- TE_FIRST = 0,
- TE_1,
- TE_2,
- TE_3,
- TE_4,
- TE_MIDDLE = TE_4 + 64,
- TE_5,
- TE_6,
- TE_7,
- TE_MAX,
-
- TE_OVERFLOW, // to test overflow
-};
+
+#include <util/stream/str.h>
+#include <util/stream/file.h>
+
+enum ETestEnum {
+ TE_FIRST = 0,
+ TE_1,
+ TE_2,
+ TE_3,
+ TE_4,
+ TE_MIDDLE = TE_4 + 64,
+ TE_5,
+ TE_6,
+ TE_7,
+ TE_MAX,
+
+ TE_OVERFLOW, // to test overflow
+};
using TTestBitSet = TEnumBitSet<ETestEnum, TE_FIRST, TE_MAX>;
-
+
Y_UNIT_TEST_SUITE(TEnumBitSetTest) {
Y_UNIT_TEST(TestMainFunctions) {
- auto ebs = TTestBitSet(TE_FIRST, TE_MIDDLE);
-
- UNIT_ASSERT(ebs.SafeTest(TE_FIRST));
- UNIT_ASSERT(ebs.SafeTest(TE_MIDDLE));
-
- ebs.SafeSet(TE_5);
- UNIT_ASSERT(ebs.SafeTest(TE_5));
- UNIT_ASSERT(!ebs.SafeTest(TE_7));
-
- ebs.SafeSet(TE_OVERFLOW);
- UNIT_ASSERT(!ebs.SafeTest(TE_OVERFLOW));
+ auto ebs = TTestBitSet(TE_FIRST, TE_MIDDLE);
+
+ UNIT_ASSERT(ebs.SafeTest(TE_FIRST));
+ UNIT_ASSERT(ebs.SafeTest(TE_MIDDLE));
+
+ ebs.SafeSet(TE_5);
+ UNIT_ASSERT(ebs.SafeTest(TE_5));
+ UNIT_ASSERT(!ebs.SafeTest(TE_7));
+
+ ebs.SafeSet(TE_OVERFLOW);
+ UNIT_ASSERT(!ebs.SafeTest(TE_OVERFLOW));
}
-
+
Y_UNIT_TEST(TestEmpty) {
TTestBitSet mask;
UNIT_ASSERT(mask.Empty());
@@ -47,37 +47,37 @@ Y_UNIT_TEST_SUITE(TEnumBitSetTest) {
UNIT_ASSERT(mask.Count() == 1);
if (!mask)
UNIT_ASSERT(false && "should not be empty");
- }
-
+ }
+
Y_UNIT_TEST(TestIter) {
- TTestBitSet mask = TTestBitSet(TE_1, TE_3, TE_7);
-
- TTestBitSet mask2;
- for (auto elem : mask) {
- mask2.Set(elem);
- }
-
- UNIT_ASSERT(mask == mask2);
- }
-
+ TTestBitSet mask = TTestBitSet(TE_1, TE_3, TE_7);
+
+ TTestBitSet mask2;
+ for (auto elem : mask) {
+ mask2.Set(elem);
+ }
+
+ UNIT_ASSERT(mask == mask2);
+ }
+
Y_UNIT_TEST(TestSerialization) {
- auto ebs = TTestBitSet(TE_MIDDLE, TE_6, TE_7);
-
- TStringStream ss;
- ebs.Save(&ss);
-
- auto ebs2 = TTestBitSet();
- ebs2.Load(&ss);
- UNIT_ASSERT_EQUAL(ebs, ebs2);
- }
-
+ auto ebs = TTestBitSet(TE_MIDDLE, TE_6, TE_7);
+
+ TStringStream ss;
+ ebs.Save(&ss);
+
+ auto ebs2 = TTestBitSet();
+ ebs2.Load(&ss);
+ UNIT_ASSERT_EQUAL(ebs, ebs2);
+ }
+
Y_UNIT_TEST(TestStringRepresentation) {
- auto ebs = TTestBitSet(TE_MIDDLE, TE_6, TE_7);
-
- UNIT_ASSERT_EQUAL(ebs.ToString(), "D00000000000000000");
-
- auto ebs2 = TTestBitSet();
- ebs2.FromString("D00000000000000000");
- UNIT_ASSERT_EQUAL(ebs, ebs2);
- }
-}
+ auto ebs = TTestBitSet(TE_MIDDLE, TE_6, TE_7);
+
+ UNIT_ASSERT_EQUAL(ebs.ToString(), "D00000000000000000");
+
+ auto ebs2 = TTestBitSet();
+ ebs2.FromString("D00000000000000000");
+ UNIT_ASSERT_EQUAL(ebs, ebs2);
+ }
+}