@@ -116,3 +116,31 @@ include(joinpath(@__DIR__, "examples", "binarytree.jl"))
116116    @test  nodevalue .(sbfs) ==  [0 , 1 , 2 , 3 ]
117117end 
118118
119+ include (joinpath (@__DIR__ , " examples" " juliatypes.jl" 
120+ 
121+ @testset  " TypeTree" begin 
122+     t =  TypeTree (JuliaTypesExamples. AbstractSuperType)
123+ 
124+     ls =  collect (Leaves (t))
125+     @test  issetequal (nodevalue .(ls), [JuliaTypesExamples. DirectDescendant, JuliaTypesExamples. Foo, JuliaTypesExamples. Bar])
126+ 
127+     predfs =  nodevalue .(collect (PreOrderDFS (t)))
128+     for  (i,T) in  enumerate (predfs)
129+         @test  ! any (map (x-> T <:  x , predfs[i+ 1 : end ]))
130+     end 
131+ 
132+     postdfs =  nodevalue .(collect (PostOrderDFS (t)))
133+     for  (i,T) in  enumerate (postdfs)
134+         @test  ! any (map (x-> T <:  x , postdfs[1 : i- 1 ]))
135+     end 
136+ 
137+     sbfs =  nodevalue .(collect (StatelessBFS (t)))
138+     for  (i,T) in  enumerate (sbfs)
139+         parents =  collect (supertypes (T)[2 : end ])
140+         for  j in  (i+ 1 ): length (sbfs)
141+             later_parents =  collect (supertypes (sbfs[j])[2 : end ])
142+             @test  (parents ∩  later_parents) ==  parents
143+         end 
144+     end 
145+ end 
146+ 
0 commit comments