Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 18 additions & 20 deletions src/Test/test_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -802,17 +802,16 @@ function test_model_LowerBoundAlreadySet(
sets = [MOI.EqualTo(lb), MOI.Interval(lb, lb)]
set2 = MOI.GreaterThan(lb)
for set1 in sets
if !MOI.supports_constraint(model, MOI.VariableIndex, typeof(set1))
continue
if MOI.supports_constraint(model, MOI.VariableIndex, typeof(set1))
ci = MOI.add_constraint(model, x, set1)
err = MOI.LowerBoundAlreadySet{typeof(set1),typeof(set2)}(x)
@test_throws err MOI.add_constraint(model, x, set2)
MOI.delete(model, ci)
ci = MOI.add_constraint(model, x, set2)
err = MOI.LowerBoundAlreadySet{typeof(set2),typeof(set1)}(x)
@test_throws err MOI.add_constraint(model, x, set1)
MOI.delete(model, ci)
end
ci = MOI.add_constraint(model, x, set1)
err = MOI.LowerBoundAlreadySet{typeof(set1),typeof(set2)}(x)
@test_throws err MOI.add_constraint(model, x, set2)
MOI.delete(model, ci)
ci = MOI.add_constraint(model, x, set2)
err = MOI.LowerBoundAlreadySet{typeof(set2),typeof(set1)}(x)
@test_throws err MOI.add_constraint(model, x, set1)
MOI.delete(model, ci)
end
return
end
Expand All @@ -836,17 +835,16 @@ function test_model_UpperBoundAlreadySet(
sets = [MOI.EqualTo(ub), MOI.Interval(ub, ub)]
set2 = MOI.LessThan(ub)
for set1 in sets
if !MOI.supports_constraint(model, MOI.VariableIndex, typeof(set1))
continue
if MOI.supports_constraint(model, MOI.VariableIndex, typeof(set1))
ci = MOI.add_constraint(model, x, set1)
err = MOI.UpperBoundAlreadySet{typeof(set1),typeof(set2)}(x)
@test_throws err MOI.add_constraint(model, x, set2)
MOI.delete(model, ci)
ci = MOI.add_constraint(model, x, set2)
err = MOI.UpperBoundAlreadySet{typeof(set2),typeof(set1)}(x)
@test_throws err MOI.add_constraint(model, x, set1)
MOI.delete(model, ci)
end
ci = MOI.add_constraint(model, x, set1)
err = MOI.UpperBoundAlreadySet{typeof(set1),typeof(set2)}(x)
@test_throws err MOI.add_constraint(model, x, set2)
MOI.delete(model, ci)
ci = MOI.add_constraint(model, x, set2)
err = MOI.UpperBoundAlreadySet{typeof(set2),typeof(set1)}(x)
@test_throws err MOI.add_constraint(model, x, set1)
MOI.delete(model, ci)
end
return
end
Expand Down
32 changes: 8 additions & 24 deletions src/Test/test_solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -437,9 +437,7 @@
)
MOI.optimize!(model)
@test MOI.get(model, MOI.TerminationStatus()) == config.infeasible_status
if MOI.get(model, MOI.DualStatus()) != MOI.INFEASIBILITY_CERTIFICATE
return
end
@requires MOI.get(model, MOI.DualStatus()) == MOI.INFEASIBILITY_CERTIFICATE

Check warning on line 440 in src/Test/test_solve.jl

View check run for this annotation

Codecov / codecov/patch

src/Test/test_solve.jl#L440

Added line #L440 was not covered by tests
clb_dual = MOI.get.(model, MOI.ConstraintDual(), clb)
c_dual = MOI.get(model, MOI.ConstraintDual(), c)
@test clb_dual[1] > config.atol
Expand Down Expand Up @@ -491,9 +489,7 @@
)
MOI.optimize!(model)
@test MOI.get(model, MOI.TerminationStatus()) == config.infeasible_status
if MOI.get(model, MOI.DualStatus()) != MOI.INFEASIBILITY_CERTIFICATE
return
end
@requires MOI.get(model, MOI.DualStatus()) == MOI.INFEASIBILITY_CERTIFICATE

Check warning on line 492 in src/Test/test_solve.jl

View check run for this annotation

Codecov / codecov/patch

src/Test/test_solve.jl#L492

Added line #L492 was not covered by tests
clb_dual = MOI.get.(model, MOI.ConstraintDual(), clb)
c_dual = MOI.get(model, MOI.ConstraintDual(), c)
@test clb_dual[1] > config.atol
Expand Down Expand Up @@ -544,9 +540,7 @@
)
MOI.optimize!(model)
@test MOI.get(model, MOI.TerminationStatus()) == config.infeasible_status
if MOI.get(model, MOI.DualStatus()) != MOI.INFEASIBILITY_CERTIFICATE
return
end
@requires MOI.get(model, MOI.DualStatus()) == MOI.INFEASIBILITY_CERTIFICATE

Check warning on line 543 in src/Test/test_solve.jl

View check run for this annotation

Codecov / codecov/patch

