Skip to content
Permalink
Browse files

StrTrie - fix Add bug

  • Loading branch information...
bobbymcr committed Apr 5, 2019
1 parent b5e30c6 commit e20cf967877e674218d6f33e18339c396b1a5daa
Showing with 3 additions and 1 deletion.
  1. +1 −1 src/Words.Core/StrTrie.cs
  2. +2 −0 test/Words.Test/StrTrieTest.cs
@@ -90,7 +90,7 @@ public void Add(Str value)

++this.Count;
this.nodes[value] = true;
for (byte i = 1; i < value.Length; ++i)
while (value.Length > 1)
{
value = value.Chop();
if (!this.nodes.ContainsKey(value))
@@ -54,6 +54,8 @@ public void ThreeItemsLength3NoSharedPrefix()
trie.Add(Str.Parse("GHI"));

trie.Count.Should().Be(3);
trie.Find(Str.Parse("A")).Should().Be(StrTrie.NodeKind.Prefix);
trie.Find(Str.Parse("AB")).Should().Be(StrTrie.NodeKind.Prefix);
trie.Find(Str.Parse("ABC")).Should().Be(StrTrie.NodeKind.Terminal);
trie.Find(Str.Parse("DEF")).Should().Be(StrTrie.NodeKind.Terminal);
trie.Find(Str.Parse("GHI")).Should().Be(StrTrie.NodeKind.Terminal);

0 comments on commit e20cf96

Please sign in to comment.
You can’t perform that action at this time.