Skip to content

Commit

Permalink
Merge pull request #2281 from quentin/nolibffi-fix
Browse files Browse the repository at this point in the history
fix `functors` test when not using `libffi`
  • Loading branch information
Bernhard Scholz authored Jun 12, 2022
2 parents 4138dec + 8dd2354 commit 518270b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
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

0 comments on commit 518270b

Please sign in to comment.