diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:15 +0300 |
commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /util/generic/cast_ut.cpp | |
parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
download | ydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'util/generic/cast_ut.cpp')
-rw-r--r-- | util/generic/cast_ut.cpp | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/util/generic/cast_ut.cpp b/util/generic/cast_ut.cpp index 718a8de79d..ff23f617da 100644 --- a/util/generic/cast_ut.cpp +++ b/util/generic/cast_ut.cpp @@ -1,45 +1,45 @@ -#include "cast.h" - +#include "cast.h" + #include <library/cpp/testing/unittest/registar.h> - -class TGenericCastsTest: public TTestBase { - UNIT_TEST_SUITE(TGenericCastsTest); - UNIT_TEST(TestVerifyDynamicCast) - UNIT_TEST(TestIntegralCast) + +class TGenericCastsTest: public TTestBase { + UNIT_TEST_SUITE(TGenericCastsTest); + UNIT_TEST(TestVerifyDynamicCast) + UNIT_TEST(TestIntegralCast) UNIT_TEST(TestEnumCast) UNIT_TEST(TestToUnderlying) UNIT_TEST(TestBitCast) - UNIT_TEST_SUITE_END(); - -private: - struct TAaa { + UNIT_TEST_SUITE_END(); + +private: + struct TAaa { virtual ~TAaa() = default; - }; - struct TBbb: public TAaa {}; - - inline void TestVerifyDynamicCast() { - TBbb bbb; - TAaa* aaa = &bbb; - TAaa* aaa2 = VerifyDynamicCast<TBbb*>(aaa); - UNIT_ASSERT(aaa == aaa2); - } - - void TestIntegralCast() { - UNIT_ASSERT_EXCEPTION(SafeIntegerCast<ui32>(-5), TBadCastException); - UNIT_ASSERT_EXCEPTION(SafeIntegerCast<ui16>(static_cast<i32>(Max<ui16>() + 10)), TBadCastException); - UNIT_ASSERT_EXCEPTION(SafeIntegerCast<ui16>(static_cast<ui32>(Max<ui16>() + 10)), TBadCastException); - } + }; + struct TBbb: public TAaa {}; + + inline void TestVerifyDynamicCast() { + TBbb bbb; + TAaa* aaa = &bbb; + TAaa* aaa2 = VerifyDynamicCast<TBbb*>(aaa); + UNIT_ASSERT(aaa == aaa2); + } + + void TestIntegralCast() { + UNIT_ASSERT_EXCEPTION(SafeIntegerCast<ui32>(-5), TBadCastException); + 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 }; - enum B: int { + enum B: int { BM1 = -1 }; - enum class C: unsigned short { + enum class C: unsigned short { CM1 = 1 }; @@ -61,11 +61,11 @@ private: AM1 = -1 }; - enum B: int { + enum B: int { BM1 = -1 }; - enum class C: unsigned short { + enum class C: unsigned short { CM1 = 1 }; @@ -107,6 +107,6 @@ private: UNIT_ASSERT_VALUES_EQUAL(structValue.d, 0x11); } } -}; - -UNIT_TEST_SUITE_REGISTRATION(TGenericCastsTest); +}; + +UNIT_TEST_SUITE_REGISTRATION(TGenericCastsTest); |