diff options
author | eeight <eeight@yandex-team.ru> | 2022-02-10 16:46:19 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:19 +0300 |
commit | bd085aee9b4f7a0bee302ce687964ffb7098f986 (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util/generic/overloaded_ut.cpp | |
parent | 475c0a46f28166e83fd263badc7546377cddcabe (diff) | |
download | ydb-bd085aee9b4f7a0bee302ce687964ffb7098f986.tar.gz |
Restoring authorship annotation for <eeight@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/generic/overloaded_ut.cpp')
-rw-r--r-- | util/generic/overloaded_ut.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/util/generic/overloaded_ut.cpp b/util/generic/overloaded_ut.cpp index 57c3f284a6..f3d73895ad 100644 --- a/util/generic/overloaded_ut.cpp +++ b/util/generic/overloaded_ut.cpp @@ -28,13 +28,13 @@ Y_UNIT_TEST_SUITE(TOverloadedTest) { } Y_UNIT_TEST(VariantTest) { - std::variant<int, double, TType1> v = 5; + std::variant<int, double, TType1> v = 5; int res = 0; - std::visit(TOverloaded{ - [&](int val) { res = val; }, - [&](double) { res = -1; }, - [&](TType1) { res = -1; }}, - v); + std::visit(TOverloaded{ + [&](int val) { res = val; }, + [&](double) { res = -1; }, + [&](TType1) { res = -1; }}, + v); UNIT_ASSERT_VALUES_EQUAL(res, 5); } @@ -52,16 +52,16 @@ Y_UNIT_TEST_SUITE(TOverloadedTest) { } Y_UNIT_TEST(ImplicitConversionsTest) { - using TTestVariant = std::variant<int, double, char>; + 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) { - return std::visit(TOverloaded{ - [](int val) { return val; }, - }, var); + return std::visit(TOverloaded{ + [](int val) { return val; }, + }, var); }; UNIT_ASSERT_VALUES_EQUAL(matchAsInt(TTestVariant{17.77}), 17); @@ -70,9 +70,9 @@ Y_UNIT_TEST_SUITE(TOverloadedTest) { // All cases implicitly cast to double auto matchAsDouble = [](TTestVariant var) { - return std::visit(TOverloaded{ - [](double val) { return val; }, - }, var); + return std::visit(TOverloaded{ + [](double val) { return val; }, + }, var); }; UNIT_ASSERT_VALUES_EQUAL(matchAsDouble(TTestVariant{17.77}), 17.77); |