add test for removal

This commit is contained in:
2024-09-07 16:50:31 +01:00
parent 3c02a47c2e
commit 65070d1b52
2 changed files with 16 additions and 0 deletions

BIN
tests/string-set-tests Executable file

Binary file not shown.

View File

@@ -50,10 +50,26 @@ struct
print "StringSet.getPrefixList passed all tests\n"
end
fun remove1 () =
let
val trie = StringSet.fromList ["a", "ab", "abc"]
val _ = assertTrue (StringSet.exists ("a", trie), "a exists before remove1")
val trie = StringSet.remove ("a", trie)
val _ = assertFalse (StringSet.exists ("a", trie), "a does not exist after remove1")
val _ = assertTrue (StringSet.exists ("ab", trie), "ab still exists after remove1")
val _ = assertTrue (StringSet.exists ("abc", trie), "abc still exists after remove1")
in
print "StringSet.remove: passed remove1\n"
end
fun run () =
let
val _ = testExists ()
val _ = testGetPrefixList ()
val _ = remove1 ()
in
()
end