Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions test/expressions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,11 @@ end
anon = :((t, x) -> f(t, x, 1, d = 1))
@test InfiniteOpt._process_func_expr(error, anon) == (esc(anon), esc(:(t,x)), true)
anon = :((t, x[1]) -> sin(t + x[1]))
@test eval(InfiniteOpt._process_func_expr(error, anon)[1].args[1])(0.5, 0.2) == sin(0.5 + 0.2)
# Need invokelatest due to https://github.com/infiniteopt/InfiniteOpt.jl/pull/369
@test invokelatest(eval(InfiniteOpt._process_func_expr(error, anon)[1].args[1]), 0.5, 0.2) == sin(0.5 + 0.2)
anon = :(t[i] -> t[i] + 3)
@test eval(InfiniteOpt._process_func_expr(error, anon)[1].args[1])(2) == 5
# test errors
@test invokelatest(eval(InfiniteOpt._process_func_expr(error, anon)[1].args[1]), 2) == 5
# test errors
@test_throws ErrorException InfiniteOpt._process_func_expr(error, :(f(t, d = 2)))
@test_throws ErrorException InfiniteOpt._process_func_expr(error, :(f(x, t; d = 2)))
@test_throws ErrorException InfiniteOpt._process_func_expr(error, :(f >= 2))
Expand Down
Loading