11using AbstractTrees
22using Test
33
4- include (joinpath (@__DIR__ ," examples" ," idtree.jl" ))
4+ include (joinpath (@__DIR__ , " examples" , " idtree.jl" ))
55
66@testset " IDTree" begin
77 tree = IDTree (1 => [
@@ -25,9 +25,9 @@ include(joinpath(@__DIR__,"examples","idtree.jl"))
2525
2626 # Node/subtree properties
2727 # 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
28- @test treesize .(nodes) == [16 , 4 , 1 , 2 , 1 , 1 , 9 , 8 , 1 , 1 , 4 , 1 , 1 , 1 , 1 , 1 ]
28+ @test treesize .(nodes) == [16 , 4 , 1 , 2 , 1 , 1 , 9 , 8 , 1 , 1 , 4 , 1 , 1 , 1 , 1 , 1 ]
2929 @test treebreadth .(nodes) == [10 , 2 , 1 , 1 , 1 , 1 , 6 , 6 , 1 , 1 , 3 , 1 , 1 , 1 , 1 , 1 ]
30- @test treeheight .(nodes) == [ 4 , 2 , 0 , 1 , 0 , 0 , 3 , 2 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 ]
30+ @test treeheight .(nodes) == [4 , 2 , 0 , 1 , 0 , 0 , 3 , 2 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 ]
3131
3232 # Child/descendant checking
3333 @test ischild (nodes[2 ], nodes[1 ])
@@ -61,44 +61,44 @@ include(joinpath(@__DIR__,"examples","idtree.jl"))
6161 @test [n. id for n in Leaves (tree. root)] == [3 , 5 , 6 , 9 , 10 , 12 , 13 , 14 , 15 , 16 ]
6262end
6363
64- include (joinpath (@__DIR__ ," examples" ," onenode.jl" ))
64+ include (joinpath (@__DIR__ , " examples" , " onenode.jl" ))
6565
6666@testset " OneNode" begin
67- ot = OneNode ([2 ,3 , 4 , 0 ], 1 )
67+ ot = OneNode ([2 , 3 , 4 , 0 ], 1 )
6868 @inferred collect (Leaves (ot))
6969 @test nodevalue .(collect (Leaves (ot))) == [0 ]
7070 @test eltype (nodevalue .(collect (Leaves (ot)))) ≡ Int
71- @test nodevalue .(collect (PreOrderDFS (ot))) == [2 ,3 , 4 , 0 ]
72- @test nodevalue .(collect (PostOrderDFS (ot))) == [0 ,4 , 3 , 2 ]
71+ @test nodevalue .(collect (PreOrderDFS (ot))) == [2 , 3 , 4 , 0 ]
72+ @test nodevalue .(collect (PostOrderDFS (ot))) == [0 , 4 , 3 , 2 ]
7373end
7474
75- include (joinpath (@__DIR__ ," examples" ," onetree.jl" ))
75+ include (joinpath (@__DIR__ , " examples" , " onetree.jl" ))
7676
7777@testset " OneTree" begin
78- ot = OneTree ([2 ,3 , 4 , 0 ])
78+ ot = OneTree ([2 , 3 , 4 , 0 ])
7979 n = IndexNode (ot)
8080
8181 @inferred collect (Leaves (n))
8282 @test nodevalue .(collect (Leaves (n))) == [0 ]
8383 @test eltype (nodevalue .(collect (Leaves (n)))) ≡ Int
84- @test nodevalue .(collect (PreOrderDFS (n))) == [2 ,3 , 4 , 0 ]
85- @test nodevalue .(collect (PostOrderDFS (n))) == [0 ,4 , 3 , 2 ]
84+ @test nodevalue .(collect (PreOrderDFS (n))) == [2 , 3 , 4 , 0 ]
85+ @test nodevalue .(collect (PostOrderDFS (n))) == [0 , 4 , 3 , 2 ]
8686end
8787
88- include (joinpath (@__DIR__ ," examples" ," fstree.jl" ))
88+ include (joinpath (@__DIR__ , " examples" , " fstree.jl" ))
8989
9090@testset " FSNode" begin
9191 Base. VERSION >= v " 1.6" && mk_tree_test_dir () do path
9292 tree = Directory (" ." )
9393
94- ls = nodevalue .(( collect ∘ Leaves) (tree))
94+ ls = nodevalue .(collect ( Leaves (tree) ))
9595 # use set so we don't have to guarantee ordering
96- @test Set (ls) == Set ([joinpath (" ." ," A" ," f2" ), joinpath (" ." ," B" ), joinpath (" ." ," f1" )])
96+ @test Set (ls) == Set ([joinpath (" ." , " A" , " f2" ), joinpath (" ." , " B" ), joinpath (" ." , " f1" )])
9797 @test treeheight (tree) == 2
9898 end
9999end
100100
101- include (joinpath (@__DIR__ ," examples" ," binarytree.jl" ))
101+ include (joinpath (@__DIR__ , " examples" , " binarytree.jl" ))
102102
103103@testset " BinaryNode" begin
104104 t = binarynode_example ()
@@ -107,12 +107,12 @@ include(joinpath(@__DIR__,"examples","binarytree.jl"))
107107 @test nodevalue .(ls) == [3 , 2 ]
108108
109109 predfs = @inferred collect (PreOrderDFS (t))
110- @test nodevalue .(predfs) == [0 ,1 , 3 , 2 ]
110+ @test nodevalue .(predfs) == [0 , 1 , 3 , 2 ]
111111
112112 postdfs = @inferred collect (PostOrderDFS (t))
113- @test nodevalue .(postdfs) == [3 ,1 , 2 , 0 ]
113+ @test nodevalue .(postdfs) == [3 , 1 , 2 , 0 ]
114114
115115 sbfs = @inferred collect (StatelessBFS (t))
116- @test nodevalue .(sbfs) == [0 ,1 , 2 , 3 ]
116+ @test nodevalue .(sbfs) == [0 , 1 , 2 , 3 ]
117117end
118118
0 commit comments