68
68
# ## The tests
69
69
# ##
70
70
71
- function test_MOI_Test ()
72
- inner = ModelForUniversalFallback {Float64} ()
73
- model = MOI. Utilities. UniversalFallback (inner)
74
- MOI. Test. runtests (
75
- model,
76
- MOI. Test. Config (exclude = Any[MOI. optimize!]),
77
- exclude = String[
78
- # UniversalFallback fails all these tests because it supports
79
- # everything
80
- " test_attribute_" ,
81
- " test_model_supports_constraint_" ,
82
- " test_model_copy_to_Unsupported" ,
83
- # Bugs in UniversalFallback
84
- " test_model_LowerBoundAlreadySet" ,
85
- " test_model_UpperBoundAlreadySet" ,
86
- " test_add_parameter" ,
87
- ],
88
- )
89
- return
90
- end
91
-
92
- function _test_Optimizer_Model_attributes (uf, model, attr, listattr)
71
+ # function test_MOI_Test()
72
+ # inner = ModelForUniversalFallback{Float64}()
73
+ # model = MOI.Utilities.UniversalFallback(inner)
74
+ # MOI.Test.runtests(
75
+ # model,
76
+ # MOI.Test.Config(exclude = Any[MOI.optimize!]),
77
+ # exclude = String[
78
+ # # UniversalFallback fails all these tests because it supports
79
+ # # everything
80
+ # "test_attribute_",
81
+ # "test_model_supports_constraint_",
82
+ # "test_model_copy_to_Unsupported",
83
+ # # Bugs in UniversalFallback
84
+ # "test_model_LowerBoundAlreadySet",
85
+ # "test_model_UpperBoundAlreadySet",
86
+ # "test_add_parameter",
87
+ # ],
88
+ # )
89
+ # return
90
+ # end
91
+
92
+ function _test_Optimizer_Model_attributes (
93
+ uf:: MOI.Utilities.UniversalFallback ,
94
+ model:: MOI.ModelLike ,
95
+ attr:: Union{MOI.AbstractOptimizerAttribute,MOI.AbstractModelAttribute} ,
96
+ list:: Union{MOI.ListOfOptimizerAttributesSet,MOI.ListOfModelAttributesSet} ,
97
+ )
93
98
@test ! MOI. supports (model, attr)
94
99
@test MOI. supports (uf, attr)
95
- @test isempty (MOI. get (uf, listattr ))
100
+ @test isempty (MOI. get (uf, list ))
96
101
MOI. set (uf, attr, 0 )
97
102
@test MOI. get (uf, attr) == 0
98
- @test MOI. get (uf, listattr) == [attr]
103
+ @test MOI. get (uf, list) == [attr]
104
+ MOI. set (uf, attr, nothing )
105
+ @test isempty (MOI. get (uf, list))
99
106
return
100
107
end
101
108
102
109
function _test_Variable_Constraint_attributes (
103
- uf,
104
- model,
105
- attr,
106
- listattr,
110
+ uf:: MOI.Utilities.UniversalFallback ,
111
+ model:: MOI.ModelLike ,
112
+ attr:: Union{MOI.AbstractVariableAttribute,MOI.AbstractConstraintAttribute} ,
113
+ listattr:: Union {
114
+ MOI. ListOfVariableAttributesSet,
115
+ MOI. ListOfConstraintAttributesSet,
116
+ },
107
117
I:: Type{<:MOI.Index} ,
108
118
addfun,
109
119
x,
@@ -114,6 +124,11 @@ function _test_Variable_Constraint_attributes(
114
124
@test MOI. supports (uf, attr, I)
115
125
@test isempty (MOI. get (uf, listattr))
116
126
MOI. set (uf, attr, [x, y], [2 , 0 ])
127
+ @test MOI. get (uf, listattr) == [attr]
128
+ MOI. set (uf, attr, x, nothing )
129
+ MOI. set (uf, attr, y, nothing )
130
+ @test isempty (MOI. get (uf, listattr))
131
+ MOI. set (uf, attr, [x, y], [2 , 0 ])
117
132
@test MOI. get (uf, attr, z) === nothing
118
133
@test ! MOI. is_empty (uf)
119
134
@test MOI. get (uf, listattr) == [attr]
@@ -235,18 +250,13 @@ function test_supported_constraint_attributes()
235
250
cx = _add_constraint (uf, x, 0.0 )
236
251
cy = _add_constraint (uf, y, 1.0 )
237
252
cz = _add_constraint (uf, z, 2.0 )
253
+ F, S = MOI. ScalarAffineFunction{Float64}, MOI. LessThan{Float64}
238
254
_test_Variable_Constraint_attributes (
239
255
uf,
240
256
model,
241
257
MOI. Test. UnknownConstraintAttribute (),
242
- MOI. ListOfConstraintAttributesSet{
243
- MOI. ScalarAffineFunction{Float64},
244
- MOI. LessThan{Float64},
245
- }(),
246
- MOI. ConstraintIndex{
247
- MOI. ScalarAffineFunction{Float64},
248
- MOI. LessThan{Float64},
249
- },
258
+ MOI. ListOfConstraintAttributesSet {F,S} (),
259
+ MOI. ConstraintIndex{F,S},
250
260
uf -> _add_constraint (uf, x, 0.0 ),
251
261
cx,
252
262
cy,
@@ -282,18 +292,13 @@ function test_unsupported_constraint_attributes()
282
292
cx = _add_constraint (uf, x, 0.0 )
283
293
cy = _add_constraint (uf, y, 1.0 )
284
294
cz = _add_constraint (uf, z, 2.0 )
295
+ F, S = MOI. ScalarAffineFunction{Float64}, MOI. EqualTo{Float64}
285
296
_test_Variable_Constraint_attributes (
286
297
uf,
287
298
model,
288
299
MOI. Test. UnknownConstraintAttribute (),
289
- MOI. ListOfConstraintAttributesSet{
290
- MOI. ScalarAffineFunction{Float64},
291
- MOI. EqualTo{Float64},
292
- }(),
293
- MOI. ConstraintIndex{
294
- MOI. ScalarAffineFunction{Float64},
295
- MOI. EqualTo{Float64},
296
- },
300
+ MOI. ListOfConstraintAttributesSet {F,S} (),
301
+ MOI. ConstraintIndex{F,S},
297
302
uf -> _add_constraint (uf, x, 0.0 ),
298
303
cx,
299
304
cy,
0 commit comments