Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ReubenJ committed Nov 15, 2024
1 parent 18a03d3 commit 947278c
Showing 1 changed file with 34 additions and 3 deletions.
37 changes: 34 additions & 3 deletions test/test_ioproblem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,37 @@

@test io_example.in == input_dict
@test io_example.out == output_value
@testset "Test Equality" begin
e₁ = IOExample(Dict(:x => 1), 1)
e₂ = IOExample(Dict(:x => 1), 1)
@test e₁ == e₂
end
end

@testset "Trace Tests" begin
t₁ = Trace([:x => 1, :x => 2, :x => 3])
t₂ = Trace([:x => 1, :x => 2, :x => 3])
@test t₁ == t₂
end

@testset "SMTSpecification Tests" begin
example_formula = identity
smt₁ = SMTSpecification(example_formula)
smt₂ = SMTSpecification(example_formula)
@test smt₁ == smt₂
end

@testset "AgdaSpecification Tests" begin
example_formula = identity
agda₁ = AgdaSpecification(example_formula)
agda₂ = AgdaSpecification(example_formula)
@test agda₁ == agda₂
end

# Tests for Problem
@testset "Problem Tests" begin
# Example specs to use in the below tests.
specs = [
[
[
IOExample(Dict(:var1 => 1, :var2 => 2), 3),
IOExample(Dict(:var1 => 4, :var2 => 5), 6),
IOExample(Dict(:var1 => 7, :var2 => 8), 9),
Expand Down Expand Up @@ -93,5 +117,12 @@ end
@test isa(submetric2, MetricProblem)
@test submetric2.spec == spec[2:3]
@test submetric2.name == name
@test submetric2.cost_function === cost_function
@test submetric2.cost_function === cost_function

@testset "Test Equality" begin
cost_function = () -> 1
mp₁ = MetricProblem(cost_function , [IOExample(Dict(:x => 1), 1)])
mp₂ = MetricProblem(cost_function , [IOExample(Dict(:x => 1), 1)])
@test mp₁ == mp₂
end
end

0 comments on commit 947278c

Please sign in to comment.