-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add general tests testing inputs, clean up utils, rename ARC grammar …
…to follow convention
- Loading branch information
1 parent
28b394c
commit c34a6bb
Showing
5 changed files
with
51 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
input_rules(grammar::AbstractGrammar) = findall(rule -> occursin("_arg_", string(rule)), grammar.rules) | ||
|
||
@testset verbose=true "General tests on all submodules" begin | ||
modules = get_submodules(HerbBenchmarks) | ||
for mod in modules | ||
@testset verbose=true "Module $mod" begin | ||
problems = get_all_problems(mod) | ||
if length(problems) == 0 | ||
continue | ||
end | ||
@testset verbose=true "Inputs are well-typed" begin | ||
@test typeof(problems[1]) <: HerbSpecification.Problem | ||
@test typeof(problems[1].spec[1]) == HerbSpecification.IOExample | ||
end | ||
|
||
if mod ∉ [HerbBenchmarks.String_transformations_2020, | ||
HerbBenchmarks.Pixels_2020, | ||
HerbBenchmarks.Robots_2020] | ||
|
||
@testset verbose=true "Inputs align in grammar and problem" begin | ||
pairs = get_all_problem_grammar_pairs(mod) | ||
for pair in pairs | ||
p,g = pair.problem, pair.grammar | ||
p_args = length(p.spec[1].in) | ||
g_args = length(input_rules(g)) | ||
# test whether | ||
@test p_args == g_args | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|