Skip to content

Commit 461006f

Browse files
authored
[Test] make first variable ZeroOne in test_basic_VectorAffineFunction_Indicator (#2600)
1 parent 5feb1c0 commit 461006f

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/Test/test_basic_constraint.jl

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,12 @@ function _basic_constraint_test_helper(
210210
config::Config{T},
211211
::Type{UntypedF},
212212
::Type{UntypedS},
213+
add_variables_fn::Function = MOI.add_variables,
213214
) where {T,UntypedF,UntypedS}
214215
set = _set(T, UntypedS)
215216
N = MOI.dimension(set)
216-
x = MOI.add_variables(model, N)
217+
x = add_variables_fn(model, N)
218+
217219
constraint_function = _function(T, UntypedF, x)
218220
@assert MOI.output_dimension(constraint_function) == N
219221
F, S = typeof(constraint_function), typeof(set)
@@ -404,11 +406,17 @@ function test_basic_VectorAffineFunction_Indicator_LessThan(
404406
model::MOI.ModelLike,
405407
config::Config{T},
406408
) where {T}
409+
function add_variables_fn(model, N)
410+
x = MOI.add_variables(model, N)
411+
MOI.add_constraint(model, x[1], MOI.ZeroOne())
412+
return x
413+
end
407414
_basic_constraint_test_helper(
408415
model,
409416
config,
410417
MOI.VectorAffineFunction,
411418
MOI.Indicator{MOI.ACTIVATE_ON_ONE,MOI.LessThan{T}},
419+
add_variables_fn,
412420
)
413421
return
414422
end
@@ -417,11 +425,17 @@ function test_basic_VectorAffineFunction_Indicator_GreaterThan(
417425
model::MOI.ModelLike,
418426
config::Config{T},
419427
) where {T}
428+
function add_variables_fn(model, N)
429+
x = MOI.add_variables(model, N)
430+
MOI.add_constraint(model, x[1], MOI.ZeroOne())
431+
return x
432+
end
420433
_basic_constraint_test_helper(
421434
model,
422435
config,
423436
MOI.VectorAffineFunction,
424437
MOI.Indicator{MOI.ACTIVATE_ON_ONE,MOI.GreaterThan{T}},
438+
add_variables_fn,
425439
)
426440
return
427441
end

0 commit comments

Comments
 (0)