Skip to content

Commit fde262b

Browse files
committed
Fix tests
1 parent 363841d commit fde262b

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

src/avl_tree.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ function Base.push!(tree::AVLTree{K}, key0) where K
191191
insert!(tree, key)
192192
end
193193

194-
function delete_node!(node::AVLTreeNode{K}, key) where K
194+
function delete_node!(node::AVLTreeNode{K}, key::K) where K
195195
if key < node.data
196196
node.leftChild = delete_node!(node.leftChild, key)
197197
elseif key > node.data

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ tests = ["deprecations",
3434
"dibit_vector",
3535
"swiss_dict",
3636
"avl_tree",
37-
"red_black_tree",
37+
"red_black_tree",
3838
"splay_tree"
3939
]
4040

test/test_avl_tree.jl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
end
2727

2828
@test length(t) == 50
29-
29+
3030
for i in 1:100
3131
if iseven(i)
3232
@test haskey(t, i)
@@ -43,19 +43,19 @@
4343
end
4444

4545
@testset "handling different cases of delete!" begin
46-
t2 = AVLTree()
46+
t2 = AVLTree{Int}()
4747
for i in 1:100000
4848
insert!(t2, i)
4949
end
5050

5151
@test length(t2) == 100000
52-
52+
5353
nums = rand(1:100000, 8599)
5454
visited = Set()
55-
for num in nums
55+
for num in nums
5656
if !(num in visited)
5757
delete!(t2, num)
58-
push!(visited, num)
58+
push!(visited, num)
5959
end
6060
end
6161

@@ -67,7 +67,7 @@
6767

6868
@testset "handling different cases of insert!" begin
6969
nums = rand(1:100000, 1000)
70-
t3 = AVLTree()
70+
t3 = AVLTree{Int}()
7171
uniq_nums = Set(nums)
7272
for num in uniq_nums
7373
insert!(t3, num)
@@ -84,20 +84,20 @@
8484
@test !in('c', t4)
8585
end
8686

87-
@testset "search_node" begin
88-
t5 = AVLTree()
87+
@testset "search_node" begin
88+
t5 = AVLTree{Int}()
8989
for i in 1:32
9090
push!(t5, i)
9191
end
9292
n1 = search_node(t5, 21)
9393
@test n1.data == 21
9494
n2 = search_node(t5, 35)
95-
@test n2.data == 32
95+
@test n2.data == 32
9696
n3 = search_node(t5, 0)
9797
@test n3.data == 1
98-
end
98+
end
9999

100-
@testset "getindex" begin
100+
@testset "getindex" begin
101101
t6 = AVLTree{Int}()
102102
for i in 1:10
103103
push!(t6, i)
@@ -117,7 +117,7 @@
117117
end
118118

119119
@testset "minimum_node" begin
120-
t8 = AVLTree()
120+
t8 = AVLTree{Int}()
121121
@test minimum_node(t8.root) == nothing
122122
for i in 1:32
123123
push!(t8, i)
@@ -132,7 +132,7 @@
132132
end
133133
end
134134

135-
@testset "rank" begin
135+
@testset "rank" begin
136136
t9 = AVLTree{Int}()
137137
for i in 1:20
138138
push!(t9, i)
@@ -142,4 +142,4 @@
142142
end
143143
@test_throws KeyError sorted_rank(t9, 21)
144144
end
145-
end
145+
end

0 commit comments

Comments
 (0)