aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/cast_ut.cpp
diff options
context:
space:
mode:
authorantoshkka <antoshkka@yandex-team.ru>2022-02-10 16:50:14 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:14 +0300
commitecc19a1fc1e15d78a9279514cb11edd9e808d600 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /util/generic/cast_ut.cpp
parent90277959ac43a22ec25e7b78b1a2b4f610530d51 (diff)
downloadydb-ecc19a1fc1e15d78a9279514cb11edd9e808d600.tar.gz
Restoring authorship annotation for <antoshkka@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/generic/cast_ut.cpp')
-rw-r--r--util/generic/cast_ut.cpp50
1 files changed, 25 insertions, 25 deletions
diff --git a/util/generic/cast_ut.cpp b/util/generic/cast_ut.cpp
index 9892029eb1..718a8de79d 100644
--- a/util/generic/cast_ut.cpp
+++ b/util/generic/cast_ut.cpp
@@ -6,7 +6,7 @@ class TGenericCastsTest: public TTestBase {
UNIT_TEST_SUITE(TGenericCastsTest);
UNIT_TEST(TestVerifyDynamicCast)
UNIT_TEST(TestIntegralCast)
- UNIT_TEST(TestEnumCast)
+ UNIT_TEST(TestEnumCast)
UNIT_TEST(TestToUnderlying)
UNIT_TEST(TestBitCast)
UNIT_TEST_SUITE_END();
@@ -29,32 +29,32 @@ private:
UNIT_ASSERT_EXCEPTION(SafeIntegerCast<ui16>(static_cast<i32>(Max<ui16>() + 10)), TBadCastException);
UNIT_ASSERT_EXCEPTION(SafeIntegerCast<ui16>(static_cast<ui32>(Max<ui16>() + 10)), TBadCastException);
}
-
- inline void TestEnumCast() {
- enum A {
- AM1 = -1
- };
-
+
+ inline void TestEnumCast() {
+ enum A {
+ AM1 = -1
+ };
+
enum B: int {
- BM1 = -1
- };
-
+ BM1 = -1
+ };
+
enum class C: unsigned short {
- CM1 = 1
- };
-
- UNIT_ASSERT_EXCEPTION(SafeIntegerCast<unsigned int>(AM1), TBadCastException);
- UNIT_ASSERT_EXCEPTION(SafeIntegerCast<unsigned int>(BM1), TBadCastException);
- UNIT_ASSERT_EXCEPTION(SafeIntegerCast<C>(AM1), TBadCastException);
- UNIT_ASSERT_EXCEPTION(static_cast<int>(SafeIntegerCast<C>(BM1)), TBadCastException);
- UNIT_ASSERT(SafeIntegerCast<A>(BM1) == AM1);
- UNIT_ASSERT(SafeIntegerCast<B>(AM1) == BM1);
- UNIT_ASSERT(SafeIntegerCast<A>(C::CM1) == 1);
- UNIT_ASSERT(SafeIntegerCast<B>(C::CM1) == 1);
- UNIT_ASSERT(SafeIntegerCast<A>(-1) == AM1);
- UNIT_ASSERT(SafeIntegerCast<B>(-1) == BM1);
- UNIT_ASSERT(SafeIntegerCast<C>(1) == C::CM1);
- }
+ CM1 = 1
+ };
+
+ UNIT_ASSERT_EXCEPTION(SafeIntegerCast<unsigned int>(AM1), TBadCastException);
+ UNIT_ASSERT_EXCEPTION(SafeIntegerCast<unsigned int>(BM1), TBadCastException);
+ UNIT_ASSERT_EXCEPTION(SafeIntegerCast<C>(AM1), TBadCastException);
+ UNIT_ASSERT_EXCEPTION(static_cast<int>(SafeIntegerCast<C>(BM1)), TBadCastException);
+ UNIT_ASSERT(SafeIntegerCast<A>(BM1) == AM1);
+ UNIT_ASSERT(SafeIntegerCast<B>(AM1) == BM1);
+ UNIT_ASSERT(SafeIntegerCast<A>(C::CM1) == 1);
+ UNIT_ASSERT(SafeIntegerCast<B>(C::CM1) == 1);
+ UNIT_ASSERT(SafeIntegerCast<A>(-1) == AM1);
+ UNIT_ASSERT(SafeIntegerCast<B>(-1) == BM1);
+ UNIT_ASSERT(SafeIntegerCast<C>(1) == C::CM1);
+ }
void TestToUnderlying() {
enum A {