Skip to content

Commit

Permalink
Move test to macros.jl file
Browse files Browse the repository at this point in the history
  • Loading branch information
blegat committed Apr 17, 2018
1 parent 863a8ac commit 8a74796
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
7 changes: 0 additions & 7 deletions test/constraint.jl
Expand Up @@ -200,11 +200,4 @@
@test macroexpand(:(@variable(m, -rand(5,5) <= nonsymmetric[1:5,1:5] <= rand(5,5), Symmetric))).head == :error
end

@testset "constructconstraint! on variable" begin
m = Model()
@variable(m, x)
@test JuMP.constructconstraint!(x, MOI.GreaterThan(0.0)) isa JuMP.SingleVariableConstraint{MOI.GreaterThan{Float64}}
@test JuMP.constructconstraint!(x, MOI.LessThan(0.0)) isa JuMP.SingleVariableConstraint{MOI.LessThan{Float64}}
@test JuMP.constructconstraint!(x, MOI.EqualTo(0)) isa JuMP.SingleVariableConstraint{MOI.EqualTo{Int}}
end
end
8 changes: 8 additions & 0 deletions test/macros.jl
Expand Up @@ -7,4 +7,12 @@
ex = @expression(m, sum(i+j+k for ((i,j),k) in d))
@test ex == 6
end

@testset "constructconstraint! on variable" begin
m = Model()
@variable(m, x)
@test JuMP.constructconstraint!(x, MOI.GreaterThan(0.0)) isa JuMP.SingleVariableConstraint{MOI.GreaterThan{Float64}}
@test JuMP.constructconstraint!(x, MOI.LessThan(0.0)) isa JuMP.SingleVariableConstraint{MOI.LessThan{Float64}}
@test JuMP.constructconstraint!(x, MOI.EqualTo(0)) isa JuMP.SingleVariableConstraint{MOI.EqualTo{Int}}
end
end
8 changes: 0 additions & 8 deletions test/old/macros.jl
Expand Up @@ -798,12 +798,4 @@ end
@test y[i].test_kw == 2
end
end

@testset "constructconstraint! on variable" begin
m = Model()
@variable(m, x)
@test string(JuMP.constructconstraint!(x, :(>=))) == "x $geq 0"
@test string(JuMP.constructconstraint!(x, :(<=))) == "x $leq 0"
@test string(JuMP.constructconstraint!(x, :(==))) == "x $eq 0"
end
end

0 comments on commit 8a74796

Please sign in to comment.