Skip to content

Commit

Permalink
Remove mutable from some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mahdihasnat committed Nov 23, 2024
1 parent aed057b commit 459a294
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions Algorithms.Tests/DataStructures/Trie.fs
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,20 @@ type TrieTests () =

[<TestMethod>]
member this.``Test insert empty key``() =
let mutable trie = empty
let trie =
empty
|> insert ""

trie <- insert "" trie
Assert.IsTrue(search "" trie)
Assert.IsFalse(search "foo" trie)

[<TestMethod>]
member this.``Test overlapping keys``() =
let mutable trie = empty

trie <- insert "car" trie
trie <- insert "cart" trie
trie <- insert "carter" trie
let trie =
empty
|> insert "car"
|> insert "cart"
|> insert "carter"

Assert.IsTrue(search "car" trie)
Assert.IsTrue(search "cart" trie)
Expand All @@ -51,9 +52,10 @@ type TrieTests () =

[<TestMethod>]
member this.``Test partial match``() =
let mutable trie = empty
let trie =
empty
|> insert "apple"

trie <- insert "apple" trie
Assert.IsFalse(search "app" trie)
Assert.IsFalse(search "appl" trie)
Assert.IsTrue(search "apple" trie)
Expand Down

0 comments on commit 459a294

Please sign in to comment.