diff options
author | avalanche <avalanche@yandex-team.ru> | 2022-02-10 16:50:26 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:26 +0300 |
commit | 4422570d2e28fa161af3bdebef958131ea4c63b4 (patch) | |
tree | 3f153db6b2461927aa8b1a67c932e7b8e1ebaa01 /library | |
parent | c0ac48df42eb5355bb300ca387a61bbd9ce106b5 (diff) | |
download | ydb-4422570d2e28fa161af3bdebef958131ea4c63b4.tar.gz |
Restoring authorship annotation for <avalanche@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library')
-rw-r--r-- | library/cpp/json/writer/json_value.cpp | 6 | ||||
-rw-r--r-- | library/cpp/json/writer/json_value_ut.cpp | 76 |
2 files changed, 41 insertions, 41 deletions
diff --git a/library/cpp/json/writer/json_value.cpp b/library/cpp/json/writer/json_value.cpp index c61e8d1dc4..aefd4baa88 100644 --- a/library/cpp/json/writer/json_value.cpp +++ b/library/cpp/json/writer/json_value.cpp @@ -306,11 +306,11 @@ namespace NJson { case JSON_UINTEGER: case JSON_DOUBLE: break; - } + } Zero(Value); Type = JSON_UNDEFINED; - } - + } + TJsonValue& TJsonValue::operator[](const size_t idx) { SetType(JSON_ARRAY); if (Value.Array->size() <= idx) diff --git a/library/cpp/json/writer/json_value_ut.cpp b/library/cpp/json/writer/json_value_ut.cpp index dc7f6affdf..9fbfbe4433 100644 --- a/library/cpp/json/writer/json_value_ut.cpp +++ b/library/cpp/json/writer/json_value_ut.cpp @@ -340,44 +340,44 @@ Y_UNIT_TEST_SUITE(TJsonValueTest) { } Y_UNIT_TEST(EraseValueFromArray) { - { - TJsonValue vec; - vec.AppendValue(TJsonValue(0)); - vec.AppendValue(TJsonValue(1)); - vec.AppendValue(TJsonValue("2")); - vec.AppendValue(TJsonValue("3.14")); - - TJsonValue vec1; - vec1.AppendValue(TJsonValue(0)); - vec1.AppendValue(TJsonValue("2")); - vec1.AppendValue(TJsonValue("3.14")); - - TJsonValue vec2; - vec2.AppendValue(TJsonValue(0)); - vec2.AppendValue(TJsonValue("2")); - - TJsonValue vec3; - vec3.AppendValue(TJsonValue("2")); - - TJsonValue vec4(JSON_ARRAY); - - UNIT_ASSERT(vec.IsArray()); - UNIT_ASSERT(vec.GetArray().size() == 4); - vec.EraseValue(1); - UNIT_ASSERT(vec.GetArray().size() == 3); - UNIT_ASSERT(vec == vec1); - vec.EraseValue(2); - UNIT_ASSERT(vec.GetArray().size() == 2); - UNIT_ASSERT(vec == vec2); - vec.EraseValue(0); - UNIT_ASSERT(vec.GetArray().size() == 1); - UNIT_ASSERT(vec == vec3); - vec.EraseValue(0); - UNIT_ASSERT(vec.GetArray().size() == 0); - UNIT_ASSERT(vec == vec4); - } - } - + { + TJsonValue vec; + vec.AppendValue(TJsonValue(0)); + vec.AppendValue(TJsonValue(1)); + vec.AppendValue(TJsonValue("2")); + vec.AppendValue(TJsonValue("3.14")); + + TJsonValue vec1; + vec1.AppendValue(TJsonValue(0)); + vec1.AppendValue(TJsonValue("2")); + vec1.AppendValue(TJsonValue("3.14")); + + TJsonValue vec2; + vec2.AppendValue(TJsonValue(0)); + vec2.AppendValue(TJsonValue("2")); + + TJsonValue vec3; + vec3.AppendValue(TJsonValue("2")); + + TJsonValue vec4(JSON_ARRAY); + + UNIT_ASSERT(vec.IsArray()); + UNIT_ASSERT(vec.GetArray().size() == 4); + vec.EraseValue(1); + UNIT_ASSERT(vec.GetArray().size() == 3); + UNIT_ASSERT(vec == vec1); + vec.EraseValue(2); + UNIT_ASSERT(vec.GetArray().size() == 2); + UNIT_ASSERT(vec == vec2); + vec.EraseValue(0); + UNIT_ASSERT(vec.GetArray().size() == 1); + UNIT_ASSERT(vec == vec3); + vec.EraseValue(0); + UNIT_ASSERT(vec.GetArray().size() == 0); + UNIT_ASSERT(vec == vec4); + } + } + Y_UNIT_TEST(NonConstMethodsTest) { { TJsonValue src; |