diff options
author | Eduardo Julian | 2017-05-31 21:35:39 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-05-31 21:35:39 -0400 |
commit | aa3dcb411db1bfbf41ca59c334c6c792b9e40d0c (patch) | |
tree | 0095015807b18d65e9938cf9db686d8f29d87afb /new-luxc/test/test/luxc/synthesizer/procedure.lux | |
parent | b73f1c909d19d5492d6d9a7dc707a3b817c73619 (diff) |
- Implemented some synthesis algorithms and tests for primitives, structures, procedures and function application.
- Some refactoring.
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))) + )) |