diff options
author | Vasily Gerasimov <UgnineSirdis@gmail.com> | 2022-02-10 16:49:10 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:10 +0300 |
commit | 1eb755fbca92172a6aec2f57371b2b3a19dfab43 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/protobuf/util/repeated_field_utils_ut.cpp | |
parent | 6cdc8f140213c595e4ad38bc3d97fcef1146b8c3 (diff) | |
download | ydb-1eb755fbca92172a6aec2f57371b2b3a19dfab43.tar.gz |
Restoring authorship annotation for Vasily Gerasimov <UgnineSirdis@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/protobuf/util/repeated_field_utils_ut.cpp')
-rw-r--r-- | library/cpp/protobuf/util/repeated_field_utils_ut.cpp | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/library/cpp/protobuf/util/repeated_field_utils_ut.cpp b/library/cpp/protobuf/util/repeated_field_utils_ut.cpp index 94a494e1a3..58aaaa9e12 100644 --- a/library/cpp/protobuf/util/repeated_field_utils_ut.cpp +++ b/library/cpp/protobuf/util/repeated_field_utils_ut.cpp @@ -1,46 +1,46 @@ -#include "repeated_field_utils.h" +#include "repeated_field_utils.h" #include <library/cpp/protobuf/util/ut/common_ut.pb.h> - + #include <library/cpp/testing/unittest/registar.h> - -using namespace NProtoBuf; - + +using namespace NProtoBuf; + Y_UNIT_TEST_SUITE(RepeatedFieldUtils) { Y_UNIT_TEST(RemoveIf) { - { - NProtobufUtilUt::TWalkTest msg; - msg.AddRepInt(0); - msg.AddRepInt(1); - msg.AddRepInt(2); - msg.AddRepInt(3); - msg.AddRepInt(4); - msg.AddRepInt(5); - auto cond = [](ui32 val) { - return val % 2 == 0; - }; - RemoveRepeatedFieldItemIf(msg.MutableRepInt(), cond); - UNIT_ASSERT_VALUES_EQUAL(3, msg.RepIntSize()); - UNIT_ASSERT_VALUES_EQUAL(1, msg.GetRepInt(0)); - UNIT_ASSERT_VALUES_EQUAL(3, msg.GetRepInt(1)); - UNIT_ASSERT_VALUES_EQUAL(5, msg.GetRepInt(2)); - } - - { - NProtobufUtilUt::TWalkTest msg; - msg.AddRepSub()->SetOptInt(0); - msg.AddRepSub()->SetOptInt(1); - msg.AddRepSub()->SetOptInt(2); - msg.AddRepSub()->SetOptInt(3); - msg.AddRepSub()->SetOptInt(4); - msg.AddRepSub()->SetOptInt(5); - auto cond = [](const NProtobufUtilUt::TWalkTest& val) { - return val.GetOptInt() % 2 == 0; - }; - RemoveRepeatedFieldItemIf(msg.MutableRepSub(), cond); - UNIT_ASSERT_VALUES_EQUAL(3, msg.RepSubSize()); - UNIT_ASSERT_VALUES_EQUAL(1, msg.GetRepSub(0).GetOptInt()); - UNIT_ASSERT_VALUES_EQUAL(3, msg.GetRepSub(1).GetOptInt()); - UNIT_ASSERT_VALUES_EQUAL(5, msg.GetRepSub(2).GetOptInt()); - } - } -} + { + NProtobufUtilUt::TWalkTest msg; + msg.AddRepInt(0); + msg.AddRepInt(1); + msg.AddRepInt(2); + msg.AddRepInt(3); + msg.AddRepInt(4); + msg.AddRepInt(5); + auto cond = [](ui32 val) { + return val % 2 == 0; + }; + RemoveRepeatedFieldItemIf(msg.MutableRepInt(), cond); + UNIT_ASSERT_VALUES_EQUAL(3, msg.RepIntSize()); + UNIT_ASSERT_VALUES_EQUAL(1, msg.GetRepInt(0)); + UNIT_ASSERT_VALUES_EQUAL(3, msg.GetRepInt(1)); + UNIT_ASSERT_VALUES_EQUAL(5, msg.GetRepInt(2)); + } + + { + NProtobufUtilUt::TWalkTest msg; + msg.AddRepSub()->SetOptInt(0); + msg.AddRepSub()->SetOptInt(1); + msg.AddRepSub()->SetOptInt(2); + msg.AddRepSub()->SetOptInt(3); + msg.AddRepSub()->SetOptInt(4); + msg.AddRepSub()->SetOptInt(5); + auto cond = [](const NProtobufUtilUt::TWalkTest& val) { + return val.GetOptInt() % 2 == 0; + }; + RemoveRepeatedFieldItemIf(msg.MutableRepSub(), cond); + UNIT_ASSERT_VALUES_EQUAL(3, msg.RepSubSize()); + UNIT_ASSERT_VALUES_EQUAL(1, msg.GetRepSub(0).GetOptInt()); + UNIT_ASSERT_VALUES_EQUAL(3, msg.GetRepSub(1).GetOptInt()); + UNIT_ASSERT_VALUES_EQUAL(5, msg.GetRepSub(2).GetOptInt()); + } + } +} |