From a7ef6986f825f32ae848317e3c4728d6cb078254 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Thu, 5 Oct 2023 19:59:38 +0200 Subject: [PATCH] Mark tests broken on v1.6 as broken on v1.6 --- test/ADtests.jl | 66 +++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/test/ADtests.jl b/test/ADtests.jl index 0ebcbbbb1..c948ebf36 100644 --- a/test/ADtests.jl +++ b/test/ADtests.jl @@ -67,42 +67,44 @@ optprob.cons_h(H3, x0) G2 = Array{Float64}(undef, 2) H2 = Array{Float64}(undef, 2, 2) -optf = OptimizationFunction(rosenbrock, Optimization.AutoEnzyme(), cons = cons) -optprob = Optimization.instantiate_function(optf, x0, Optimization.AutoEnzyme(), - nothing, 1) -optprob.grad(G2, x0) -@test G1 == G2 -optprob.hess(H2, x0) -@test H1 == H2 -res = Array{Float64}(undef, 1) -optprob.cons(res, x0) -@test res == [0.0] -J = Array{Float64}(undef, 2) -optprob.cons_j(J, [5.0, 3.0]) -@test J == [10.0, 6.0] -H3 = [Array{Float64}(undef, 2, 2)] -optprob.cons_h(H3, x0) -@test H3 == [[2.0 0.0; 0.0 2.0]] +if VERSION >= v"1.9" + optf = OptimizationFunction(rosenbrock, Optimization.AutoEnzyme(), cons = cons) + optprob = Optimization.instantiate_function(optf, x0, Optimization.AutoEnzyme(), + nothing, 1) + optprob.grad(G2, x0) + @test G1 == G2 + optprob.hess(H2, x0) + @test H1 == H2 + res = Array{Float64}(undef, 1) + optprob.cons(res, x0) + @test res == [0.0] + J = Array{Float64}(undef, 2) + optprob.cons_j(J, [5.0, 3.0]) + @test J == [10.0, 6.0] + H3 = [Array{Float64}(undef, 2, 2)] + optprob.cons_h(H3, x0) + @test H3 == [[2.0 0.0; 0.0 2.0]] G2 = Array{Float64}(undef, 2) H2 = Array{Float64}(undef, 2, 2) -optf = OptimizationFunction(rosenbrock, Optimization.AutoEnzyme(), cons = con2_c) -optprob = Optimization.instantiate_function(optf, x0, Optimization.AutoEnzyme(), - nothing, 2) -optprob.grad(G2, x0) -@test G1 == G2 -optprob.hess(H2, x0) -@test H1 == H2 -res = Array{Float64}(undef, 2) -optprob.cons(res, x0) -@test res == [0.0, 0.0] -J = Array{Float64}(undef, 2, 2) -optprob.cons_j(J, [5.0, 3.0]) -@test all(isapprox(J, [10.0 6.0; -0.149013 -0.958924]; rtol = 1e-3)) -H3 = [Array{Float64}(undef, 2, 2), Array{Float64}(undef, 2, 2)] -optprob.cons_h(H3, x0) -H3 == [[2.0 0.0; 0.0 2.0], [-0.0 1.0; 1.0 0.0]] + optf = OptimizationFunction(rosenbrock, Optimization.AutoEnzyme(), cons = con2_c) + optprob = Optimization.instantiate_function(optf, x0, Optimization.AutoEnzyme(), + nothing, 2) + optprob.grad(G2, x0) + @test G1 == G2 + optprob.hess(H2, x0) + @test H1 == H2 + res = Array{Float64}(undef, 2) + optprob.cons(res, x0) + @test res == [0.0, 0.0] + J = Array{Float64}(undef, 2, 2) + optprob.cons_j(J, [5.0, 3.0]) + @test all(isapprox(J, [10.0 6.0; -0.149013 -0.958924]; rtol = 1e-3)) + H3 = [Array{Float64}(undef, 2, 2), Array{Float64}(undef, 2, 2)] + optprob.cons_h(H3, x0) + @test H3 == [[2.0 0.0; 0.0 2.0], [-0.0 1.0; 1.0 0.0]] +end G2 = Array{Float64}(undef, 2) H2 = Array{Float64}(undef, 2, 2)