Skip to content

Commit

Permalink
add slicing tests. ref #118
Browse files Browse the repository at this point in the history
  • Loading branch information
mlubin committed Mar 10, 2014
1 parent 777b466 commit 6e25edf
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion test/operator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -218,4 +218,16 @@ let
solve(dot_m)
@test_approx_eq_eps dot(c, getValue(x)) 6.0 1e-6
@test_approx_eq_eps dot(A, getValue(y)) 10.0 1e-6
end
end

let
slice_m = Model()
C = [:cat,:dog]
@defVar(slice_m, x[-1:1,C])
catcoef = [1,2,3]
dogcoef = [3,4,5]

@test affToStr(dot(catcoef, x[:,:cat])) == "1.0 x[-1,cat] + 2.0 x[0,cat] + 3.0 x[1,cat]"
@test affToStr(dot(dogcoef, x[:,:dog])) == "3.0 x[-1,dog] + 4.0 x[0,dog] + 5.0 x[1,dog]"
end

0 comments on commit 6e25edf

Please sign in to comment.