Skip to content

Commit c169281

Browse files
committed
Update tests
1 parent ed2d8cb commit c169281

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

test/runtests.jl

+13-12
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,7 @@ const BT = BinaryTrees
2323
@test BT.value(BT.search(tree, 2)) == 20
2424
@test BT.value(BT.search(tree, 1)) == 10
2525
@test BT.value(BT.search(tree, 3)) == 30
26-
27-
# value conversion
28-
tree = AVLTree{Int,Float64}()
29-
BT.insert!(tree, 2, 20)
30-
BT.insert!(tree, 1, 10)
31-
BT.insert!(tree, 3, 30)
32-
@test BT.value(BT.search(tree, 2)) isa Float64
33-
@test BT.value(BT.search(tree, 2)) == 20.0
34-
@test BT.value(BT.search(tree, 1)) isa Float64
35-
@test BT.value(BT.search(tree, 1)) == 10.0
36-
@test BT.value(BT.search(tree, 3)) isa Float64
37-
@test BT.value(BT.search(tree, 3)) == 30.0
26+
@test isnothing(BT.search(tree, 4))
3827

3928
# update values
4029
tree = AVLTree{Int,Int}()
@@ -51,6 +40,18 @@ const BT = BinaryTrees
5140
@test BT.value(BT.search(tree, 1)) == 11
5241
@test BT.value(BT.search(tree, 3)) == 33
5342

43+
# value conversion
44+
tree = AVLTree{Int,Float64}()
45+
BT.insert!(tree, 2, 20)
46+
BT.insert!(tree, 1, 10)
47+
BT.insert!(tree, 3, 30)
48+
@test BT.value(BT.search(tree, 2)) isa Float64
49+
@test BT.value(BT.search(tree, 2)) == 20.0
50+
@test BT.value(BT.search(tree, 1)) isa Float64
51+
@test BT.value(BT.search(tree, 1)) == 10.0
52+
@test BT.value(BT.search(tree, 3)) isa Float64
53+
@test BT.value(BT.search(tree, 3)) == 30.0
54+
5455
# right rotate
5556
tree = AVLTree{Int,Int}()
5657
BT.insert!(tree, 3, 30)

0 commit comments

Comments
 (0)