Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for rulesoftype #28

Merged
merged 5 commits into from
Oct 29, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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 rulesoftype(rulenode, Set((11, 12))) == Set{Int}()
arg = Set((1, 3, 7, 9, 10, 15, 23))
expected = Set((1, 3, 7, 9, 10))
@test rulesoftype(rulenode, arg) == expected
mhauru marked this conversation as resolved.
Show resolved Hide resolved
@test rulesoftype(rulenode, Set(1)) == Set(1)
@test rulesoftype(rulenode, Set{Int}()) == Set{Int}()
mhauru marked this conversation as resolved.
Show resolved Hide resolved
@test rulesoftype(RuleNode(1), Set((1, 2))) == Set(1)
end

@testset "rule sequence" begin

#= 1
Expand Down
Loading