From b2f8c499e8c893479baacab30992757d61180f5d Mon Sep 17 00:00:00 2001 From: Shane Celis Date: Sun, 12 May 2024 15:35:12 -0400 Subject: [PATCH] test: Last value inserted should be value present. Change test and expected behavior to suit simpler implementation and respect principle of least surprise. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 09b7aaf..08d9e80 100644 --- a/README.md +++ b/README.md @@ -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);