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 | b40cc40ac4588f461fa8dc466985465710d88689 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp | |
parent | 4422570d2e28fa161af3bdebef958131ea4c63b4 (diff) | |
download | ydb-b40cc40ac4588f461fa8dc466985465710d88689.tar.gz |
Restoring authorship annotation for <avalanche@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp')
-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 aefd4baa88..c61e8d1dc4 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 9fbfbe4433..dc7f6affdf 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; |