Skip to content

Commit 2ce4f40

Browse files
committed
added @inferred check for BT.prevnext methods. I chose to set AllowedType to the full type (using their subset rule). Let me know if there's a better alternative
1 parent 8773672 commit 2ce4f40

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/runtests.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,11 @@ const BT = BinaryTrees
242242
@inferred BT.insert!(tree, 3, 30)
243243
@inferred Nothing BT.minnode(tree)
244244
@inferred Nothing BT.maxnode(tree)
245+
@inferred Tuple{Union{BT.AVLNode,Nothing},Union{BT.AVLNode,Nothing}} BT.prevnext(
246+
tree,
247+
2
248+
)
249+
@inferred BT.prevnext(tree, nothing)
245250
@inferred Nothing BT.search(tree, 2)
246251
@inferred Nothing BT.search(tree, 1)
247252
@inferred Nothing BT.search(tree, 3)
@@ -254,6 +259,10 @@ const BT = BinaryTrees
254259
@inferred BT.insert!(tree, 3)
255260
@inferred Nothing BT.minnode(tree)
256261
@inferred Nothing BT.maxnode(tree)
262+
@inferred Tuple{Union{BT.AVLNode,Nothing},Union{BT.AVLNode,Nothing}} BT.prevnext(
263+
tree,
264+
2
265+
)
257266
@inferred Nothing BT.search(tree, 2)
258267
@inferred Nothing BT.search(tree, 1)
259268
@inferred Nothing BT.search(tree, 3)
@@ -266,6 +275,10 @@ const BT = BinaryTrees
266275
@inferred BT.insert!(tree, "key3", 3)
267276
@inferred Nothing BT.minnode(tree)
268277
@inferred Nothing BT.maxnode(tree)
278+
@inferred Tuple{Union{BT.AVLNode,Nothing},Union{BT.AVLNode,Nothing}} BT.prevnext(
279+
tree,
280+
"key2"
281+
)
269282
@inferred Nothing BT.search(tree, "key2")
270283
@inferred Nothing BT.search(tree, "key1")
271284
@inferred Nothing BT.search(tree, "key3")
@@ -278,6 +291,10 @@ const BT = BinaryTrees
278291
@inferred BT.insert!(tree, (1, 0, 0), 3)
279292
@inferred Nothing BT.minnode(tree)
280293
@inferred Nothing BT.maxnode(tree)
294+
@inferred Tuple{Union{BT.AVLNode,Nothing},Union{BT.AVLNode,Nothing}} BT.prevnext(
295+
tree,
296+
(0, 1, 0)
297+
)
281298
@inferred Nothing BT.search(tree, (0, 1, 0))
282299
@inferred Nothing BT.search(tree, (0, 0, 1))
283300
@inferred Nothing BT.search(tree, (1, 0, 0))

0 commit comments

Comments
 (0)