From 0431632728feb2bde3bbd49bcc2a6004abdab632 Mon Sep 17 00:00:00 2001 From: Oscar Dowson Date: Fri, 19 Nov 2021 14:48:35 +1300 Subject: [PATCH] [Test] update for generic coefficient types (#1667) --- src/Test/test_basic_constraint.jl | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/Test/test_basic_constraint.jl b/src/Test/test_basic_constraint.jl index 3d0c97efb1..693287c242 100644 --- a/src/Test/test_basic_constraint.jl +++ b/src/Test/test_basic_constraint.jl @@ -104,14 +104,16 @@ _set(::Type{MOI.RootDetConeTriangle}) = MOI.RootDetConeTriangle(3) _set(::Type{MOI.RootDetConeSquare}) = MOI.RootDetConeSquare(3) _set(::Type{MOI.Complements}) = MOI.Complements(2) -function _set(::Type{MOI.Indicator{MOI.ACTIVATE_ON_ONE,MOI.LessThan{Float64}}}) - return MOI.Indicator{MOI.ACTIVATE_ON_ONE}(MOI.LessThan(3.0)) +function _set( + ::Type{MOI.Indicator{MOI.ACTIVATE_ON_ONE,MOI.LessThan{T}}}, +) where {T} + return MOI.Indicator{MOI.ACTIVATE_ON_ONE}(MOI.LessThan(convert(T, 3))) end function _set( - ::Type{MOI.Indicator{MOI.ACTIVATE_ON_ONE,MOI.GreaterThan{Float64}}}, -) - return MOI.Indicator{MOI.ACTIVATE_ON_ONE}(MOI.GreaterThan(3.0)) + ::Type{MOI.Indicator{MOI.ACTIVATE_ON_ONE,MOI.GreaterThan{T}}}, +) where {T} + return MOI.Indicator{MOI.ACTIVATE_ON_ONE}(MOI.GreaterThan(convert(T, 3))) end function _basic_constraint_test_helper( @@ -285,26 +287,26 @@ end function test_basic_VectorAffineFunction_Indicator_LessThan( model::MOI.ModelLike, - config::Config, -) + config::Config{T}, +) where {T} _basic_constraint_test_helper( model, config, MOI.VectorAffineFunction, - MOI.Indicator{MOI.ACTIVATE_ON_ONE,MOI.LessThan{Float64}}, + MOI.Indicator{MOI.ACTIVATE_ON_ONE,MOI.LessThan{T}}, ) return end function test_basic_VectorAffineFunction_Indicator_GreaterThan( model::MOI.ModelLike, - config::Config, -) + config::Config{T}, +) where {T} _basic_constraint_test_helper( model, config, MOI.VectorAffineFunction, - MOI.Indicator{MOI.ACTIVATE_ON_ONE,MOI.GreaterThan{Float64}}, + MOI.Indicator{MOI.ACTIVATE_ON_ONE,MOI.GreaterThan{T}}, ) return end