aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/scheme/tests/ut
diff options
context:
space:
mode:
authorisiv <isiv@yandex-team.ru>2022-02-10 16:47:54 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:54 +0300
commit40aa65b121746185908e51e32dca11ccee70140b (patch)
treec0748b5dcbade83af788c0abfa89c0383d6b779c /library/cpp/scheme/tests/ut
parentf20e3f1949626df2ef9d81d7618ec367b0c34f6b (diff)
downloadydb-40aa65b121746185908e51e32dca11ccee70140b.tar.gz
Restoring authorship annotation for <isiv@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/scheme/tests/ut')
-rw-r--r--library/cpp/scheme/tests/ut/scheme_proto_ut.cpp90
-rw-r--r--library/cpp/scheme/tests/ut/scheme_ut.proto8
2 files changed, 49 insertions, 49 deletions
diff --git a/library/cpp/scheme/tests/ut/scheme_proto_ut.cpp b/library/cpp/scheme/tests/ut/scheme_proto_ut.cpp
index ae670640ef..e711a0d092 100644
--- a/library/cpp/scheme/tests/ut/scheme_proto_ut.cpp
+++ b/library/cpp/scheme/tests/ut/scheme_proto_ut.cpp
@@ -16,23 +16,23 @@ Y_UNIT_TEST_SUITE(TSchemeProtoTest) {
Y_UNIT_TEST(TestFromProtobufWithDict) {
DoTestProtobuf(true, true);
- }
-
+ }
+
Y_UNIT_TEST(TestToProtobufWithDict) {
DoTestProtobuf(false, true);
- }
-
- template <class T>
- void AddMapPair(NSc::TValue& v, TStringBuf key, T value, bool mapAsDict) {
- if (mapAsDict) {
- v[key] = value;
- } else {
+ }
+
+ template <class T>
+ void AddMapPair(NSc::TValue& v, TStringBuf key, T value, bool mapAsDict) {
+ if (mapAsDict) {
+ v[key] = value;
+ } else {
auto& newElement = v.Push();
- newElement["key"] = key;
- newElement["value"] = value;
- }
- }
-
+ newElement["key"] = key;
+ newElement["value"] = value;
+ }
+ }
+
void DoTestProtobuf(bool fromProto, bool mapAsDict) {
NSc::TMessage m;
NSc::TValue v;
@@ -53,36 +53,36 @@ Y_UNIT_TEST_SUITE(TSchemeProtoTest) {
m.SetBytes("Bytes"), v["Bytes"] = "Bytes";
m.SetEnum(NSc::VALUE1), v["Enum"] = "VALUE1";
- auto& mapDoublesP = *m.mutable_mapdoubles();
- auto& mapDoublesV = v["MapDoubles"];
- mapDoublesP["pi"] = 3.14;
- AddMapPair(mapDoublesV, "pi", 3.14, mapAsDict);
- if (fromProto && mapAsDict) {
- // can not add two entries in dict, as it represent over array with unstable order
- mapDoublesP["back_e"] = 1 / 2.7;
- AddMapPair(mapDoublesV, "back_e", 1 / 2.7, mapAsDict);
- }
-
- auto& mapInt32sP = *m.mutable_mapint32s();
- auto& mapInt32sV = v["MapInt32s"];
- mapInt32sP["pi"] = -7;
- AddMapPair(mapInt32sV, "pi", -7, mapAsDict);
- if (fromProto && mapAsDict) {
- // can not add two entries in dict, as it represent over array with unstable order
- mapInt32sP["back_e"] = 42;
- AddMapPair(mapInt32sV, "back_e", 42, mapAsDict);
- }
-
- auto& mapStringP = *m.mutable_mapstring();
- auto& mapStringV = v["MapString"];
- mapStringP["intro"] = "body";
- AddMapPair(mapStringV, "intro", "body", mapAsDict);
- if (fromProto && mapAsDict) {
- // can not add two entries in dict, as it represent over array with unstable order
- mapStringP["deep"] = "blue";
- AddMapPair(mapStringV, "deep", "blue", mapAsDict);
- }
-
+ auto& mapDoublesP = *m.mutable_mapdoubles();
+ auto& mapDoublesV = v["MapDoubles"];
+ mapDoublesP["pi"] = 3.14;
+ AddMapPair(mapDoublesV, "pi", 3.14, mapAsDict);
+ if (fromProto && mapAsDict) {
+ // can not add two entries in dict, as it represent over array with unstable order
+ mapDoublesP["back_e"] = 1 / 2.7;
+ AddMapPair(mapDoublesV, "back_e", 1 / 2.7, mapAsDict);
+ }
+
+ auto& mapInt32sP = *m.mutable_mapint32s();
+ auto& mapInt32sV = v["MapInt32s"];
+ mapInt32sP["pi"] = -7;
+ AddMapPair(mapInt32sV, "pi", -7, mapAsDict);
+ if (fromProto && mapAsDict) {
+ // can not add two entries in dict, as it represent over array with unstable order
+ mapInt32sP["back_e"] = 42;
+ AddMapPair(mapInt32sV, "back_e", 42, mapAsDict);
+ }
+
+ auto& mapStringP = *m.mutable_mapstring();
+ auto& mapStringV = v["MapString"];
+ mapStringP["intro"] = "body";
+ AddMapPair(mapStringV, "intro", "body", mapAsDict);
+ if (fromProto && mapAsDict) {
+ // can not add two entries in dict, as it represent over array with unstable order
+ mapStringP["deep"] = "blue";
+ AddMapPair(mapStringV, "deep", "blue", mapAsDict);
+ }
+
m.AddDoubles((double)1 / 3), v["Doubles"][0] = (double)1 / 3;
m.AddDoubles((double)1 / 4), v["Doubles"][1] = (double)1 / 4;
@@ -208,7 +208,7 @@ Y_UNIT_TEST_SUITE(TSchemeProtoTest) {
*(m.AddMessages()) = m2, v["Messages"][1] = v2;
if (fromProto) {
- UNIT_ASSERT(NSc::TValue::Equal(v, NSc::TValue::From(m, mapAsDict)));
+ UNIT_ASSERT(NSc::TValue::Equal(v, NSc::TValue::From(m, mapAsDict)));
} else {
NSc::TMessage proto;
v.To(proto);
diff --git a/library/cpp/scheme/tests/ut/scheme_ut.proto b/library/cpp/scheme/tests/ut/scheme_ut.proto
index 1d89d990b3..7981af7eae 100644
--- a/library/cpp/scheme/tests/ut/scheme_ut.proto
+++ b/library/cpp/scheme/tests/ut/scheme_ut.proto
@@ -36,10 +36,10 @@ message TMessage {
repeated bytes Bytess = 32;
repeated EEnum Enums = 33;
repeated TMessage2 Messages = 34;
-
- map<string, double> MapDoubles = 35;
- map<string, int32> MapInt32s = 36;
- map<string, string> MapString = 37;
+
+ map<string, double> MapDoubles = 35;
+ map<string, int32> MapInt32s = 36;
+ map<string, string> MapString = 37;
}
enum EEnum {