Skip to content

Commit 6e36c75

Browse files
authored
Merge pull request #90 from fremling/master
Add tests detailing how MathLink expressions can be turned into functions
2 parents cd2e1ee + 9e2635d commit 6e36c75

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/runtests.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,19 @@ import MathLink: WExpr, WSymbol
2020
@test W2JuliaExpr(W`a^b`) == :(a^b)
2121
@test W2JuliaExpr(W`Exp[a]`) == :(exp(a))
2222
end
23+
24+
@testset "To function" begin
25+
ex = W2JuliaExpr(W`a+b`)
26+
fun = @eval (a,b) -> $ex
27+
@test fun(1,2) == (1 + 2)
28+
@test fun(5,6) == (5 + 6)
29+
30+
31+
ex = W2JuliaExpr(W`Sin[a]`)
32+
fun = @eval (a) -> $ex
33+
@test fun(0) == sin(0)
34+
@test fun(1) == sin(1)
35+
end
2336
end
2437

2538

0 commit comments

Comments
 (0)