summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgrigminakov <[email protected]>2025-11-24 14:24:17 +0300
committergrigminakov <[email protected]>2025-11-24 14:43:49 +0300
commit18be7ec182c11ede2cd374f3ee6f863d4bdb476d (patch)
tree160825152dda046bf1995c0ec95923ef7e65518e
parent73d902a7a07c352fc67b1613dbc46c50a958250e (diff)
YTORM-1471: Fix TTrie::IsEmpty
commit_hash:7b54109d824ef3614582e818e4b2b89682cb0078
-rw-r--r--yt/yt/core/ypath/trie.cpp2
-rw-r--r--yt/yt/core/ypath/unittests/trie_ut.cpp2
2 files changed, 3 insertions, 1 deletions
diff --git a/yt/yt/core/ypath/trie.cpp b/yt/yt/core/ypath/trie.cpp
index f479753e1f0..0a6f07e6140 100644
--- a/yt/yt/core/ypath/trie.cpp
+++ b/yt/yt/core/ypath/trie.cpp
@@ -214,7 +214,7 @@ void TTrie::Clear(bool enableFlattening)
bool TTrie::IsEmpty() const
{
- return GetType() != ETrieNodeType::Outlier;
+ return GetType() == ETrieNodeType::Outlier;
}
bool TTrie::IsFlat() const
diff --git a/yt/yt/core/ypath/unittests/trie_ut.cpp b/yt/yt/core/ypath/unittests/trie_ut.cpp
index ad569a1d4aa..672c18f8f53 100644
--- a/yt/yt/core/ypath/unittests/trie_ut.cpp
+++ b/yt/yt/core/ypath/unittests/trie_ut.cpp
@@ -16,12 +16,14 @@ TEST_P(TTrieTest, EmptyTrie)
TTrie trie(/*paths*/ {}, /*enableFlattening*/ GetParam());
EXPECT_EQ(trie.GetType(), ETrieNodeType::Outlier);
EXPECT_EQ(trie.Visit("a").GetType(), ETrieNodeType::Outlier);
+ EXPECT_TRUE(trie.IsEmpty());
}
TEST_P(TTrieTest, EmptyPath)
{
TTrie trie({""}, /*enableFlattening*/ GetParam());
EXPECT_EQ(trie.GetType(), ETrieNodeType::Leaf);
+ EXPECT_FALSE(trie.IsEmpty());
}
TEST_P(TTrieTest, Simple)