Skip to content

Commit

Permalink
don't run tests on 0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
mlubin committed Jul 19, 2016
1 parent 539874d commit 7ef2d5b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 23 deletions.
49 changes: 28 additions & 21 deletions test/macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,31 @@ facts("[macros] Check Julia expression parsing") do
end

@fact sumexpr.args[4].head --> :(=)
end

if VERSION >= v"0.5-dev+5475"
sumexpr = :(sum(x[i,j] * y[i,j] for i = 1:N, j in 1:M if i != j))
@fact sumexpr.head --> :call
@fact sumexpr.args[1] --> :sum
@fact sumexpr.args[2].head --> :generator
@fact sumexpr.args[2].args[1] --> :(x[i,j] * y[i,j])
@fact sumexpr.args[2].args[2].head --> :filter
@fact sumexpr.args[2].args[2].args[1] --> :(i != j)
@fact sumexpr.args[2].args[2].args[2] --> :(i = 1:N)
@fact sumexpr.args[2].args[2].args[3] --> :(j = 1:M)

sumexpr = :(sum(x[i,j] * y[i,j] for i = 1:N, j in 1:M))
@fact sumexpr.head --> :call
@fact sumexpr.args[1] --> :sum
@fact sumexpr.args[2].head --> :generator
@fact sumexpr.args[2].args[1] --> :(x[i,j] * y[i,j])
@fact sumexpr.args[2].args[2] --> :(i = 1:N)
@fact sumexpr.args[2].args[3] --> :(j = 1:M)
end
# generator syntax only parses on 0.5
if VERSION >= v"0.5-dev+5475"
eval("""
facts("[macros] Check Julia expression parsing (0.5)") do
sumexpr = :(sum(x[i,j] * y[i,j] for i = 1:N, j in 1:M if i != j))
@fact sumexpr.head --> :call
@fact sumexpr.args[1] --> :sum
@fact sumexpr.args[2].head --> :generator
@fact sumexpr.args[2].args[1] --> :(x[i,j] * y[i,j])
@fact sumexpr.args[2].args[2].head --> :filter
@fact sumexpr.args[2].args[2].args[1] --> :(i != j)
@fact sumexpr.args[2].args[2].args[2] --> :(i = 1:N)
@fact sumexpr.args[2].args[2].args[3] --> :(j = 1:M)
sumexpr = :(sum(x[i,j] * y[i,j] for i = 1:N, j in 1:M))
@fact sumexpr.head --> :call
@fact sumexpr.args[1] --> :sum
@fact sumexpr.args[2].head --> :generator
@fact sumexpr.args[2].args[1] --> :(x[i,j] * y[i,j])
@fact sumexpr.args[2].args[2] --> :(i = 1:N)
@fact sumexpr.args[2].args[3] --> :(j = 1:M)
end
"""); end

facts("[macros] Check @constraint basics") do
m = Model()
Expand Down Expand Up @@ -129,6 +133,7 @@ facts("[macros] sum{}") do
end

if VERSION >= v"0.5-dev+5475"
eval("""
facts("[macros] sum(generator)") do
m = Model()
@variable(m, x[1:3,1:3])
Expand All @@ -148,7 +153,7 @@ facts("[macros] sum(generator)") do
@constraint(m, sum( 0*x[i,1] + y for i=1:3) == 0)
@fact string(m.linconstr[end]) --> "3 y $eq 0"
end; end
end"""); end

facts("[macros] Problem modification") do
m = Model()
Expand Down Expand Up @@ -431,6 +436,8 @@ facts("[macros] Norm parsing") do
@fact_throws @constraint(model, norm2{x[i,j], i=1:2, j=1:2} + x[1,2] >= -1)
end

if VERSION >= v"0.5-dev+5475"
eval("""
facts("[macros] Generator norm parsing") do
model = Model()
@variable(model, x[1:2,1:2])
Expand All @@ -442,7 +449,7 @@ facts("[macros] Generator norm parsing") do
@fact string(model.socconstr[3]) --> "2.0 $Vert[x[1,1],x[2,1]]$Vert$sub2 $leq 1"
@fact_throws @constraint(model, (x[1,1]+1)*norm2(x[i,j] for i=1:2, j=1:2) + x[1,2] >= -1)
@fact_throws @constraint(model, norm2(x[i,j] for i=1:2, j=1:2) + x[1,2] >= -1)
end
end""");end

facts("[macros] Extraneous terms in QuadExpr (#535)") do
model = Model()
Expand Down
8 changes: 6 additions & 2 deletions test/nonlinear.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ context("With solver $(typeof(nlp_solver))") do
[1.000000, 4.742999, 3.821150, 1.379408], 1e-5)
end; end; end

if VERSION >= v"0.5-dev+5475"
eval("""
facts("[nonlinear] Test HS071 solves correctly (generators)") do
for nlp_solver in nlp_solvers
context("With solver $(typeof(nlp_solver))") do
Expand All @@ -83,7 +85,7 @@ context("With solver $(typeof(nlp_solver))") do
@fact status --> :Optimal
@fact getvalue(x)[:] --> roughly(
[1.000000, 4.742999, 3.821150, 1.379408], 1e-5)
end; end; end
end; end; end""");end


facts("[nonlinear] Test HS071 solves correctly, epigraph") do
Expand Down Expand Up @@ -522,6 +524,8 @@ context("With solver $(typeof(nlp_solver))") do
@fact getvalue(x) --> roughly(ones(18),1e-4)
end; end; end

if VERSION >= v"0.5-dev+5475"
eval("""
facts("[nonlinear] Test Hessian chunking code (generators)") do
for nlp_solver in nlp_solvers
context("With solver $(typeof(nlp_solver))") do
Expand All @@ -530,7 +534,7 @@ context("With solver $(typeof(nlp_solver))") do
@NLobjective(m, Min, prod(x[i] for i=1:18))
@fact solve(m) --> :Optimal
@fact getvalue(x) --> roughly(ones(18),1e-4)
end; end; end
end; end"""); end


#############################################################################
Expand Down

0 comments on commit 7ef2d5b

Please sign in to comment.