From e64c09f376b96f88c10aed517f0bde601f8f903d Mon Sep 17 00:00:00 2001 From: odow Date: Fri, 2 Jul 2021 16:54:50 +1200 Subject: [PATCH] [Test] change MOI.OPTIMAL to config.optimal_status --- src/Test/Test.jl | 2 +- src/Test/test_linear.jl | 8 ++++---- src/Test/test_objective.jl | 2 +- src/Test/test_solve.jl | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Test/Test.jl b/src/Test/Test.jl index 433aaf732a..81da55dc66 100644 --- a/src/Test/Test.jl +++ b/src/Test/Test.jl @@ -294,7 +294,7 @@ _supports(config::Config, T::Any)::Bool = !(T in config.exclude) Solve, and then test, various aspects of a model. -First, check that `TerminationStatus == MOI.OPTIMAL`. +First, check that `TerminationStatus == config.optimal_status`. If `objective_value` is not nothing, check that the attribute `ObjectiveValue()` is approximately `objective_value`. diff --git a/src/Test/test_linear.jl b/src/Test/test_linear.jl index c69fb45d1c..604ee3ab5f 100644 --- a/src/Test/test_linear.jl +++ b/src/Test/test_linear.jl @@ -3554,7 +3554,7 @@ function test_linear_Indicator_integration(model::MOI.ModelLike, config::Config) if _supports(config, MOI.optimize!) @test MOI.get(model, MOI.TerminationStatus()) == MOI.OPTIMIZE_NOT_CALLED MOI.optimize!(model) - @test MOI.get(model, MOI.TerminationStatus()) == MOI.OPTIMAL + @test MOI.get(model, MOI.TerminationStatus()) == config.optimal_status @test MOI.get(model, MOI.PrimalStatus()) == MOI.FEASIBLE_POINT @test isapprox(MOI.get(model, MOI.ObjectiveValue()), 28.75, config) @test isapprox(MOI.get(model, MOI.VariablePrimal(), x1), 1.25, config) @@ -3647,7 +3647,7 @@ function test_linear_Indicator_ON_ONE(model::MOI.ModelLike, config::Config) if _supports(config, MOI.optimize!) @test MOI.get(model, MOI.TerminationStatus()) == MOI.OPTIMIZE_NOT_CALLED MOI.optimize!(model) - @test MOI.get(model, MOI.TerminationStatus()) == MOI.OPTIMAL + @test MOI.get(model, MOI.TerminationStatus()) == config.optimal_status @test MOI.get(model, MOI.PrimalStatus()) == MOI.FEASIBLE_POINT @test isapprox(MOI.get(model, MOI.ObjectiveValue()), 28.0, config) @test isapprox(MOI.get(model, MOI.VariablePrimal(), x1), 2.0, config) @@ -3762,7 +3762,7 @@ function test_linear_Indicator_ON_ZERO(model::MOI.ModelLike, config::Config) if _supports(config, MOI.optimize!) @test MOI.get(model, MOI.TerminationStatus()) == MOI.OPTIMIZE_NOT_CALLED MOI.optimize!(model) - @test MOI.get(model, MOI.TerminationStatus()) == MOI.OPTIMAL + @test MOI.get(model, MOI.TerminationStatus()) == config.optimal_status @test MOI.get(model, MOI.PrimalStatus()) == MOI.FEASIBLE_POINT @test isapprox(MOI.get(model, MOI.ObjectiveValue()), 28.75, config) @test isapprox(MOI.get(model, MOI.VariablePrimal(), x1), 1.25, config) @@ -3879,7 +3879,7 @@ function test_linear_Indicator_constant_term( if _supports(config, MOI.optimize!) @test MOI.get(model, MOI.TerminationStatus()) == MOI.OPTIMIZE_NOT_CALLED MOI.optimize!(model) - @test MOI.get(model, MOI.TerminationStatus()) == MOI.OPTIMAL + @test MOI.get(model, MOI.TerminationStatus()) == config.optimal_status @test MOI.get(model, MOI.PrimalStatus()) == MOI.FEASIBLE_POINT @test isapprox(MOI.get(model, MOI.ObjectiveValue()), 28.75, config) @test isapprox(MOI.get(model, MOI.VariablePrimal(), x1), 1.25, config) diff --git a/src/Test/test_objective.jl b/src/Test/test_objective.jl index fee305d769..df23f4488b 100644 --- a/src/Test/test_objective.jl +++ b/src/Test/test_objective.jl @@ -145,7 +145,7 @@ function test_objective_ObjectiveFunction_blank( f = MOI.ScalarAffineFunction([MOI.ScalarAffineTerm(0.0, x)], 0.0) MOI.set(model, obj_attr, f) MOI.optimize!(model) - @test MOI.get(model, MOI.TerminationStatus()) == MOI.OPTIMAL + @test MOI.get(model, MOI.TerminationStatus()) == config.optimal_status @test MOI.get(model, MOI.ObjectiveValue()) == 0.0 return end diff --git a/src/Test/test_solve.jl b/src/Test/test_solve.jl index 7bef64c635..99b47f5c64 100644 --- a/src/Test/test_solve.jl +++ b/src/Test/test_solve.jl @@ -889,7 +889,7 @@ function test_solve_optimize_twice( ) MOI.optimize!(model) MOI.optimize!(model) - MOI.get(model, MOI.TerminationStatus()) == MOI.OPTIMAL + MOI.get(model, MOI.TerminationStatus()) == config.optimal_status MOI.get(model, MOI.VariablePrimal(), x) == one(T) return end