Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
odow committed Oct 30, 2023
1 parent a6b663b commit d8f9c92
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions test/Bridges/Constraint/bridge.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,26 @@ struct DummyBridge <: MOI.Bridges.Constraint.AbstractBridge end
function test_AbstractBridge()
model = MOI.Utilities.Model{Float64}()
bridge = DummyBridge()
attr = MOI.ConstraintPrimalStart()
@test !MOI.supports(model, attr, typeof(bridge))
@test_throws MOI.UnsupportedAttribute(attr) MOI.set(
model,
attr,
bridge,
1.0,
@test !MOI.supports(model, MOI.ConstraintPrimalStart(), typeof(bridge))
message = MOI.Bridges._attribute_error_message(
MOI.ConstraintPrimalStart(),
DummyBridge,
"setting a value for",
)
attr = MOI.ConstraintFunction()
err = MOI.SetAttributeNotAllowed(attr)
@test_throws err MOI.set(model, attr, bridge, MOI.EqualTo(1.0))
@test_throws(
MOI.UnsupportedAttribute(MOI.ConstraintPrimalStart(), message),
MOI.set(model, MOI.ConstraintPrimalStart(), bridge, 1.0),
)
message = MOI.Bridges._attribute_error_message(
MOI.ConstraintSet(),
DummyBridge,
"setting a value for",
)
@test_throws(
MOI.SetAttributeNotAllowed(MOI.ConstraintSet(), message),
MOI.set(model, MOI.ConstraintSet(), bridge, MOI.EqualTo(1.0)),
)
return
end

end # module
Expand Down

0 comments on commit d8f9c92

Please sign in to comment.