Skip to content

Commit

Permalink
Add test case for deletion of non-member in Trie (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
vorce committed Mar 19, 2022
1 parent 136b76e commit 96bc4dd
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test/trie_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,13 @@ defmodule TrieTest do

assert List.first(updated_trie.children).count == 1
end

test "ignores non-member" do
trie = Trie.insert(Trie.new(), "hello")

assert Trie.delete(trie, "non-member") == trie
assert Trie.delete(trie, []) == trie
end
end

describe "child/2" do
Expand Down Expand Up @@ -217,7 +224,9 @@ defmodule TrieTest do
describe "insert_all/2" do
test "equivalent to many insert" do
trie = Trie.new()
assert trie |> Trie.insert("hi") |> Trie.insert("hey") == trie |> Trie.insert_all(["hi", "hey"])

assert trie |> Trie.insert("hi") |> Trie.insert("hey") ==
trie |> Trie.insert_all(["hi", "hey"])
end
end

Expand Down

0 comments on commit 96bc4dd

Please sign in to comment.