diff options
Diffstat (limited to 'new-luxc/test/test/luxc/synthesizer/case/special.lux')
-rw-r--r-- | new-luxc/test/test/luxc/synthesizer/case/special.lux | 88 |
1 files changed, 47 insertions, 41 deletions
diff --git a/new-luxc/test/test/luxc/synthesizer/case/special.lux b/new-luxc/test/test/luxc/synthesizer/case/special.lux index 112546883..b369eb532 100644 --- a/new-luxc/test/test/luxc/synthesizer/case/special.lux +++ b/new-luxc/test/test/luxc/synthesizer/case/special.lux @@ -17,50 +17,56 @@ (../.. common)) (context: "Dummy variables." - [maskedA gen-primitive - temp r;nat - #let [maskA (#la;Case maskedA - (list [(#la;BindP temp) - (#la;Variable (#;Local temp))]))]] - (test "Dummy variables created to mask expressions get eliminated during synthesis." - (|> (synthesizer;synthesize maskA) - (corresponds? maskedA)))) + (<| (times +100) + (do @ + [maskedA gen-primitive + temp r;nat + #let [maskA (#la;Case maskedA + (list [(#la;BindP temp) + (#la;Variable (#;Local temp))]))]] + (test "Dummy variables created to mask expressions get eliminated during synthesis." + (|> (synthesizer;synthesize maskA) + (corresponds? maskedA)))))) (context: "Let expressions." - [registerA r;nat - inputA gen-primitive - outputA gen-primitive - #let [letA (#la;Case inputA - (list [(#la;BindP registerA) - outputA]))]] - (test "Can detect and reify simple 'let' expressions." - (|> (synthesizer;synthesize letA) - (case> (#ls;Let registerS inputS outputS) - (and (n.= registerA registerS) - (corresponds? inputA inputS) - (corresponds? outputA outputS)) + (<| (times +100) + (do @ + [registerA r;nat + inputA gen-primitive + outputA gen-primitive + #let [letA (#la;Case inputA + (list [(#la;BindP registerA) + outputA]))]] + (test "Can detect and reify simple 'let' expressions." + (|> (synthesizer;synthesize letA) + (case> (#ls;Let registerS inputS outputS) + (and (n.= registerA registerS) + (corresponds? inputA inputS) + (corresponds? outputA outputS)) - _ - false)))) + _ + false)))))) (context: "If expressions." - [then|else r;bool - inputA gen-primitive - thenA gen-primitive - elseA gen-primitive - #let [ifA (if then|else - (#la;Case inputA - (list [(#la;BoolP true) thenA] - [(#la;BoolP false) elseA])) - (#la;Case inputA - (list [(#la;BoolP false) elseA] - [(#la;BoolP true) thenA])))]] - (test "Can detect and reify simple 'if' expressions." - (|> (synthesizer;synthesize ifA) - (case> (#ls;If inputS thenS elseS) - (and (corresponds? inputA inputS) - (corresponds? thenA thenS) - (corresponds? elseA elseS)) + (<| (times +100) + (do @ + [then|else r;bool + inputA gen-primitive + thenA gen-primitive + elseA gen-primitive + #let [ifA (if then|else + (#la;Case inputA + (list [(#la;BoolP true) thenA] + [(#la;BoolP false) elseA])) + (#la;Case inputA + (list [(#la;BoolP false) elseA] + [(#la;BoolP true) thenA])))]] + (test "Can detect and reify simple 'if' expressions." + (|> (synthesizer;synthesize ifA) + (case> (#ls;If inputS thenS elseS) + (and (corresponds? inputA inputS) + (corresponds? thenA thenS) + (corresponds? elseA elseS)) - _ - false)))) + _ + false)))))) |