Skip to content

Commit

Permalink
test: more precise display in correctness tests for seeded operators (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
gdalle authored Nov 7, 2024
1 parent d9fc042 commit 3094dca
Showing 1 changed file with 48 additions and 36 deletions.
84 changes: 48 additions & 36 deletions DifferentiationInterfaceTest/src/tests/correctness_eval.jl
Original file line number Diff line number Diff line change
Expand Up @@ -452,10 +452,12 @@ for op in ALL_OPS
@test isempty(preptup_noval) || only(preptup_noval) isa $P
@test y_out1_val scen.y
@test y_out2_val scen.y
@test all(res1_out1_val .≈ scen.res1)
@test all(res1_out2_val .≈ scen.res1)
@test all(res1_out1_noval .≈ scen.res1)
@test all(res1_out2_noval .≈ scen.res1)
for b in eachindex(scen.res1)
res1_out1_val[b] scen.res1[b]
res1_out2_val[b] scen.res1[b]
res1_out1_noval[b] scen.res1[b]
res1_out2_noval[b] scen.res1[b]
end
end
end
scenario_intact && @test new_scen == scen
Expand Down Expand Up @@ -509,14 +511,16 @@ for op in ALL_OPS
@test isempty(preptup_noval) || only(preptup_noval) isa $P
@test y_out1_val scen.y
@test y_out2_val scen.y
@test all(res1_in1_val .≈ scen.res1)
@test all(res1_in2_val .≈ scen.res1)
@test all(res1_out1_val .≈ scen.res1)
@test all(res1_out2_val .≈ scen.res1)
@test all(res1_in1_noval .≈ scen.res1)
@test all(res1_in2_noval .≈ scen.res1)
@test all(res1_out1_noval .≈ scen.res1)
@test all(res1_out2_noval .≈ scen.res1)
for b in eachindex(scen.res1)
@test res1_in1_val[b] scen.res1[b]
@test res1_in2_val[b] scen.res1[b]
@test res1_out1_val[b] scen.res1[b]
@test res1_out2_val[b] scen.res1[b]
@test res1_in1_noval[b] scen.res1[b]
@test res1_in2_noval[b] scen.res1[b]
@test res1_out1_noval[b] scen.res1[b]
@test res1_out2_noval[b] scen.res1[b]
end
end
end
scenario_intact && @test new_scen == scen
Expand Down Expand Up @@ -573,10 +577,12 @@ for op in ALL_OPS
@test y_in2_val scen.y
@test y_out1_val scen.y
@test y_out2_val scen.y
@test all(res1_out1_val .≈ scen.res1)
@test all(res1_out2_val .≈ scen.res1)
@test all(res1_out1_noval .≈ scen.res1)
@test all(res1_out2_noval .≈ scen.res1)
for b in eachindex(scen.res1)
@test res1_out1_val[b] scen.res1[b]
@test res1_out2_val[b] scen.res1[b]
@test res1_out1_noval[b] scen.res1[b]
@test res1_out2_noval[b] scen.res1[b]
end
end
end
scenario_intact && @test new_scen == scen
Expand Down Expand Up @@ -647,14 +653,16 @@ for op in ALL_OPS
@test y_in2_val scen.y
@test y_out1_val scen.y
@test y_out2_val scen.y
@test all(res1_in1_val .≈ scen.res1)
@test all(res1_in2_val .≈ scen.res1)
@test all(res1_out1_val .≈ scen.res1)
@test all(res1_out2_val .≈ scen.res1)
@test all(res1_in1_noval .≈ scen.res1)
@test all(res1_in2_noval .≈ scen.res1)
@test all(res1_out1_noval .≈ scen.res1)
@test all(res1_out2_noval .≈ scen.res1)
for b in eachindex(scen.res1)
@test res1_in1_val[b] scen.res1[b]
@test res1_in2_val[b] scen.res1[b]
@test res1_out1_val[b] scen.res1[b]
@test res1_out2_val[b] scen.res1[b]
@test res1_in1_noval[b] scen.res1[b]
@test res1_in2_noval[b] scen.res1[b]
@test res1_out1_noval[b] scen.res1[b]
@test res1_out2_noval[b] scen.res1[b]
end
end
end
scenario_intact && @test new_scen == scen
Expand Down Expand Up @@ -699,12 +707,14 @@ for op in ALL_OPS
)
let ()(x, y) = isapprox(x, y; atol, rtol)
@test isempty(preptup_noval) || only(preptup_noval) isa $P
@test all(res2_out1_noval .≈ scen.res2)
@test all(res2_out2_noval .≈ scen.res2)
@test res1_out1_val scen.res1
@test res1_out2_val scen.res1
@test all(res2_out1_val .≈ scen.res2)
@test all(res2_out2_val .≈ scen.res2)
for b in eachindex(scen.res2)
@test res2_out1_noval[b] scen.res2[b]
@test res2_out2_noval[b] scen.res2[b]
@test res2_out1_val[b] scen.res2[b]
@test res2_out2_val[b] scen.res2[b]
end
end
end
scenario_intact && @test new_scen == scen
Expand Down Expand Up @@ -770,18 +780,20 @@ for op in ALL_OPS
)
let ()(x, y) = isapprox(x, y; atol, rtol)
@test isempty(preptup_noval) || only(preptup_noval) isa $P
@test all(res2_in1_noval .≈ scen.res2)
@test all(res2_in2_noval .≈ scen.res2)
@test all(res2_out1_noval .≈ scen.res2)
@test all(res2_out2_noval .≈ scen.res2)
@test res1_in1_val scen.res1
@test res1_in2_val scen.res1
@test res1_out1_val scen.res1
@test res1_out2_val scen.res1
@test all(res2_in1_val .≈ scen.res2)
@test all(res2_in2_val .≈ scen.res2)
@test all(res2_out1_val .≈ scen.res2)
@test all(res2_out2_val .≈ scen.res2)
for b in eachindex(scen.res2)
@test res2_in1_noval[b] scen.res2[b]
@test res2_in2_noval[b] scen.res2[b]
@test res2_out1_noval[b] scen.res2[b]
@test res2_out2_noval[b] scen.res2[b]
@test res2_in1_val[b] scen.res2[b]
@test res2_in2_val[b] scen.res2[b]
@test res2_out1_val[b] scen.res2[b]
@test res2_out2_val[b] scen.res2[b]
end
end
end
scenario_intact && @test new_scen == scen
Expand Down

0 comments on commit 3094dca

Please sign in to comment.