Skip to content

Commit

Permalink
Even more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
IainNZ committed Aug 31, 2015
1 parent a63f5e4 commit d269c19
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/robustmacro.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,9 @@ macro defUnc(args...)
ub = esc_nonconstant(x.args[3])
lb = -Inf
end
elseif x.args[2] == :(==)
# fixed variable
var = x.args[1]
@assert length(x.args) == 3
lb = esc(x.args[3])
ub = esc(x.args[3])
gottype = 1
t = :Fixed
#------------------------------------------------------------------
# NO FIXED
#------------------------------------------------------------------
else
# Its a comparsion, but not using <= ... <=
error("in @defUnc ($(string(x))): use the form lb <= ... <= ub.")
Expand Down
14 changes: 14 additions & 0 deletions test/macro.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@ lastuc(rm) = conToStr(JuMPeR.getRobust(rm).uncertainconstr[end])
lastus(rm) = conToStr(JuMPeR.getRobust(rm).uncertaintyset[end])
le, eq, ge = JuMP.repl[:leq], JuMP.repl[:eq], JuMP.repl[:geq]

facts("[macro] Uncertain parameters") do
rm = RobustModel()
@defUnc(rm, 5 >= u >= 1)
@fact getLower(u) --> 1
@fact getUpper(u) --> 5
@fact affToStr(zero(u)) --> "0"
@fact affToStr(one(u)) --> "1"
@fact sprint(print,rm) --> """Min 0
Subject to
Uncertain constraints:
Uncertainty set:
1 ≤ u ≤ 5
"""
end

facts("[macro] Uncertainty set constraints") do

Expand Down

0 comments on commit d269c19

Please sign in to comment.