diff options
author | sobols <sobols@yandex-team.ru> | 2022-02-10 16:47:08 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:08 +0300 |
commit | 03335cb18337a0ef51966452a66a69b01abea218 (patch) | |
tree | b83306b6e37edeea782e9eed673d89286c4fef35 /library/cpp/protobuf/json/ut | |
parent | 09961b69c61f471ddd594e0fd877df62a8021562 (diff) | |
download | ydb-03335cb18337a0ef51966452a66a69b01abea218.tar.gz |
Restoring authorship annotation for <sobols@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/protobuf/json/ut')
-rw-r--r-- | library/cpp/protobuf/json/ut/json2proto_ut.cpp | 30 | ||||
-rw-r--r-- | library/cpp/protobuf/json/ut/util_ut.cpp | 84 | ||||
-rw-r--r-- | library/cpp/protobuf/json/ut/ya.make | 2 |
3 files changed, 58 insertions, 58 deletions
diff --git a/library/cpp/protobuf/json/ut/json2proto_ut.cpp b/library/cpp/protobuf/json/ut/json2proto_ut.cpp index 377b1d7836..0dfe57bc7a 100644 --- a/library/cpp/protobuf/json/ut/json2proto_ut.cpp +++ b/library/cpp/protobuf/json/ut/json2proto_ut.cpp @@ -928,21 +928,21 @@ Y_UNIT_TEST(TestComplexMapAsObject_EnumStringCaseInsensetive) { ); } // TestComplexMapAsObject_EnumStringCaseInsensetive -Y_UNIT_TEST(TestComplexMapAsObject_EnumStringSnakeCaseInsensitive) { - TestComplexMapAsObject( - [](TComplexMapType& proto) { - auto& items = *proto.MutableEnum(); - items["key1"] = EEnum::E_1; - items["key2"] = EEnum::E_2; - items["key3"] = EEnum::E_3; - }, - R"_({"Enum":{"key1":"e1","key2":"_E_2_","key3":"e_3"}})_", - TJson2ProtoConfig() - .SetMapAsObject(true) - .SetEnumValueMode(NProtobufJson::TJson2ProtoConfig::EnumSnakeCaseInsensitive) - ); -} // TestComplexMapAsObject_EnumStringCaseInsensetive - +Y_UNIT_TEST(TestComplexMapAsObject_EnumStringSnakeCaseInsensitive) { + TestComplexMapAsObject( + [](TComplexMapType& proto) { + auto& items = *proto.MutableEnum(); + items["key1"] = EEnum::E_1; + items["key2"] = EEnum::E_2; + items["key3"] = EEnum::E_3; + }, + R"_({"Enum":{"key1":"e1","key2":"_E_2_","key3":"e_3"}})_", + TJson2ProtoConfig() + .SetMapAsObject(true) + .SetEnumValueMode(NProtobufJson::TJson2ProtoConfig::EnumSnakeCaseInsensitive) + ); +} // TestComplexMapAsObject_EnumStringCaseInsensetive + Y_UNIT_TEST(TestComplexMapAsObject_Float) { TestComplexMapAsObject( [](TComplexMapType& proto) { diff --git a/library/cpp/protobuf/json/ut/util_ut.cpp b/library/cpp/protobuf/json/ut/util_ut.cpp index 0d22ce86d4..05101dca28 100644 --- a/library/cpp/protobuf/json/ut/util_ut.cpp +++ b/library/cpp/protobuf/json/ut/util_ut.cpp @@ -1,42 +1,42 @@ -#include <library/cpp/protobuf/json/util.h> - -#include <library/cpp/testing/unittest/registar.h> - -using namespace NProtobufJson; - -Y_UNIT_TEST_SUITE(TEqualsTest) { - Y_UNIT_TEST(TestEmpty) { - UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("", "")); - UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("", "_")); - UNIT_ASSERT(!EqualsIgnoringCaseAndUnderscores("f", "")); - } - - Y_UNIT_TEST(TestTrivial) { - UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("f", "f")); - UNIT_ASSERT(!EqualsIgnoringCaseAndUnderscores("f", "o")); - UNIT_ASSERT(!EqualsIgnoringCaseAndUnderscores("fo", "f")); - UNIT_ASSERT(!EqualsIgnoringCaseAndUnderscores("f", "fo")); - UNIT_ASSERT(!EqualsIgnoringCaseAndUnderscores("bar", "baz")); - } - - Y_UNIT_TEST(TestUnderscores) { - UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("foo_bar", "foobar")); - UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("foo_bar_", "foobar")); - UNIT_ASSERT(!EqualsIgnoringCaseAndUnderscores("foo_bar_z", "foobar")); - UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("foo__bar__", "foobar")); - UNIT_ASSERT(!EqualsIgnoringCaseAndUnderscores("foo__bar__z", "foobar")); - UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("_foo_bar", "foobar")); - UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("_foo_bar_", "foobar")); - UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("_foo_bar_", "foo___bar")); - } - - Y_UNIT_TEST(TestCase) { - UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("foo_bar", "FOO_BAR")); - UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("foobar", "fooBar")); - } - - Y_UNIT_TEST(TestCaseAndUnderscores) { - UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("fooBar", "FOO_BAR")); - UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("FOO_BAR_BAZ", "fooBar_BAZ")); - } -} +#include <library/cpp/protobuf/json/util.h> + +#include <library/cpp/testing/unittest/registar.h> + +using namespace NProtobufJson; + +Y_UNIT_TEST_SUITE(TEqualsTest) { + Y_UNIT_TEST(TestEmpty) { + UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("", "")); + UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("", "_")); + UNIT_ASSERT(!EqualsIgnoringCaseAndUnderscores("f", "")); + } + + Y_UNIT_TEST(TestTrivial) { + UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("f", "f")); + UNIT_ASSERT(!EqualsIgnoringCaseAndUnderscores("f", "o")); + UNIT_ASSERT(!EqualsIgnoringCaseAndUnderscores("fo", "f")); + UNIT_ASSERT(!EqualsIgnoringCaseAndUnderscores("f", "fo")); + UNIT_ASSERT(!EqualsIgnoringCaseAndUnderscores("bar", "baz")); + } + + Y_UNIT_TEST(TestUnderscores) { + UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("foo_bar", "foobar")); + UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("foo_bar_", "foobar")); + UNIT_ASSERT(!EqualsIgnoringCaseAndUnderscores("foo_bar_z", "foobar")); + UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("foo__bar__", "foobar")); + UNIT_ASSERT(!EqualsIgnoringCaseAndUnderscores("foo__bar__z", "foobar")); + UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("_foo_bar", "foobar")); + UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("_foo_bar_", "foobar")); + UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("_foo_bar_", "foo___bar")); + } + + Y_UNIT_TEST(TestCase) { + UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("foo_bar", "FOO_BAR")); + UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("foobar", "fooBar")); + } + + Y_UNIT_TEST(TestCaseAndUnderscores) { + UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("fooBar", "FOO_BAR")); + UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("FOO_BAR_BAZ", "fooBar_BAZ")); + } +} diff --git a/library/cpp/protobuf/json/ut/ya.make b/library/cpp/protobuf/json/ut/ya.make index 966d481639..b60a6d3c17 100644 --- a/library/cpp/protobuf/json/ut/ya.make +++ b/library/cpp/protobuf/json/ut/ya.make @@ -11,7 +11,7 @@ SRCS( string_transform_ut.cpp filter_ut.proto test.proto - util_ut.cpp + util_ut.cpp ) GENERATE_ENUM_SERIALIZATION(test.pb.h) |