Skip to content

Commit

Permalink
Test improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
pulsipher committed May 17, 2021
1 parent c45d8d8 commit 75c02f0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions test/macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ end
return NewVariable(info)
end
function JuMP.add_variable(model::Model, v::NewVariable, name::String = "")
return JuMP.add_variable(model, ScalarVariable(v.info), name)
return JuMP.add_variable(
model,
ScalarVariable(v.info),
name * "_normal_add",
)
end
function JuMP.add_variable(
model::Model,
Expand All @@ -106,6 +110,7 @@ end
)
vs = map(i -> ScalarVariable(i.info), v.scalar_variables)
new_v = VariablesConstrainedOnCreation(vs, v.set, v.shape)
names .*= "_constr_add"
return JuMP.add_variable(model, new_v, names)
end

Expand All @@ -114,10 +119,10 @@ end
@test lower_bound(x) == 0
@test upper_bound(x) == 1
@test is_binary(x)
@test name(x) == "x"
@test name(x) == "x_normal_add"

@variable(model, y[1:3] in SecondOrderCone(), NewVariable)
@test name.(y) == ["y[$i]" for i in 1:3]
@test name.(y) == ["y[$i]_constr_add" for i in 1:3]
@test num_constraints(model, Vector{VariableRef}, MOI.SecondOrderCone) == 1
end

Expand Down

0 comments on commit 75c02f0

Please sign in to comment.