diff options
author | ionagamed <ionagamed@yandex-team.com> | 2024-04-15 10:18:45 +0300 |
---|---|---|
committer | ionagamed <ionagamed@yandex-team.com> | 2024-04-15 10:28:06 +0300 |
commit | c015541a60f8d93070c53511daaff81db730d194 (patch) | |
tree | 248d7d962c718e75801036109fdef147bc1880ed /library/cpp/yson/node/node_ut.cpp | |
parent | 7930380b354abe9969174901a4e8a730ab1d0906 (diff) | |
download | ydb-c015541a60f8d93070c53511daaff81db730d194.tar.gz |
YT: Add NodeFromYsonStreamNonGreedy; use it in TNode::Load
В рамках
3547980204d51d6eba4c3b56989a916379526673
Diffstat (limited to 'library/cpp/yson/node/node_ut.cpp')
-rw-r--r-- | library/cpp/yson/node/node_ut.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/library/cpp/yson/node/node_ut.cpp b/library/cpp/yson/node/node_ut.cpp index 728a926283..80d231cd09 100644 --- a/library/cpp/yson/node/node_ut.cpp +++ b/library/cpp/yson/node/node_ut.cpp @@ -279,6 +279,37 @@ Y_UNIT_TEST_SUITE(YtNodeTest) { UNIT_ASSERT_VALUES_EQUAL(node, nodeCopy); } + Y_UNIT_TEST(TestSaveLoadWithNeighbours) { + TString stringBefore = "before"; + + TNode node = TNode()("foo", "bar")("baz", 42); + node.Attributes()["attr_name"] = "attr_value"; + + TString stringAfter = "after"; + + TString bytes; + { + TStringOutput s(bytes); + ::Save(&s, stringBefore); + ::Save(&s, node); + ::Save(&s, stringAfter); + } + + TString deserializedStringBefore; + TString deserializedStringAfter; + TNode nodeCopy; + { + TStringInput s(bytes); + ::Load(&s, deserializedStringBefore); + ::Load(&s, nodeCopy); + ::Load(&s, deserializedStringAfter); + } + + UNIT_ASSERT_VALUES_EQUAL(stringBefore, deserializedStringBefore); + UNIT_ASSERT_VALUES_EQUAL(node, nodeCopy); + UNIT_ASSERT_VALUES_EQUAL(stringAfter, deserializedStringAfter); + } + Y_UNIT_TEST(TestIntCast) { TNode node = 1ull << 31; UNIT_ASSERT(node.IsUint64()); |