Skip to content

Commit 3094dca

Browse files
authored
test: more precise display in correctness tests for seeded operators (#618)
1 parent d9fc042 commit 3094dca

1 file changed

Lines changed: 48 additions & 36 deletions

File tree

DifferentiationInterfaceTest/src/tests/correctness_eval.jl

Lines changed: 48 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -452,10 +452,12 @@ for op in ALL_OPS
452452
@test isempty(preptup_noval) || only(preptup_noval) isa $P
453453
@test y_out1_val scen.y
454454
@test y_out2_val scen.y
455-
@test all(res1_out1_val .≈ scen.res1)
456-
@test all(res1_out2_val .≈ scen.res1)
457-
@test all(res1_out1_noval .≈ scen.res1)
458-
@test all(res1_out2_noval .≈ scen.res1)
455+
for b in eachindex(scen.res1)
456+
res1_out1_val[b] scen.res1[b]
457+
res1_out2_val[b] scen.res1[b]
458+
res1_out1_noval[b] scen.res1[b]
459+
res1_out2_noval[b] scen.res1[b]
460+
end
459461
end
460462
end
461463
scenario_intact && @test new_scen == scen
@@ -509,14 +511,16 @@ for op in ALL_OPS
509511
@test isempty(preptup_noval) || only(preptup_noval) isa $P
510512
@test y_out1_val scen.y
511513
@test y_out2_val scen.y
512-
@test all(res1_in1_val .≈ scen.res1)
513-
@test all(res1_in2_val .≈ scen.res1)
514-
@test all(res1_out1_val .≈ scen.res1)
515-
@test all(res1_out2_val .≈ scen.res1)
516-
@test all(res1_in1_noval .≈ scen.res1)
517-
@test all(res1_in2_noval .≈ scen.res1)
518-
@test all(res1_out1_noval .≈ scen.res1)
519-
@test all(res1_out2_noval .≈ scen.res1)
514+
for b in eachindex(scen.res1)
515+
@test res1_in1_val[b] scen.res1[b]
516+
@test res1_in2_val[b] scen.res1[b]
517+
@test res1_out1_val[b] scen.res1[b]
518+
@test res1_out2_val[b] scen.res1[b]
519+
@test res1_in1_noval[b] scen.res1[b]
520+
@test res1_in2_noval[b] scen.res1[b]
521+
@test res1_out1_noval[b] scen.res1[b]
522+
@test res1_out2_noval[b] scen.res1[b]
523+
end
520524
end
521525
end
522526
scenario_intact && @test new_scen == scen
@@ -573,10 +577,12 @@ for op in ALL_OPS
573577
@test y_in2_val scen.y
574578
@test y_out1_val scen.y
575579
@test y_out2_val scen.y
576-
@test all(res1_out1_val .≈ scen.res1)
577-
@test all(res1_out2_val .≈ scen.res1)
578-
@test all(res1_out1_noval .≈ scen.res1)
579-
@test all(res1_out2_noval .≈ scen.res1)
580+
for b in eachindex(scen.res1)
581+
@test res1_out1_val[b] scen.res1[b]
582+
@test res1_out2_val[b] scen.res1[b]
583+
@test res1_out1_noval[b] scen.res1[b]
584+
@test res1_out2_noval[b] scen.res1[b]
585+
end
580586
end
581587
end
582588
scenario_intact && @test new_scen == scen
@@ -647,14 +653,16 @@ for op in ALL_OPS
647653
@test y_in2_val scen.y
648654
@test y_out1_val scen.y
649655
@test y_out2_val scen.y
650-
@test all(res1_in1_val .≈ scen.res1)
651-
@test all(res1_in2_val .≈ scen.res1)
652-
@test all(res1_out1_val .≈ scen.res1)
653-
@test all(res1_out2_val .≈ scen.res1)
654-
@test all(res1_in1_noval .≈ scen.res1)
655-
@test all(res1_in2_noval .≈ scen.res1)
656-
@test all(res1_out1_noval .≈ scen.res1)
657-
@test all(res1_out2_noval .≈ scen.res1)
656+
for b in eachindex(scen.res1)
657+
@test res1_in1_val[b] scen.res1[b]
658+
@test res1_in2_val[b] scen.res1[b]
659+
@test res1_out1_val[b] scen.res1[b]
660+
@test res1_out2_val[b] scen.res1[b]
661+
@test res1_in1_noval[b] scen.res1[b]
662+
@test res1_in2_noval[b] scen.res1[b]
663+
@test res1_out1_noval[b] scen.res1[b]
664+
@test res1_out2_noval[b] scen.res1[b]
665+
end
658666
end
659667
end
660668
scenario_intact && @test new_scen == scen
@@ -699,12 +707,14 @@ for op in ALL_OPS
699707
)
700708
let ()(x, y) = isapprox(x, y; atol, rtol)
701709
@test isempty(preptup_noval) || only(preptup_noval) isa $P
702-
@test all(res2_out1_noval .≈ scen.res2)
703-
@test all(res2_out2_noval .≈ scen.res2)
704710
@test res1_out1_val scen.res1
705711
@test res1_out2_val scen.res1
706-
@test all(res2_out1_val .≈ scen.res2)
707-
@test all(res2_out2_val .≈ scen.res2)
712+
for b in eachindex(scen.res2)
713+
@test res2_out1_noval[b] scen.res2[b]
714+
@test res2_out2_noval[b] scen.res2[b]
715+
@test res2_out1_val[b] scen.res2[b]
716+
@test res2_out2_val[b] scen.res2[b]
717+
end
708718
end
709719
end
710720
scenario_intact && @test new_scen == scen
@@ -770,18 +780,20 @@ for op in ALL_OPS
770780
)
771781
let ()(x, y) = isapprox(x, y; atol, rtol)
772782
@test isempty(preptup_noval) || only(preptup_noval) isa $P
773-
@test all(res2_in1_noval .≈ scen.res2)
774-
@test all(res2_in2_noval .≈ scen.res2)
775-
@test all(res2_out1_noval .≈ scen.res2)
776-
@test all(res2_out2_noval .≈ scen.res2)
777783
@test res1_in1_val scen.res1
778784
@test res1_in2_val scen.res1
779785
@test res1_out1_val scen.res1
780786
@test res1_out2_val scen.res1
781-
@test all(res2_in1_val .≈ scen.res2)
782-
@test all(res2_in2_val .≈ scen.res2)
783-
@test all(res2_out1_val .≈ scen.res2)
784-
@test all(res2_out2_val .≈ scen.res2)
787+
for b in eachindex(scen.res2)
788+
@test res2_in1_noval[b] scen.res2[b]
789+
@test res2_in2_noval[b] scen.res2[b]
790+
@test res2_out1_noval[b] scen.res2[b]
791+
@test res2_out2_noval[b] scen.res2[b]
792+
@test res2_in1_val[b] scen.res2[b]
793+
@test res2_in2_val[b] scen.res2[b]
794+
@test res2_out1_val[b] scen.res2[b]
795+
@test res2_out2_val[b] scen.res2[b]
796+
end
785797
end
786798
end
787799
scenario_intact && @test new_scen == scen

0 commit comments

Comments
 (0)