src/Test/test_solve.jl#L543

Added line #L543 was not covered by tests
clb_dual = MOI.get.(model, MOI.ConstraintDual(), clb)
c_dual = MOI.get(model, MOI.ConstraintDual(), c)
@test clb_dual[1] > config.atol
Expand Down Expand Up @@ -598,9 +592,7 @@
)
MOI.optimize!(model)
@test MOI.get(model, MOI.TerminationStatus()) == config.infeasible_status
if MOI.get(model, MOI.DualStatus()) != MOI.INFEASIBILITY_CERTIFICATE
return
end
@requires MOI.get(model, MOI.DualStatus()) == MOI.INFEASIBILITY_CERTIFICATE

Check warning on line 595 in src/Test/test_solve.jl

View check run for this annotation

Codecov / codecov/patch

src/Test/test_solve.jl#L595

Added line #L595 was not covered by tests
clb_dual = MOI.get.(model, MOI.ConstraintDual(), clb)
c_dual = MOI.get(model, MOI.ConstraintDual(), c)
@test clb_dual[1] > config.atol
Expand Down Expand Up @@ -652,9 +644,7 @@
)
MOI.optimize!(model)
@test MOI.get(model, MOI.TerminationStatus()) == config.infeasible_status
if MOI.get(model, MOI.DualStatus()) != MOI.INFEASIBILITY_CERTIFICATE
return
end
@requires MOI.get(model, MOI.DualStatus()) == MOI.INFEASIBILITY_CERTIFICATE

Check warning on line 647 in src/Test/test_solve.jl

View check run for this annotation

Codecov / codecov/patch

src/Test/test_solve.jl#L647

Added line #L647 was not covered by tests
clb_dual = MOI.get.(model, MOI.ConstraintDual(), clb)
c_dual = MOI.get(model, MOI.ConstraintDual(), c)
@test clb_dual[1] > config.atol
Expand Down Expand Up @@ -706,9 +696,7 @@
)
MOI.optimize!(model)
@test MOI.get(model, MOI.TerminationStatus()) == config.infeasible_status
if MOI.get(model, MOI.DualStatus()) != MOI.INFEASIBILITY_CERTIFICATE
return
end
@requires MOI.get(model, MOI.DualStatus()) == MOI.INFEASIBILITY_CERTIFICATE

Check warning on line 699 in src/Test/test_solve.jl

View check run for this annotation

Codecov / codecov/patch

src/Test/test_solve.jl#L699

Added line #L699 was not covered by tests
clb_dual = MOI.get.(model, MOI.ConstraintDual(), clb)
c_dual = MOI.get(model, MOI.ConstraintDual(), c)
@test clb_dual[1] > config.atol
Expand Down Expand Up @@ -760,9 +748,7 @@
)
MOI.optimize!(model)
@test MOI.get(model, MOI.TerminationStatus()) == config.infeasible_status
if MOI.get(model, MOI.DualStatus()) != MOI.INFEASIBILITY_CERTIFICATE
return
end
@requires MOI.get(model, MOI.DualStatus()) == MOI.INFEASIBILITY_CERTIFICATE

Check warning on line 751 in src/Test/test_solve.jl

View check run for this annotation

Codecov / codecov/patch

src/Test/test_solve.jl#L751

Added line #L751 was not covered by tests
clb_dual = MOI.get.(model, MOI.ConstraintDual(), clb)
c_dual = MOI.get(model, MOI.ConstraintDual(), c)
@test clb_dual[1] < -config.atol
Expand Down Expand Up @@ -818,9 +804,7 @@
MOI.set(model, MOI.ObjectiveFunction{MOI.VariableIndex}(), x[1])
MOI.optimize!(model)
@test MOI.get(model, MOI.TerminationStatus()) == config.infeasible_status
if MOI.get(model, MOI.DualStatus()) != MOI.INFEASIBILITY_CERTIFICATE
return
end
@requires MOI.get(model, MOI.DualStatus()) == MOI.INFEASIBILITY_CERTIFICATE

Check warning on line 807 in src/Test/test_solve.jl

View check run for this annotation

Codecov / codecov/patch

src/Test/test_solve.jl#L807

Added line #L807 was not covered by tests
clb_dual = MOI.get.(model, MOI.ConstraintDual(), clb)
c_dual = MOI.get(model, MOI.ConstraintDual(), c)
@test clb_dual[1] < -config.atol
Expand Down
17 changes: 17 additions & 0 deletions test/Utilities/mockoptimizer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,23 @@ function test_delete_allowed_false()
return
end

function test_modify_not_allowed()
model = MOI.Utilities.MockOptimizer(MOI.Utilities.Model{Float64}())
config = MOI.Test.Config(
exclude = Any[MOI.ScalarCoefficientChange, MOI.VectorConstantChange],
)
MOI.Test.runtests(
model,
config,
include = [
r"$test_linear_integration^",
r"$test_linear_integration_modification^",
r"$test_linear_VectorAffineFunction^",
],
)
return
end

end # module

TestMockOptimizer.runtests()
Loading