diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:15 +0300 |
commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /library/cpp/scheme/tests/ut | |
parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
download | ydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/scheme/tests/ut')
-rw-r--r-- | library/cpp/scheme/tests/ut/scheme_cast_ut.cpp | 34 | ||||
-rw-r--r-- | library/cpp/scheme/tests/ut/scheme_json_ut.cpp | 66 | ||||
-rw-r--r-- | library/cpp/scheme/tests/ut/scheme_path_ut.cpp | 44 | ||||
-rw-r--r-- | library/cpp/scheme/tests/ut/scheme_proto_ut.cpp | 206 | ||||
-rw-r--r-- | library/cpp/scheme/tests/ut/scheme_ut.cpp | 28 |
5 files changed, 189 insertions, 189 deletions
diff --git a/library/cpp/scheme/tests/ut/scheme_cast_ut.cpp b/library/cpp/scheme/tests/ut/scheme_cast_ut.cpp index 4f907157e9..a57b77e566 100644 --- a/library/cpp/scheme/tests/ut/scheme_cast_ut.cpp +++ b/library/cpp/scheme/tests/ut/scheme_cast_ut.cpp @@ -26,13 +26,13 @@ Y_UNIT_TEST_SUITE(TSchemeCastTest) { TVI y(FromJson<TVI>(ToJson(v))); UNIT_ASSERT_VALUES_EQUAL(v.size(), y.size()); - UNIT_ASSERT(std::equal(v.begin(), v.end(), y.begin())); + UNIT_ASSERT(std::equal(v.begin(), v.end(), y.begin())); } Y_UNIT_TEST(TestYHash) { THI h; for (int i = 0; i < 3; ++i) - h[i] = i * i; + h[i] = i * i; const TString etalon = "{\"0\":0,\"1\":1,\"2\":4}"; UNIT_ASSERT_VALUES_EQUAL(etalon, ToJson(h, true)); @@ -44,7 +44,7 @@ Y_UNIT_TEST_SUITE(TSchemeCastTest) { Y_UNIT_TEST(TestYMap) { TMI h; for (int i = 0; i < 3; ++i) - h[i] = i * i; + h[i] = i * i; const TString etalon = "{\"0\":0,\"1\":1,\"2\":4}"; UNIT_ASSERT_VALUES_EQUAL(etalon, ToJson(h, true)); @@ -56,7 +56,7 @@ Y_UNIT_TEST_SUITE(TSchemeCastTest) { Y_UNIT_TEST(TestYHashSet) { THSI h; for (int i = 0; i < 3; ++i) - h.insert(i * i); + h.insert(i * i); const TString etalon = "{\"0\":null,\"1\":null,\"4\":null}"; UNIT_ASSERT_VALUES_EQUAL(etalon, ToJson(h, true)); @@ -68,7 +68,7 @@ Y_UNIT_TEST_SUITE(TSchemeCastTest) { Y_UNIT_TEST(TestYSet) { TSI h; for (int i = 0; i < 3; ++i) - h.insert(i * i); + h.insert(i * i); const TString etalon = "{\"0\":null,\"1\":null,\"4\":null}"; UNIT_ASSERT_VALUES_EQUAL(etalon, ToJson(h, true)); @@ -78,7 +78,7 @@ Y_UNIT_TEST_SUITE(TSchemeCastTest) { } Y_UNIT_TEST(TestTPair) { - TPI p(1, 1); + TPI p(1, 1); const TString etalon = "[1,1]"; UNIT_ASSERT_VALUES_EQUAL(etalon, ToJson(p, true)); @@ -89,14 +89,14 @@ Y_UNIT_TEST_SUITE(TSchemeCastTest) { struct TCustom: public IJsonSerializable { int A, B; - TCustom() - : A(0) - , B(0){}; - TCustom(int a, int b) - : A(a) - , B(b) - { - } + TCustom() + : A(0) + , B(0){}; + TCustom(int a, int b) + : A(a) + , B(b) + { + } NSc::TValue ToTValue() const override { NSc::TValue res; res["a"] = A; @@ -108,7 +108,7 @@ Y_UNIT_TEST_SUITE(TSchemeCastTest) { B = v["b"].GetNumber(); } - bool operator<(const TCustom& rhs) const { + bool operator<(const TCustom& rhs) const { return A < rhs.A; } }; @@ -128,7 +128,7 @@ Y_UNIT_TEST_SUITE(TSchemeCastTest) { TVPI v; for (int i = 0; i < 3; ++i) - v.push_back(TPI(i, i * i)); + v.push_back(TPI(i, i * i)); const TString etalon = "[[0,0],[1,1],[2,4]]"; UNIT_ASSERT_VALUES_EQUAL(etalon, ToJson(v, true)); @@ -140,7 +140,7 @@ Y_UNIT_TEST_SUITE(TSchemeCastTest) { Y_UNIT_TEST(TestSetOfCustom) { typedef TSet<TCustom> TSC; TSC s; - s.insert(TCustom(2, 3)); + s.insert(TCustom(2, 3)); const TString etalon = "{\"{\\\"a\\\":2,\\\"b\\\":3}\":null}"; UNIT_ASSERT_VALUES_EQUAL(etalon, ToJson(s, true)); diff --git a/library/cpp/scheme/tests/ut/scheme_json_ut.cpp b/library/cpp/scheme/tests/ut/scheme_json_ut.cpp index daeb2654f9..561829ffab 100644 --- a/library/cpp/scheme/tests/ut/scheme_json_ut.cpp +++ b/library/cpp/scheme/tests/ut/scheme_json_ut.cpp @@ -14,12 +14,12 @@ using namespace std::string_view_literals; Y_UNIT_TEST_SUITE(TSchemeJsonTest) { Y_UNIT_TEST(TestJson) { const char* json = "[\n" - " {\n" - " \"url\":\"foo\",\n" - " \"title\":\"bar\",\n" - " \"passages\":[\"foo\", \"bar\"],\n" - " }\n" - "]"; + " {\n" + " \"url\":\"foo\",\n" + " \"title\":\"bar\",\n" + " \"passages\":[\"foo\", \"bar\"],\n" + " }\n" + "]"; { const NSc::TValue& v = NSc::TValue::FromJson(json); @@ -84,32 +84,32 @@ Y_UNIT_TEST_SUITE(TSchemeJsonTest) { UNIT_ASSERT_VALUES_EQUAL("{\"xxx\":null}", v.ToJson(NSc::TValue::JO_SAFE)); UNIT_ASSERT_VALUES_EQUAL("{" - "\"\\u0000\\u0001\\u0002\\u0003\\u0004\\u0005\\u0006\\u0007\\b\\t\\n\\u000B\\f\\r" - "\\u000E\\u000F\\u0010\\u0011\\u0012\\u0013\\u0014\\u0015\\u0016\\u0017\\u0018" - "\\u0019\\u001A\\u001B\\u001C\\u001D\\u001E\\u001F !\\\"#$%&'()*+,-./0123456789" - ":;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\\u007F" - "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93" - "\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7" - "\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB" - "\xBC\xBD\xBE\xBF\\xC0\\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE" - "\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xE0\xE1" - "\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4" - "\\xF5\\xF6\\xF7\\xF8\\xF9\\xFA\\xFB\\xFC\\xFD\\xFE\\xFF\":" - "\"xxx\"," - "\"xxx\":" - "\"\\u0000\\u0001\\u0002\\u0003\\u0004\\u0005\\u0006\\u0007\\b\\t\\n\\u000B\\f\\r" - "\\u000E\\u000F\\u0010\\u0011\\u0012\\u0013\\u0014\\u0015\\u0016\\u0017\\u0018" - "\\u0019\\u001A\\u001B\\u001C\\u001D\\u001E\\u001F !\\\"#$%&'()*+,-./0123456789" - ":;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\\u007F" - "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93" - "\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7" - "\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB" - "\xBC\xBD\xBE\xBF\\xC0\\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE" - "\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xE0\xE1" - "\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4" - "\\xF5\\xF6\\xF7\\xF8\\xF9\\xFA\\xFB\\xFC\\xFD\\xFE\\xFF\"" - "}", - v.ToJson(NSc::TValue::JO_SORT_KEYS)); + "\"\\u0000\\u0001\\u0002\\u0003\\u0004\\u0005\\u0006\\u0007\\b\\t\\n\\u000B\\f\\r" + "\\u000E\\u000F\\u0010\\u0011\\u0012\\u0013\\u0014\\u0015\\u0016\\u0017\\u0018" + "\\u0019\\u001A\\u001B\\u001C\\u001D\\u001E\\u001F !\\\"#$%&'()*+,-./0123456789" + ":;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\\u007F" + "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93" + "\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7" + "\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB" + "\xBC\xBD\xBE\xBF\\xC0\\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE" + "\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xE0\xE1" + "\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4" + "\\xF5\\xF6\\xF7\\xF8\\xF9\\xFA\\xFB\\xFC\\xFD\\xFE\\xFF\":" + "\"xxx\"," + "\"xxx\":" + "\"\\u0000\\u0001\\u0002\\u0003\\u0004\\u0005\\u0006\\u0007\\b\\t\\n\\u000B\\f\\r" + "\\u000E\\u000F\\u0010\\u0011\\u0012\\u0013\\u0014\\u0015\\u0016\\u0017\\u0018" + "\\u0019\\u001A\\u001B\\u001C\\u001D\\u001E\\u001F !\\\"#$%&'()*+,-./0123456789" + ":;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\\u007F" + "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93" + "\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7" + "\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB" + "\xBC\xBD\xBE\xBF\\xC0\\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE" + "\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xE0\xE1" + "\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4" + "\\xF5\\xF6\\xF7\\xF8\\xF9\\xFA\\xFB\\xFC\\xFD\\xFE\\xFF\"" + "}", + v.ToJson(NSc::TValue::JO_SORT_KEYS)); UNIT_ASSERT(NSc::TValue::Equal(v, NSc::TValue::FromJson(v.ToJson()))); { @@ -152,7 +152,7 @@ Y_UNIT_TEST_SUITE(TSchemeJsonTest) { } Y_UNIT_TEST(TestDuplicateKeys) { - const TStringBuf duplicatedKeys = "{\"a\":[{\"b\":1, \"b\":42}]}"; + const TStringBuf duplicatedKeys = "{\"a\":[{\"b\":1, \"b\":42}]}"; UNIT_ASSERT_NO_EXCEPTION(NSc::TValue::FromJsonThrow(duplicatedKeys)); UNIT_ASSERT_EXCEPTION(NSc::TValue::FromJsonThrow(duplicatedKeys, NSc::TValue::JO_PARSER_DISALLOW_DUPLICATE_KEYS), yexception); UNIT_ASSERT(NSc::TValue::FromJson(duplicatedKeys).IsDict()); diff --git a/library/cpp/scheme/tests/ut/scheme_path_ut.cpp b/library/cpp/scheme/tests/ut/scheme_path_ut.cpp index 0d4d79d483..45cd19a4be 100644 --- a/library/cpp/scheme/tests/ut/scheme_path_ut.cpp +++ b/library/cpp/scheme/tests/ut/scheme_path_ut.cpp @@ -34,21 +34,21 @@ Y_UNIT_TEST_SUITE(TSchemePathTest) { UNIT_ASSERT(v.PathExists("//")); UNIT_ASSERT(NSc::TValue::Same(v, *v.TrySelectOrAdd("//"))); - NSc::NUt::AssertSchemeJson("null", v); + NSc::NUt::AssertSchemeJson("null", v); UNIT_ASSERT(NSc::TValue::Same(v.TrySelectAndDelete("//"), NSc::Null())); - NSc::NUt::AssertSchemeJson("null", v); + NSc::NUt::AssertSchemeJson("null", v); v.SetDict(); UNIT_ASSERT(NSc::TValue::Same(v, *v.TrySelectOrAdd("//"))); - NSc::NUt::AssertSchemeJson("{}", v); + NSc::NUt::AssertSchemeJson("{}", v); UNIT_ASSERT(NSc::TValue::Same(v.TrySelectAndDelete("//"), NSc::Null())); - NSc::NUt::AssertSchemeJson("{}", v); + NSc::NUt::AssertSchemeJson("{}", v); v.SetArray(); UNIT_ASSERT(NSc::TValue::Same(v, *v.TrySelectOrAdd("//"))); - NSc::NUt::AssertSchemeJson("[]", v); + NSc::NUt::AssertSchemeJson("[]", v); UNIT_ASSERT(NSc::TValue::Same(v.TrySelectAndDelete("//"), NSc::Null())); - NSc::NUt::AssertSchemeJson("[]", v); + NSc::NUt::AssertSchemeJson("[]", v); DoTestSelect("[]", "{'':1}", "{}"); DoTestSelect("[ ]", "{' ':1}", "{}"); @@ -69,27 +69,27 @@ Y_UNIT_TEST_SUITE(TSchemePathTest) { } Y_UNIT_TEST(TestPathEscapes) { - UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("a"), "a"); - UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath(""), R"=("")="); - UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("[]"), R"=("[]")="); + UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("a"), "a"); + UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath(""), R"=("")="); + UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("[]"), R"=("[]")="); UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("[]ab"), R"=("[]ab")="); UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("a[]b"), R"=("a[]b")="); UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("ab[]"), R"=("ab[]")="); UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("[ab]"), R"=("[ab]")="); - UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("[ab"), R"=("[ab")="); - UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("a[b"), R"=("a[b")="); - UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("ab["), R"=("ab[")="); - UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("]ab"), R"=("]ab")="); - UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("a]b"), R"=("a]b")="); - UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("ab]"), R"=("ab]")="); - UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath(R"=(\)="), R"=("\\")="); + UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("[ab"), R"=("[ab")="); + UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("a[b"), R"=("a[b")="); + UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("ab["), R"=("ab[")="); + UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("]ab"), R"=("]ab")="); + UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("a]b"), R"=("a]b")="); + UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("ab]"), R"=("ab]")="); + UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath(R"=(\)="), R"=("\\")="); UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath(R"=(\\)="), R"=("\\\\")="); - UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("/"), R"=("/")="); - UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("//"), R"=("//")="); - UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("///"), R"=("///")="); - UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("/ab"), R"=("/ab")="); - UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("a/b"), R"=("a/b")="); - UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("ab/"), R"=("ab/")="); + UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("/"), R"=("/")="); + UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("//"), R"=("//")="); + UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("///"), R"=("///")="); + UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("/ab"), R"=("/ab")="); + UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("a/b"), R"=("a/b")="); + UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("ab/"), R"=("ab/")="); UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("//ab"), R"=("//ab")="); UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("a//b"), R"=("a//b")="); UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::EscapeForPath("ab//"), R"=("ab//")="); diff --git a/library/cpp/scheme/tests/ut/scheme_proto_ut.cpp b/library/cpp/scheme/tests/ut/scheme_proto_ut.cpp index e711a0d092..502c74b15b 100644 --- a/library/cpp/scheme/tests/ut/scheme_proto_ut.cpp +++ b/library/cpp/scheme/tests/ut/scheme_proto_ut.cpp @@ -36,22 +36,22 @@ Y_UNIT_TEST_SUITE(TSchemeProtoTest) { void DoTestProtobuf(bool fromProto, bool mapAsDict) { NSc::TMessage m; NSc::TValue v; - m.SetDouble((double)1 / 3), v["Double"] = (double)1 / 3; - m.SetFloat((float)1 / 3), v["Float"] = (float)1 / 3; - m.SetInt32(1000000), v["Int32"] = 1000000; - m.SetInt64(1000000000000LL), v["Int64"] = 1000000000000LL; - m.SetUInt32(555555), v["UInt32"] = 555555; - m.SetUInt64(555555555555LL), v["UInt64"] = 555555555555LL; - m.SetSInt32(-555555), v["SInt32"] = -555555; - m.SetSInt64(-555555555555LL), v["SInt64"] = -555555555555LL; - m.SetFixed32(123456), v["Fixed32"] = 123456; - m.SetFixed64(123456123456LL), v["Fixed64"] = 123456123456LL; - m.SetSFixed32(-123456), v["SFixed32"] = -123456; - m.SetSFixed64(-123456123456LL), v["SFixed64"] = -123456123456LL; - m.SetBool(true), v["Bool"] = true; - m.SetString("String"), v["String"] = "String"; - m.SetBytes("Bytes"), v["Bytes"] = "Bytes"; - m.SetEnum(NSc::VALUE1), v["Enum"] = "VALUE1"; + m.SetDouble((double)1 / 3), v["Double"] = (double)1 / 3; + m.SetFloat((float)1 / 3), v["Float"] = (float)1 / 3; + m.SetInt32(1000000), v["Int32"] = 1000000; + m.SetInt64(1000000000000LL), v["Int64"] = 1000000000000LL; + m.SetUInt32(555555), v["UInt32"] = 555555; + m.SetUInt64(555555555555LL), v["UInt64"] = 555555555555LL; + m.SetSInt32(-555555), v["SInt32"] = -555555; + m.SetSInt64(-555555555555LL), v["SInt64"] = -555555555555LL; + m.SetFixed32(123456), v["Fixed32"] = 123456; + m.SetFixed64(123456123456LL), v["Fixed64"] = 123456123456LL; + m.SetSFixed32(-123456), v["SFixed32"] = -123456; + m.SetSFixed64(-123456123456LL), v["SFixed64"] = -123456123456LL; + m.SetBool(true), v["Bool"] = true; + m.SetString("String"), v["String"] = "String"; + m.SetBytes("Bytes"), v["Bytes"] = "Bytes"; + m.SetEnum(NSc::VALUE1), v["Enum"] = "VALUE1"; auto& mapDoublesP = *m.mutable_mapdoubles(); auto& mapDoublesV = v["MapDoubles"]; @@ -83,129 +83,129 @@ Y_UNIT_TEST_SUITE(TSchemeProtoTest) { 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; + m.AddDoubles((double)1 / 3), v["Doubles"][0] = (double)1 / 3; + m.AddDoubles((double)1 / 4), v["Doubles"][1] = (double)1 / 4; - m.AddFloats((float)1 / 3), v["Floats"][0] = (float)1 / 3; - m.AddFloats((float)1 / 4), v["Floats"][1] = (float)1 / 4; + m.AddFloats((float)1 / 3), v["Floats"][0] = (float)1 / 3; + m.AddFloats((float)1 / 4), v["Floats"][1] = (float)1 / 4; - m.AddInt32s(1000000), v["Int32s"][0] = 1000000; - m.AddInt32s(2000000), v["Int32s"][1] = 2000000; + m.AddInt32s(1000000), v["Int32s"][0] = 1000000; + m.AddInt32s(2000000), v["Int32s"][1] = 2000000; - m.AddInt64s(1000000000000LL), v["Int64s"][0] = 1000000000000LL; - m.AddInt64s(2000000000000LL), v["Int64s"][1] = 2000000000000LL; + m.AddInt64s(1000000000000LL), v["Int64s"][0] = 1000000000000LL; + m.AddInt64s(2000000000000LL), v["Int64s"][1] = 2000000000000LL; - m.AddUInt32s(555555), v["UInt32s"][0] = 555555; - m.AddUInt32s(655555), v["UInt32s"][1] = 655555; + m.AddUInt32s(555555), v["UInt32s"][0] = 555555; + m.AddUInt32s(655555), v["UInt32s"][1] = 655555; - m.AddUInt64s(555555555555LL); - v["UInt64s"][0] = 555555555555LL; - m.AddUInt64s(655555555555LL); - v["UInt64s"][1] = 655555555555LL; + m.AddUInt64s(555555555555LL); + v["UInt64s"][0] = 555555555555LL; + m.AddUInt64s(655555555555LL); + v["UInt64s"][1] = 655555555555LL; - m.AddSInt32s(-555555), v["SInt32s"][0] = -555555; - m.AddSInt32s(-655555), v["SInt32s"][1] = -655555; + m.AddSInt32s(-555555), v["SInt32s"][0] = -555555; + m.AddSInt32s(-655555), v["SInt32s"][1] = -655555; - m.AddSInt64s(-555555555555LL), v["SInt64s"][0] = -555555555555LL; - m.AddSInt64s(-655555555555LL), v["SInt64s"][1] = -655555555555LL; + m.AddSInt64s(-555555555555LL), v["SInt64s"][0] = -555555555555LL; + m.AddSInt64s(-655555555555LL), v["SInt64s"][1] = -655555555555LL; - m.AddFixed32s(123456), v["Fixed32s"][0] = 123456; - m.AddFixed32s(223456), v["Fixed32s"][1] = 223456; + m.AddFixed32s(123456), v["Fixed32s"][0] = 123456; + m.AddFixed32s(223456), v["Fixed32s"][1] = 223456; - m.AddFixed64s(123456123456LL), v["Fixed64s"][0] = 123456123456LL; - m.AddFixed64s(223456123456LL), v["Fixed64s"][1] = 223456123456LL; + m.AddFixed64s(123456123456LL), v["Fixed64s"][0] = 123456123456LL; + m.AddFixed64s(223456123456LL), v["Fixed64s"][1] = 223456123456LL; - m.AddSFixed32s(-123456), v["SFixed32s"][0] = -123456; - m.AddSFixed32s(-223456), v["SFixed32s"][1] = -223456; + m.AddSFixed32s(-123456), v["SFixed32s"][0] = -123456; + m.AddSFixed32s(-223456), v["SFixed32s"][1] = -223456; - m.AddSFixed64s(-123456123456LL), v["SFixed64s"][0] = -123456123456LL; - m.AddSFixed64s(-223456123456LL), v["SFixed64s"][1] = -223456123456LL; + m.AddSFixed64s(-123456123456LL), v["SFixed64s"][0] = -123456123456LL; + m.AddSFixed64s(-223456123456LL), v["SFixed64s"][1] = -223456123456LL; - m.AddBools(false), v["Bools"][0] = false; - m.AddBools(true), v["Bools"][1] = true; + m.AddBools(false), v["Bools"][0] = false; + m.AddBools(true), v["Bools"][1] = true; - m.AddStrings("String1"), v["Strings"][0] = "String1"; - m.AddStrings("String2"), v["Strings"][1] = "String2"; + m.AddStrings("String1"), v["Strings"][0] = "String1"; + m.AddStrings("String2"), v["Strings"][1] = "String2"; - m.AddBytess("Bytes1"), v["Bytess"][0] = "Bytes1"; - m.AddBytess("Bytes2"), v["Bytess"][1] = "Bytes2"; + m.AddBytess("Bytes1"), v["Bytess"][0] = "Bytes1"; + m.AddBytess("Bytes2"), v["Bytess"][1] = "Bytes2"; - m.AddEnums(NSc::VALUE1), v["Enums"][0] = "VALUE1"; - m.AddEnums(NSc::VALUE2), v["Enums"][1] = "VALUE2"; + m.AddEnums(NSc::VALUE1), v["Enums"][0] = "VALUE1"; + m.AddEnums(NSc::VALUE2), v["Enums"][1] = "VALUE2"; NSc::TMessage2 m2; NSc::TValue v2; - m2.SetDouble((double)1 / 3), v2["Double"] = (double)1 / 3; - m2.SetFloat((float)1 / 3), v2["Float"] = (float)1 / 3; - m2.SetInt32(1000000), v2["Int32"] = 1000000; - m2.SetInt64(1000000000000LL), v2["Int64"] = 1000000000000LL; - m2.SetUInt32(555555), v2["UInt32"] = 555555; - m2.SetUInt64(555555555555LL), v2["UInt64"] = 555555555555LL; - m2.SetSInt32(-555555), v2["SInt32"] = -555555; - m2.SetSInt64(-555555555555LL), v2["SInt64"] = -555555555555LL; - m2.SetFixed32(123456), v2["Fixed32"] = 123456; - m2.SetFixed64(123456123456LL), v2["Fixed64"] = 123456123456LL; - m2.SetSFixed32(-123456), v2["SFixed32"] = -123456; - m2.SetSFixed64(-123456123456LL), v2["SFixed64"] = -123456123456LL; - m2.SetBool(true), v2["Bool"] = true; - m2.SetString("String"), v2["String"] = "String"; - m2.SetBytes("Bytes"), v2["Bytes"] = "Bytes"; - m2.SetEnum(NSc::VALUE1), v2["Enum"] = "VALUE1"; + m2.SetDouble((double)1 / 3), v2["Double"] = (double)1 / 3; + m2.SetFloat((float)1 / 3), v2["Float"] = (float)1 / 3; + m2.SetInt32(1000000), v2["Int32"] = 1000000; + m2.SetInt64(1000000000000LL), v2["Int64"] = 1000000000000LL; + m2.SetUInt32(555555), v2["UInt32"] = 555555; + m2.SetUInt64(555555555555LL), v2["UInt64"] = 555555555555LL; + m2.SetSInt32(-555555), v2["SInt32"] = -555555; + m2.SetSInt64(-555555555555LL), v2["SInt64"] = -555555555555LL; + m2.SetFixed32(123456), v2["Fixed32"] = 123456; + m2.SetFixed64(123456123456LL), v2["Fixed64"] = 123456123456LL; + m2.SetSFixed32(-123456), v2["SFixed32"] = -123456; + m2.SetSFixed64(-123456123456LL), v2["SFixed64"] = -123456123456LL; + m2.SetBool(true), v2["Bool"] = true; + m2.SetString("String"), v2["String"] = "String"; + m2.SetBytes("Bytes"), v2["Bytes"] = "Bytes"; + m2.SetEnum(NSc::VALUE1), v2["Enum"] = "VALUE1"; - m2.AddDoubles((double)1 / 3), v2["Doubles"][0] = (double)1 / 3; - m2.AddDoubles((double)1 / 4), v2["Doubles"][1] = (double)1 / 4; + m2.AddDoubles((double)1 / 3), v2["Doubles"][0] = (double)1 / 3; + m2.AddDoubles((double)1 / 4), v2["Doubles"][1] = (double)1 / 4; - m2.AddFloats((float)1 / 3), v2["Floats"][0] = (float)1 / 3; - m2.AddFloats((float)1 / 4), v2["Floats"][1] = (float)1 / 4; + m2.AddFloats((float)1 / 3), v2["Floats"][0] = (float)1 / 3; + m2.AddFloats((float)1 / 4), v2["Floats"][1] = (float)1 / 4; - m2.AddInt32s(1000000), v2["Int32s"][0] = 1000000; - m2.AddInt32s(2000000), v2["Int32s"][1] = 2000000; + m2.AddInt32s(1000000), v2["Int32s"][0] = 1000000; + m2.AddInt32s(2000000), v2["Int32s"][1] = 2000000; - m2.AddInt64s(1000000000000LL), v2["Int64s"][0] = 1000000000000LL; - m2.AddInt64s(2000000000000LL), v2["Int64s"][1] = 2000000000000LL; + m2.AddInt64s(1000000000000LL), v2["Int64s"][0] = 1000000000000LL; + m2.AddInt64s(2000000000000LL), v2["Int64s"][1] = 2000000000000LL; - m2.AddUInt32s(555555), v2["UInt32s"][0] = 555555; - m2.AddUInt32s(655555), v2["UInt32s"][1] = 655555; + m2.AddUInt32s(555555), v2["UInt32s"][0] = 555555; + m2.AddUInt32s(655555), v2["UInt32s"][1] = 655555; - m2.AddUInt64s(555555555555LL); - v2["UInt64s"][0] = 555555555555LL; - m2.AddUInt64s(655555555555LL); - v2["UInt64s"][1] = 655555555555LL; + m2.AddUInt64s(555555555555LL); + v2["UInt64s"][0] = 555555555555LL; + m2.AddUInt64s(655555555555LL); + v2["UInt64s"][1] = 655555555555LL; - m2.AddSInt32s(-555555), v2["SInt32s"][0] = -555555; - m2.AddSInt32s(-655555), v2["SInt32s"][1] = -655555; + m2.AddSInt32s(-555555), v2["SInt32s"][0] = -555555; + m2.AddSInt32s(-655555), v2["SInt32s"][1] = -655555; - m2.AddSInt64s(-555555555555LL), v2["SInt64s"][0] = -555555555555LL; - m2.AddSInt64s(-655555555555LL), v2["SInt64s"][1] = -655555555555LL; + m2.AddSInt64s(-555555555555LL), v2["SInt64s"][0] = -555555555555LL; + m2.AddSInt64s(-655555555555LL), v2["SInt64s"][1] = -655555555555LL; - m2.AddFixed32s(123456), v2["Fixed32s"][0] = 123456; - m2.AddFixed32s(223456), v2["Fixed32s"][1] = 223456; + m2.AddFixed32s(123456), v2["Fixed32s"][0] = 123456; + m2.AddFixed32s(223456), v2["Fixed32s"][1] = 223456; - m2.AddFixed64s(123456123456LL), v2["Fixed64s"][0] = 123456123456LL; - m2.AddFixed64s(223456123456LL), v2["Fixed64s"][1] = 223456123456LL; + m2.AddFixed64s(123456123456LL), v2["Fixed64s"][0] = 123456123456LL; + m2.AddFixed64s(223456123456LL), v2["Fixed64s"][1] = 223456123456LL; - m2.AddSFixed32s(-123456), v2["SFixed32s"][0] = -123456; - m2.AddSFixed32s(-223456), v2["SFixed32s"][1] = -223456; + m2.AddSFixed32s(-123456), v2["SFixed32s"][0] = -123456; + m2.AddSFixed32s(-223456), v2["SFixed32s"][1] = -223456; - m2.AddSFixed64s(-123456123456LL), v2["SFixed64s"][0] = -123456123456LL; - m2.AddSFixed64s(-223456123456LL), v2["SFixed64s"][1] = -223456123456LL; + m2.AddSFixed64s(-123456123456LL), v2["SFixed64s"][0] = -123456123456LL; + m2.AddSFixed64s(-223456123456LL), v2["SFixed64s"][1] = -223456123456LL; - m2.AddBools(false), v2["Bools"][0] = false; - m2.AddBools(true), v2["Bools"][1] = true; + m2.AddBools(false), v2["Bools"][0] = false; + m2.AddBools(true), v2["Bools"][1] = true; - m2.AddStrings("String1"), v2["Strings"][0] = "String1"; - m2.AddStrings("String2"), v2["Strings"][1] = "String2"; + m2.AddStrings("String1"), v2["Strings"][0] = "String1"; + m2.AddStrings("String2"), v2["Strings"][1] = "String2"; - m2.AddBytess("Bytes1"), v2["Bytess"][0] = "Bytes1"; - m2.AddBytess("Bytes2"), v2["Bytess"][1] = "Bytes2"; + m2.AddBytess("Bytes1"), v2["Bytess"][0] = "Bytes1"; + m2.AddBytess("Bytes2"), v2["Bytess"][1] = "Bytes2"; - m2.AddEnums(NSc::VALUE1), v2["Enums"][0] = "VALUE1"; - m2.AddEnums(NSc::VALUE2), v2["Enums"][1] = "VALUE2"; + m2.AddEnums(NSc::VALUE1), v2["Enums"][0] = "VALUE1"; + m2.AddEnums(NSc::VALUE2), v2["Enums"][1] = "VALUE2"; - *(m.MutableMessage()) = m2, v["Message"] = v2; + *(m.MutableMessage()) = m2, v["Message"] = v2; - *(m.AddMessages()) = m2, v["Messages"][0] = v2; - *(m.AddMessages()) = m2, v["Messages"][1] = v2; + *(m.AddMessages()) = m2, v["Messages"][0] = v2; + *(m.AddMessages()) = m2, v["Messages"][1] = v2; if (fromProto) { UNIT_ASSERT(NSc::TValue::Equal(v, NSc::TValue::From(m, mapAsDict))); diff --git a/library/cpp/scheme/tests/ut/scheme_ut.cpp b/library/cpp/scheme/tests/ut/scheme_ut.cpp index 1a5d07c31b..a6bfc7d843 100644 --- a/library/cpp/scheme/tests/ut/scheme_ut.cpp +++ b/library/cpp/scheme/tests/ut/scheme_ut.cpp @@ -134,11 +134,11 @@ Y_UNIT_TEST_SUITE(TSchemeTest) { UNIT_ASSERT_VALUES_EQUAL_C(i64(t), NSc::TValue(i64(t)).ForceIntNumber(), ToString(t)); UNIT_ASSERT_VALUES_EQUAL_C(double(t), NSc::TValue(double(t)).ForceNumber(), ToString(t)); - UNIT_ASSERT_VALUES_EQUAL_C(i64(t), NSc::TValue(TStringBuf(ToString(i64(t)))).ForceIntNumber(), ToString(t)); - UNIT_ASSERT_VALUES_EQUAL_C(ToString(double(t)), ToString(NSc::TValue(TStringBuf(ToString(double(t)))).ForceNumber()), ToString(t)); + UNIT_ASSERT_VALUES_EQUAL_C(i64(t), NSc::TValue(TStringBuf(ToString(i64(t)))).ForceIntNumber(), ToString(t)); + UNIT_ASSERT_VALUES_EQUAL_C(ToString(double(t)), ToString(NSc::TValue(TStringBuf(ToString(double(t)))).ForceNumber()), ToString(t)); - UNIT_ASSERT_VALUES_EQUAL_C(ToString(i64(t)), NSc::TValue(TStringBuf(ToString(i64(t)))).ForceString(), ToString(t)); - UNIT_ASSERT_VALUES_EQUAL_C(ToString(double(t)), NSc::TValue(TStringBuf(ToString(double(t)))).ForceString(), ToString(t)); + UNIT_ASSERT_VALUES_EQUAL_C(ToString(i64(t)), NSc::TValue(TStringBuf(ToString(i64(t)))).ForceString(), ToString(t)); + UNIT_ASSERT_VALUES_EQUAL_C(ToString(double(t)), NSc::TValue(TStringBuf(ToString(double(t)))).ForceString(), ToString(t)); } Y_UNIT_TEST(TestForce) { @@ -258,8 +258,8 @@ Y_UNIT_TEST_SUITE(TSchemeTest) { DoCheckAssignmentNum<double>(i, iless, imore, ii, "double"); } - // DoCheckAssignment<bool>(true, true, true, "true", "bool"); - // DoCheckAssignment<bool>(false, false, false, "false", "bool"); + // DoCheckAssignment<bool>(true, true, true, "true", "bool"); + // DoCheckAssignment<bool>(false, false, false, "false", "bool"); for (int i = 1; i < 3; ++i) { TString ii = ToString(i); @@ -299,12 +299,12 @@ Y_UNIT_TEST_SUITE(TSchemeTest) { DoCheckAssignment<const char*>("www", "wwa", "wwz", "\"www\"", "const char*"); DoCheckAssignmentArr("xxx", "xxa", "xxz", "\"xxx\"", "const char[]"); DoCheckAssignment<TStringBuf>("yyy", "yya", "yyz", "\"yyy\"", "TStringBuf"); - -#if defined(_MSC_VER) - //TODO -#else + +#if defined(_MSC_VER) + //TODO +#else DoCheckAssignment<TString>("ttt", "tta", "ttz", "\"ttt\"", "TString"); -#endif +#endif NSc::TValue v; v.SetDict(); @@ -351,10 +351,10 @@ Y_UNIT_TEST_SUITE(TSchemeTest) { v.Insert(2, "c"); UNIT_ASSERT_VALUES_EQUAL(v.ToJson(), R"(["a","b","c","d"])"); - v.AppendAll({1, 2, 3}); + v.AppendAll({1, 2, 3}); UNIT_ASSERT_VALUES_EQUAL(v.ToJson(), R"(["a","b","c","d",1,2,3])"); - TVector<int> d{4, 5, 6}; + TVector<int> d{4, 5, 6}; v.AppendAll(d); UNIT_ASSERT_VALUES_EQUAL(v.ToJson(), R"(["a","b","c","d",1,2,3,4,5,6])"); UNIT_ASSERT_VALUES_EQUAL(d.size(), 3u); @@ -365,7 +365,7 @@ Y_UNIT_TEST_SUITE(TSchemeTest) { UNIT_ASSERT_VALUES_EQUAL(v.Clone().Clear().AppendAll(s).ToJson(), R"(["x","y","z"])"); UNIT_ASSERT_VALUES_EQUAL(v.Clone().Clear().AppendAll(TVector<TStringBuf>()).ToJson(), R"([])"); - v.AddAll({{"a", "b"}, {"c", "d"}}); + v.AddAll({{"a", "b"}, {"c", "d"}}); UNIT_ASSERT_VALUES_EQUAL(v.ToJson(), R"({"a":"b","c":"d"})"); } |