Skip to content

Commit fc9fd99

Browse files
committed
Add missing @require in tests
1 parent 3f21373 commit fc9fd99

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

src/Test/test_model.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,11 @@ function test_model_copy_to_UnsupportedConstraint(
580580
model::MOI.ModelLike,
581581
::Config{T},
582582
) where {T}
583+
@requires MOI.supports_constraint(
584+
model,
585+
MOI.VariableIndex,
586+
MOI.EqualTo{T},
587+
)
583588
@test !MOI.supports_constraint(
584589
model,
585590
MOI.VariableIndex,
@@ -608,6 +613,11 @@ function test_model_copy_to_UnsupportedAttribute(
608613
model::MOI.ModelLike,
609614
::Config{T},
610615
) where {T}
616+
@requires MOI.supports_constraint(
617+
model,
618+
MOI.VariableIndex,
619+
MOI.EqualTo{T},
620+
)
611621
# ModelAttribute
612622
@test !MOI.supports(model, UnknownModelAttribute())
613623
@test_throws(
@@ -747,6 +757,11 @@ function test_model_ScalarFunctionConstantNotZero(
747757
config::Config{T},
748758
) where {T}
749759
@requires _supports(config, MOI.ScalarFunctionConstantNotZero)
760+
@requires MOI.supports_constraint(
761+
model,
762+
MOI.ScalarAffineFunction{T},
763+
MOI.EqualTo{T},
764+
)
750765
function _error(S, value)
751766
F = MOI.ScalarAffineFunction{T}
752767
return MOI.ScalarFunctionConstantNotZero{T,F,S}(value)

src/Test/test_objective.jl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ function test_objective_set_via_modify(
527527
@requires MOI.supports(model, attr)
528528
@requires _supports(config, MOI.modify)
529529
@requires _supports(config, MOI.ScalarCoefficientChange)
530+
@requires _supports(config, MOI.ListOfModelAttributesSet)
530531
@test MOI.get(model, MOI.ListOfModelAttributesSet()) == []
531532
x = MOI.add_variable(model)
532533
MOI.modify(model, attr, MOI.ScalarCoefficientChange(x, T(1)))
@@ -536,10 +537,11 @@ end
536537

537538
function test_objective_ObjectiveSense_in_ListOfModelAttributesSet(
538539
model::MOI.ModelLike,
539-
::Config{T},
540+
config::Config{T},
540541
) where {T}
541542
attr = MOI.ObjectiveSense()
542543
@requires MOI.supports(model, attr)
544+
@requires _supports(config, MOI.ListOfModelAttributesSet)
543545
@test (attr in MOI.get(model, MOI.ListOfModelAttributesSet())) == false
544546
MOI.set(model, MOI.ObjectiveSense(), MOI.MAX_SENSE)
545547
@test (attr in MOI.get(model, MOI.ListOfModelAttributesSet())) == true
@@ -548,10 +550,11 @@ end
548550

549551
function test_objective_VariableIndex_in_ListOfModelAttributesSet(
550552
model::MOI.ModelLike,
551-
::Config{T},
553+
config::Config{T},
552554
) where {T}
553555
attr = MOI.ObjectiveFunction{MOI.VariableIndex}()
554556
@requires MOI.supports(model, attr)
557+
@requires _supports(config, MOI.ListOfModelAttributesSet)
555558
@test (attr in MOI.get(model, MOI.ListOfModelAttributesSet())) == false
556559
MOI.set(model, MOI.ObjectiveSense(), MOI.MIN_SENSE)
557560
x = MOI.add_variable(model)
@@ -562,10 +565,11 @@ end
562565

563566
function test_objective_ScalarAffineFunction_in_ListOfModelAttributesSet(
564567
model::MOI.ModelLike,
565-
::Config{T},
568+
config::Config{T},
566569
) where {T}
567570
attr = MOI.ObjectiveFunction{MOI.ScalarAffineFunction{T}}()
568571
@requires MOI.supports(model, attr)
572+
@requires _supports(config, MOI.ListOfModelAttributesSet)
569573
@test (attr in MOI.get(model, MOI.ListOfModelAttributesSet())) == false
570574
MOI.set(model, MOI.ObjectiveSense(), MOI.MIN_SENSE)
571575
x = MOI.add_variable(model)
@@ -576,10 +580,11 @@ end
576580

577581
function test_objective_ScalarQuadraticFunction_in_ListOfModelAttributesSet(
578582
model::MOI.ModelLike,
579-
::Config{T},
583+
config::Config{T},
580584
) where {T}
581585
attr = MOI.ObjectiveFunction{MOI.ScalarQuadraticFunction{T}}()
582586
@requires MOI.supports(model, attr)
587+
@requires _supports(config, MOI.ListOfModelAttributesSet)
583588
@test (attr in MOI.get(model, MOI.ListOfModelAttributesSet())) == false
584589
MOI.set(model, MOI.ObjectiveSense(), MOI.MIN_SENSE)
585590
x = MOI.add_variable(model)

0 commit comments

Comments
 (0)