diff options
Diffstat (limited to 'new-luxc/test/test/luxc/synthesizer/procedure.lux')
-rw-r--r-- | new-luxc/test/test/luxc/synthesizer/procedure.lux | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/new-luxc/test/test/luxc/synthesizer/procedure.lux b/new-luxc/test/test/luxc/synthesizer/procedure.lux new file mode 100644 index 000000000..898987308 --- /dev/null +++ b/new-luxc/test/test/luxc/synthesizer/procedure.lux @@ -0,0 +1,32 @@ +(;module: + lux + (lux [io] + (control monad + pipe) + (data [bool "B/" Eq<Bool>] + [text "T/" Eq<Text>] + [product] + (coll [list])) + ["r" math/random "r/" Monad<Random>] + test) + (luxc (lang ["la" analysis] + ["ls" synthesis]) + (analyser [";A" structure]) + [synthesizer]) + (.. common)) + +(test: "Procedures" + [num-args (|> r;nat (:: @ map (n.% +10))) + nameA (r;text +5) + argsA (r;list num-args gen-primitive)] + ($_ seq + (assert "Can synthesize procedure calls." + (|> (synthesizer;synthesize (#la;Procedure nameA argsA)) + (case> (#ls;Procedure nameS argsS) + (and (T/= nameA nameS) + (list;every? (product;uncurry corresponds?) + (list;zip2 argsA argsS))) + + _ + false))) + )) |