diff options
author | thegeorg <thegeorg@yandex-team.ru> | 2022-02-10 16:45:08 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:08 +0300 |
commit | 4e839db24a3bbc9f1c610c43d6faaaa99824dcca (patch) | |
tree | 506dac10f5df94fab310584ee51b24fc5a081c22 /library/cpp/yson/node | |
parent | 2d37894b1b037cf24231090eda8589bbb44fb6fc (diff) | |
download | ydb-4e839db24a3bbc9f1c610c43d6faaaa99824dcca.tar.gz |
Restoring authorship annotation for <thegeorg@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/yson/node')
-rw-r--r-- | library/cpp/yson/node/node.cpp | 10 | ||||
-rw-r--r-- | library/cpp/yson/node/node.h | 4 | ||||
-rw-r--r-- | library/cpp/yson/node/node_ut.cpp | 44 |
3 files changed, 29 insertions, 29 deletions
diff --git a/library/cpp/yson/node/node.cpp b/library/cpp/yson/node/node.cpp index b39e070718..06a09dc180 100644 --- a/library/cpp/yson/node/node.cpp +++ b/library/cpp/yson/node/node.cpp @@ -244,11 +244,11 @@ bool TNode::IsUndefined() const return std::holds_alternative<TUndefined>(Value_); } -bool TNode::HasValue() const -{ - return !IsNull() && !IsUndefined(); -} - +bool TNode::HasValue() const +{ + return !IsNull() && !IsUndefined(); +} + bool TNode::Empty() const { switch (GetType()) { diff --git a/library/cpp/yson/node/node.h b/library/cpp/yson/node/node.h index 5f90f95df0..af12166cc2 100644 --- a/library/cpp/yson/node/node.h +++ b/library/cpp/yson/node/node.h @@ -125,8 +125,8 @@ public: bool IsEntity() const; bool IsNull() const; bool IsUndefined() const; - // Returns true if TNode is neither Null, nor Undefined - bool HasValue() const; + // Returns true if TNode is neither Null, nor Undefined + bool HasValue() const; template<typename T> bool IsOfType() const noexcept; diff --git a/library/cpp/yson/node/node_ut.cpp b/library/cpp/yson/node/node_ut.cpp index 448e99f575..1e72d96d8e 100644 --- a/library/cpp/yson/node/node_ut.cpp +++ b/library/cpp/yson/node/node_ut.cpp @@ -50,28 +50,28 @@ Y_UNIT_TEST_SUITE(YtNodeTest) { UNIT_ASSERT(nodeEntity.IsEntity()); } - Y_UNIT_TEST(TestPredicates) { - const TNode undefinedNode; - UNIT_ASSERT(undefinedNode.IsUndefined()); - UNIT_ASSERT(!undefinedNode.IsNull()); - UNIT_ASSERT(!undefinedNode.HasValue()); - - const TNode nullNode = TNode::CreateEntity(); - UNIT_ASSERT(!nullNode.IsUndefined()); - UNIT_ASSERT(nullNode.IsNull()); - UNIT_ASSERT(!nullNode.HasValue()); - - const TNode intNode(int(64)); - UNIT_ASSERT(!intNode.IsUndefined()); - UNIT_ASSERT(!intNode.IsNull()); - UNIT_ASSERT(intNode.HasValue()); - - const TNode stringNode("blah"); - UNIT_ASSERT(!stringNode.IsUndefined()); - UNIT_ASSERT(!stringNode.IsNull()); - UNIT_ASSERT(stringNode.HasValue()); - } - + Y_UNIT_TEST(TestPredicates) { + const TNode undefinedNode; + UNIT_ASSERT(undefinedNode.IsUndefined()); + UNIT_ASSERT(!undefinedNode.IsNull()); + UNIT_ASSERT(!undefinedNode.HasValue()); + + const TNode nullNode = TNode::CreateEntity(); + UNIT_ASSERT(!nullNode.IsUndefined()); + UNIT_ASSERT(nullNode.IsNull()); + UNIT_ASSERT(!nullNode.HasValue()); + + const TNode intNode(int(64)); + UNIT_ASSERT(!intNode.IsUndefined()); + UNIT_ASSERT(!intNode.IsNull()); + UNIT_ASSERT(intNode.HasValue()); + + const TNode stringNode("blah"); + UNIT_ASSERT(!stringNode.IsUndefined()); + UNIT_ASSERT(!stringNode.IsNull()); + UNIT_ASSERT(stringNode.HasValue()); + } + Y_UNIT_TEST(TestComplexConstructors) { const TNode listNode = TNode::CreateList({"one", 2, "tree"}); const auto expectedListValue = std::vector<TNode>({"one", 2, "tree"}); |