Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ReubenJ committed Dec 2, 2024
1 parent 22f13b6 commit bdf0ac0
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/test_rulenode_operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,27 @@ end
@test !isvariable(g₁, RuleNode(7, g₁), SomeDefinitions)
@test isvariable(g₁, RuleNode(7, g₁))
end

@testset "Create `RuleNode`s with `Hole`s for children" begin
g = @csgrammar begin
A = 1 | 2 | 3
B = A + A
end

r = rulenode_with_empty_children(4, g)

@test get_children(r)[1].domain == [1, 1, 1, 0]
@test get_children(r)[2].domain == [1, 1, 1, 0]
end

@testset "Create `UniformHole`s with `Hole`s for children" begin
g = @csgrammar begin
A = 1 | 2 | 3
B = (A + A) | (A - A)
end
h = uniform_hole_with_empty_children(BitVector([0, 0, 0, 1, 1]), g)

@test get_children(h)[1].domain == [1, 1, 1, 0, 0]
@test get_children(h)[2].domain == [1, 1, 1, 0, 0]
end
end

0 comments on commit bdf0ac0

Please sign in to comment.