Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pastilhas committed Oct 12, 2024
1 parent 7126b65 commit 5d6bdf6
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/rbtree_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,25 @@ fn test_insert_6() {
assert bst.is_valid()
}

fn test_delete_1() {
mut bst := RBTree.new(cmp)

bst.insert(55)
bst.insert(56)
bst.insert(40)
bst.insert(30)
bst.insert(20)
bst.insert(25)

assert bst.size == 6
assert bst.is_valid()

bst.delete(56)

assert bst.size == 5
assert bst.is_valid()
}

fn cmp(a int, b int) int {
return if a > b {
1
Expand Down

0 comments on commit 5d6bdf6

Please sign in to comment.