Skip to content

Commit a0af2ef

Browse files
committed
handle cases related to insert
1 parent d1f7df7 commit a0af2ef

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

test/test_red_black_tree.jl

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@ include("../src/red_black_tree.jl")
3333
@test search_key(t, i)
3434
end
3535

36+
# for handling cases related to delete!
3637
t2 = RBTree()
37-
for i = 1:10000
38+
for i = 1:100000
3839
insert!(t2, i)
3940
end
4041

41-
nums = rand(1:10000, 100)
42-
visited = Set{Int}()
42+
nums = rand(1:100000, 1000)
43+
visited = Set()
4344
for num in nums
4445
if num in visited
4546
@test_throws KeyError delete!(t2, num)
@@ -49,12 +50,22 @@ include("../src/red_black_tree.jl")
4950
end
5051
end
5152

52-
for i = 1:10000
53+
for i = 1:100000
5354
if i in visited
5455
@test !search_key(t2, i)
5556
else
5657
@test search_key(t2, i)
5758
end
5859
end
5960

61+
# for handling cases related to insert!
62+
t3 = RBTree()
63+
for num in nums
64+
insert!(t3, num)
65+
end
66+
67+
for i in visited
68+
@test search_key(t3, i)
69+
end
70+
6071
end

0 commit comments

Comments
 (0)