diff --git a/test/runtests.jl b/test/runtests.jl index fd344cb..b2c9335 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -65,6 +65,36 @@ using Test @test node_depth(rulenode, RuleNode(100)) == 0 end + @testset "rulesoftype" begin + #= 1 + 2 3 4 + 5 6 + 7 9 + 10 + =# + rulenode = RuleNode( + 1, + [ + RuleNode(2), + RuleNode(3), + RuleNode( + 4, + [ + RuleNode(5, [RuleNode(7)]), + RuleNode(6, [RuleNode(9, [RuleNode(10)])]) + ] + ) + ] + ) + @test isempty(rulesoftype(rulenode, Set((11, 12)))) + ruleset = Set((1, 3, 7, 9, 10, 15, 23)) + expected = Set((1, 3, 7, 9, 10)) + @test rulesoftype(rulenode, ruleset) == expected + @test rulesoftype(rulenode, Set(1)) == Set(1) + @test isempty(rulesoftype(rulenode, Set{Int}())) + @test rulesoftype(RuleNode(1), Set((1, 2))) == Set(1) + end + @testset "rule sequence" begin #= 1