Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix functors test when not using libffi #2281

Merged
merged 1 commit into from
Jun 12, 2022
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions tests/interface/functors/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,9 @@ if (SOUFFLE_DOMAIN_64BIT)
target_compile_definitions(functors
PUBLIC RAM_DOMAIN_SIZE=64)
endif()

if (SOUFFLE_USE_LIBFFI)
target_compile_definitions(functors
PUBLIC USE_LIBFFI)
endif()

9 changes: 7 additions & 2 deletions tests/interface/functors/functors.dl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
.functor factorial(unsigned):unsigned
.functor rnd(float):number
.functor incr(float):float
.functor concat(float, number, unsigned, symbol):symbol

.decl A(x:number)
A(@foo(1,"123")) :- true.
Expand Down Expand Up @@ -62,10 +61,16 @@ I(@incr(1)) :- true.
.output I

.decl CC(f:float, i:number, u:unsigned, s:symbol, res:symbol)
.output CC
#if defined (USE_LIBFFI)
// when Souffle is built with libffi we can call stateless functors with arbitrary arguments
.functor concat(float, number, unsigned, symbol):symbol
CC(f,i,u,s,res) :-
f = 1.25, i=-4, u=1000u, s="message",
res = @concat(1.25, -4, 1000, "message").
.output CC
#else
CC(1.25, -4, 1000u, "message", "1.250000-41000message").
#endif


// Testing stateful functors
Expand Down