Skip to content

Commit

Permalink
[Test] update for generic coefficient types (#1667)
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored Nov 19, 2021
1 parent 4d7c42d commit 0431632
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/Test/test_basic_constraint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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

0 comments on commit 0431632

Please sign in to comment.