Skip to content

Commit

Permalink
test: Last value inserted should be value present.
Browse files Browse the repository at this point in the history
Change test and expected behavior to suit simpler implementation and
respect principle of least surprise.
  • Loading branch information
shanecelis committed May 12, 2024
1 parent 21504e8 commit b2f8c49
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,13 @@ builder.push("すしだね", 2);
builder.push("すしづめ", 3);
builder.push("すしめし", 4);
builder.push("すしをにぎる", 5);
builder.push("すし", 6); // Word `push`ed twice is just ignored.
builder.push("すし", 6); // Word `push`ed twice uses last value.
builder.push("🍣", 7);

let mut trie = builder.build();

// exact_match(): Find a word exactly match to query.
assert_eq!(trie.exact_match("すし"), Some(&0));
assert_eq!(trie.exact_match("すし"), Some(&6));
assert_eq!(trie.exact_match("🍣"), Some(&7));
assert_eq!(trie.exact_match("🍜"), None);

Expand Down

0 comments on commit b2f8c49

Please sign in to comment.