Skip to content

Commit 300600a

Browse files
authored
Fix complex tests for local solver (#1964)
1 parent 9f7c7fa commit 300600a

File tree

1 file changed

+34
-22
lines changed

1 file changed

+34
-22
lines changed

src/Test/test_linear.jl

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3913,20 +3913,30 @@ function test_linear_complex_Zeros(optimizer, config::Config{T}) where {T}
39133913
MOI.Zeros(1),
39143914
)
39153915
if _supports(config, MOI.optimize!)
3916+
@test MOI.get(optimizer, MOI.TerminationStatus()) ==
3917+
MOI.OPTIMIZE_NOT_CALLED
39163918
MOI.optimize!(optimizer)
3917-
@test MOI.get(optimizer, MOI.TerminationStatus()) == MOI.OPTIMAL
3918-
@test MOI.get(optimizer, MOI.VariablePrimal(), x)
3919-
[T(2) / T(3), T(1) / T(3)] atol = atol rtol = rtol
3920-
@test MOI.get(optimizer, MOI.ConstraintPrimal(), cx)
3921-
[T(2) / T(3), T(1) / T(3)] atol = atol rtol = rtol
3919+
@test MOI.get(optimizer, MOI.TerminationStatus()) ==
3920+
config.optimal_status
3921+
@test (
3922+
MOI.get(optimizer, MOI.VariablePrimal(), x),
3923+
[T(2) / T(3), T(1) / T(3)],
3924+
config,
3925+
)
3926+
@test (
3927+
MOI.get(optimizer, MOI.ConstraintPrimal(), cx),
3928+
[T(2) / T(3), T(1) / T(3)],
3929+
config,
3930+
)
39223931
z = [zero(Complex{T})]
3923-
@test MOI.get(optimizer, MOI.ConstraintPrimal(), c) z atol = atol rtol =
3924-
rtol
3932+
@test (MOI.get(optimizer, MOI.ConstraintPrimal(), c), z, config)
39253933
if _supports(config, MOI.ConstraintDual)
3926-
@test MOI.get(optimizer, MOI.ConstraintDual(), cx) zeros(T, 2) atol =
3927-
atol rtol = rtol
3928-
@test MOI.get(optimizer, MOI.ConstraintDual(), c) z atol = atol rtol =
3929-
rtol
3934+
@test (
3935+
MOI.get(optimizer, MOI.ConstraintDual(), cx),
3936+
zeros(T, 2),
3937+
config,
3938+
)
3939+
@test (MOI.get(optimizer, MOI.ConstraintDual(), c), z, config)
39303940
end
39313941
end
39323942
return
@@ -3971,20 +3981,22 @@ function test_linear_complex_Zeros_duplicate(
39713981
MOI.Zeros(1),
39723982
)
39733983
if _supports(config, MOI.optimize!)
3984+
@test MOI.get(optimizer, MOI.TerminationStatus()) ==
3985+
MOI.OPTIMIZE_NOT_CALLED
39743986
MOI.optimize!(optimizer)
3975-
@test MOI.get(optimizer, MOI.TerminationStatus()) == MOI.OPTIMAL
3976-
@test MOI.get(optimizer, MOI.VariablePrimal(), x) T[2] atol = atol rtol =
3977-
rtol
3978-
@test MOI.get(optimizer, MOI.ConstraintPrimal(), cx) T[2] atol = atol rtol =
3979-
rtol
3987+
@test MOI.get(optimizer, MOI.TerminationStatus()) ==
3988+
config.optimal_status
3989+
@test (MOI.get(optimizer, MOI.VariablePrimal(), x), T[2], config)
3990+
@test (MOI.get(optimizer, MOI.ConstraintPrimal(), cx), T[2], config)
39803991
z = [zero(Complex{T})]
3981-
@test MOI.get(optimizer, MOI.ConstraintPrimal(), c) z atol = atol rtol =
3982-
rtol
3992+
@test (MOI.get(optimizer, MOI.ConstraintPrimal(), c), z, config)
39833993
if _supports(config, MOI.ConstraintDual)
3984-
@test MOI.get(optimizer, MOI.ConstraintDual(), cx) zeros(T, 1) atol =
3985-
atol rtol = rtol
3986-
@test MOI.get(optimizer, MOI.ConstraintDual(), c) z atol = atol rtol =
3987-
rtol
3994+
@test (
3995+
MOI.get(optimizer, MOI.ConstraintDual(), cx),
3996+
zeros(T, 1),
3997+
config,
3998+
)
3999+
@test (MOI.get(optimizer, MOI.ConstraintDual(), c), z, config)
39884000
end
39894001
end
39904002
return

0 commit comments

Comments
 (0)