aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/overloaded_ut.cpp
diff options
context:
space:
mode:
authorMikhail Borisov <borisov.mikhail@gmail.com>2022-02-10 16:45:40 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:40 +0300
commit5d50718e66d9c037dc587a0211110b7d25a66185 (patch)
treee98df59de24d2ef7c77baed9f41e4875a2fef972 /util/generic/overloaded_ut.cpp
parenta6a92afe03e02795227d2641b49819b687f088f8 (diff)
downloadydb-5d50718e66d9c037dc587a0211110b7d25a66185.tar.gz
Restoring authorship annotation for Mikhail Borisov <borisov.mikhail@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'util/generic/overloaded_ut.cpp')
-rw-r--r--util/generic/overloaded_ut.cpp50
1 files changed, 25 insertions, 25 deletions
diff --git a/util/generic/overloaded_ut.cpp b/util/generic/overloaded_ut.cpp
index bf32daf475..f3d73895ad 100644
--- a/util/generic/overloaded_ut.cpp
+++ b/util/generic/overloaded_ut.cpp
@@ -1,4 +1,4 @@
-#include <util/generic/overloaded.h>
+#include <util/generic/overloaded.h>
#include <library/cpp/testing/unittest/registar.h>
@@ -35,7 +35,7 @@ Y_UNIT_TEST_SUITE(TOverloadedTest) {
[&](double) { res = -1; },
[&](TType1) { res = -1; }},
v);
- UNIT_ASSERT_VALUES_EQUAL(res, 5);
+ UNIT_ASSERT_VALUES_EQUAL(res, 5);
}
Y_UNIT_TEST(TupleTest) {
@@ -48,35 +48,35 @@ Y_UNIT_TEST_SUITE(TOverloadedTest) {
[&](bool val) { res += "(bool) " + ToString(val) + ' '; },
});
- UNIT_ASSERT_VALUES_EQUAL(res, "(int) 5 (double) 3.14 (bool) 1 (int) 20 ");
+ UNIT_ASSERT_VALUES_EQUAL(res, "(int) 5 (double) 3.14 (bool) 1 (int) 20 ");
}
-
- Y_UNIT_TEST(ImplicitConversionsTest) {
+
+ Y_UNIT_TEST(ImplicitConversionsTest) {
using TTestVariant = std::variant<int, double, char>;
-
- // Purposefully exhibit inexact overload matched with implicit type
- // conversions
-
- // All cases implicitly cast to int
- auto matchAsInt = [](TTestVariant var) {
+
+ // Purposefully exhibit inexact overload matched with implicit type
+ // conversions
+
+ // All cases implicitly cast to int
+ auto matchAsInt = [](TTestVariant var) {
return std::visit(TOverloaded{
[](int val) { return val; },
}, var);
- };
-
- UNIT_ASSERT_VALUES_EQUAL(matchAsInt(TTestVariant{17.77}), 17);
- UNIT_ASSERT_VALUES_EQUAL(matchAsInt(TTestVariant{12345}), 12345);
- UNIT_ASSERT_VALUES_EQUAL(matchAsInt(TTestVariant{'X'}), 88);
-
- // All cases implicitly cast to double
- auto matchAsDouble = [](TTestVariant var) {
+ };
+
+ UNIT_ASSERT_VALUES_EQUAL(matchAsInt(TTestVariant{17.77}), 17);
+ UNIT_ASSERT_VALUES_EQUAL(matchAsInt(TTestVariant{12345}), 12345);
+ UNIT_ASSERT_VALUES_EQUAL(matchAsInt(TTestVariant{'X'}), 88);
+
+ // All cases implicitly cast to double
+ auto matchAsDouble = [](TTestVariant var) {
return std::visit(TOverloaded{
[](double val) { return val; },
}, var);
- };
-
- UNIT_ASSERT_VALUES_EQUAL(matchAsDouble(TTestVariant{17.77}), 17.77);
- UNIT_ASSERT_VALUES_EQUAL(matchAsDouble(TTestVariant{12345}), 12345.0);
- UNIT_ASSERT_VALUES_EQUAL(matchAsDouble(TTestVariant{'X'}), 88.0);
- }
+ };
+
+ UNIT_ASSERT_VALUES_EQUAL(matchAsDouble(TTestVariant{17.77}), 17.77);
+ UNIT_ASSERT_VALUES_EQUAL(matchAsDouble(TTestVariant{12345}), 12345.0);
+ UNIT_ASSERT_VALUES_EQUAL(matchAsDouble(TTestVariant{'X'}), 88.0);
+ }
}