@@ -9,19 +9,19 @@ using Test
99import JSON
1010import MathOptInterface as MOI
1111
12- function run_tests (model:: MOI.ModelLike )
12+ function run_tests (model:: MOI.ModelLike ; kwargs ... )
1313 for name in names (@__MODULE__ ; all = true )
1414 if startswith (" $name " , " test_" )
1515 @testset " $name " begin
1616 MOI. empty! (model)
17- getfield (@__MODULE__ , name)(model)
17+ getfield (@__MODULE__ , name)(model; kwargs ... )
1818 end
1919 end
2020 end
2121 return
2222end
2323
24- function _test_vOptLib_instance (model, instance)
24+ function _test_vOptLib_instance (model, instance; complete :: Bool = true )
2525 root = joinpath (dirname (@__DIR__ ), " instances" )
2626 src = MOI. FileFormats. MOF. Model ()
2727 MOI. read_from_file (src, joinpath (root, " models" , instance * " .mof.json" ))
@@ -38,7 +38,8 @@ function _test_vOptLib_instance(model, instance)
3838 end
3939 push! (solutions[Y], convert (Vector{Int}, sol[" X" ]))
4040 end
41- @test MOI. get (model, MOI. ResultCount ()) >= length (solutions)
41+ min_solutions = complete ? length (solutions) : 1
42+ @test MOI. get (model, MOI. ResultCount ()) >= min_solutions
4243 for i in 1 : MOI. get (model, MOI. ResultCount ())
4344 Y = round .(Int, MOI. get (model, MOI. ObjectiveValue (i)))
4445 @test haskey (solutions, Y)
@@ -48,12 +49,20 @@ function _test_vOptLib_instance(model, instance)
4849 return
4950end
5051
51- test_vOptLib_2KP50_11 (model) = _test_vOptLib_instance (model, " 2KP50-11" )
52+ function test_vOptLib_2KP50_11 (model; kwargs... )
53+ return _test_vOptLib_instance (model, " 2KP50-11" ; kwargs... )
54+ end
5255
53- test_vOptLib_2KP50_50 (model) = _test_vOptLib_instance (model, " 2KP50-50" )
56+ function test_vOptLib_2KP50_50 (model; kwargs... )
57+ return _test_vOptLib_instance (model, " 2KP50-50" ; kwargs... )
58+ end
5459
55- test_vOptLib_2KP50_92 (model) = _test_vOptLib_instance (model, " 2KP50-92" )
60+ function test_vOptLib_2KP50_92 (model; kwargs... )
61+ return _test_vOptLib_instance (model, " 2KP50-92" ; kwargs... )
62+ end
5663
57- test_vOptLib_2KP100_50 (model) = _test_vOptLib_instance (model, " 2KP100-50" )
64+ function test_vOptLib_2KP100_50 (model; kwargs... )
65+ return _test_vOptLib_instance (model, " 2KP100-50" ; kwargs... )
66+ end
5867
5968end # module vOptLib
0 commit comments