Skip to content

Commit cfb6c68

Browse files
authored
Add more tests to a range of algorithms (#111)
1 parent 10f384a commit cfb6c68

File tree

7 files changed

+31
-4
lines changed

7 files changed

+31
-4
lines changed

test/algorithms/Dichotomy.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ function test_vector_of_variables_objective()
404404
MOI.set(model, MOI.ObjectiveFunction{typeof(f)}(), f)
405405
MOI.add_constraint(model, sum(1.0 * xi for xi in x), MOI.GreaterThan(1.0))
406406
MOI.optimize!(model)
407-
MOI.get(model, MOI.TerminationStatus()) == MOI.OPTIMAL
407+
@test MOI.get(model, MOI.TerminationStatus()) == MOI.OPTIMAL
408408
return
409409
end
410410

test/algorithms/DominguezRios.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,15 @@ function test_issue_105()
638638
MOI.set(model, MOI.ObjectiveFunction{typeof(f)}(), f)
639639
MOI.optimize!(model)
640640
@test MOI.get(model, MOI.ResultCount()) == 6
641+
y = [MOI.get(model, MOI.ObjectiveValue(i)) for i in 1:6]
642+
@test sort!(y) == [
643+
[2380.0, 81.0, 18.0],
644+
[2440.0, 78.0, 18.0],
645+
[2500.0, 75.0, 18.0],
646+
[2560.0, 72.0, 18.0],
647+
[2620.0, 69.0, 18.0],
648+
[2680.0, 66.0, 18.0],
649+
]
641650
return
642651
end
643652

test/algorithms/EpsilonConstraint.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ function test_vector_of_variables_objective()
470470
MOI.set(model, MOI.ObjectiveFunction{typeof(f)}(), f)
471471
MOI.add_constraint(model, sum(1.0 * xi for xi in x), MOI.GreaterThan(1.0))
472472
MOI.optimize!(model)
473-
MOI.get(model, MOI.TerminationStatus()) == MOI.OPTIMAL
473+
@test MOI.get(model, MOI.TerminationStatus()) == MOI.OPTIMAL
474474
return
475475
end
476476

test/algorithms/Hierarchical.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ function test_vector_of_variables_objective()
126126
MOI.set(model, MOI.ObjectiveFunction{typeof(f)}(), f)
127127
MOI.add_constraint(model, sum(1.0 * xi for xi in x), MOI.GreaterThan(1.0))
128128
MOI.optimize!(model)
129-
MOI.get(model, MOI.TerminationStatus()) == MOI.OPTIMAL
129+
@test MOI.get(model, MOI.TerminationStatus()) == MOI.OPTIMAL
130130
return
131131
end
132132

test/algorithms/KirlikSayin.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,15 @@ function test_issue_105()
642642
MOI.set(model, MOI.ObjectiveFunction{typeof(f)}(), f)
643643
MOI.optimize!(model)
644644
@test MOI.get(model, MOI.ResultCount()) == 6
645+
y = [MOI.get(model, MOI.ObjectiveValue(i)) for i in 1:6]
646+
@test sort!(y) == [
647+
[2380.0, 81.0, 18.0],
648+
[2440.0, 78.0, 18.0],
649+
[2500.0, 75.0, 18.0],
650+
[2560.0, 72.0, 18.0],
651+
[2620.0, 69.0, 18.0],
652+
[2680.0, 66.0, 18.0],
653+
]
645654
return
646655
end
647656

test/algorithms/Lexicographic.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ function test_vector_of_variables_objective()
165165
MOI.set(model, MOI.ObjectiveFunction{typeof(f)}(), f)
166166
MOI.add_constraint(model, sum(1.0 * xi for xi in x), MOI.GreaterThan(1.0))
167167
MOI.optimize!(model)
168-
MOI.get(model, MOI.TerminationStatus()) == MOI.OPTIMAL
168+
@test MOI.get(model, MOI.TerminationStatus()) == MOI.OPTIMAL
169169
return
170170
end
171171

test/algorithms/TambyVanderpooten.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,15 @@ function test_issue_105()
659659
MOI.set(model, MOI.ObjectiveFunction{typeof(f)}(), f)
660660
MOI.optimize!(model)
661661
@test MOI.get(model, MOI.ResultCount()) == 6
662+
y = [MOI.get(model, MOI.ObjectiveValue(i)) for i in 1:6]
663+
@test sort!(y) == [
664+
[2380.0, 81.0, 18.0],
665+
[2440.0, 78.0, 18.0],
666+
[2500.0, 75.0, 18.0],
667+
[2560.0, 72.0, 18.0],
668+
[2620.0, 69.0, 18.0],
669+
[2680.0, 66.0, 18.0],
670+
]
662671
return
663672
end
664673

0 commit comments

Comments
 (0)