aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/test/test/luxc/lang/synthesis/case/special.lux
diff options
context:
space:
mode:
Diffstat (limited to 'new-luxc/test/test/luxc/lang/synthesis/case/special.lux')
-rw-r--r--new-luxc/test/test/luxc/lang/synthesis/case/special.lux72
1 files changed, 0 insertions, 72 deletions
diff --git a/new-luxc/test/test/luxc/lang/synthesis/case/special.lux b/new-luxc/test/test/luxc/lang/synthesis/case/special.lux
deleted file mode 100644
index 398f98a57..000000000
--- a/new-luxc/test/test/luxc/lang/synthesis/case/special.lux
+++ /dev/null
@@ -1,72 +0,0 @@
-(.module:
- lux
- (lux [io]
- (control [monad #+ do]
- pipe)
- (macro [code])
- ["r" math/random "r/" Monad<Random>]
- test)
- (luxc (lang ["la" analysis]
- ["ls" synthesis]
- (synthesis [".S" expression])
- [".L" extension]
- [".L" variable #+ Variable]))
- (/// common))
-
-(context: "Dummy variables."
- (<| (times +100)
- (do @
- [maskedA gen-primitive
- temp (|> r.nat (:: @ map (n/% +100)))
- #let [maskA (` ("lux case" (~ maskedA)
- {("lux case bind" (~ (code.nat temp)))
- (~ (la.var (variableL.local temp)))}))]]
- (test "Dummy variables created to mask expressions get eliminated during synthesis."
- (|> (expressionS.synthesize extensionL.no-syntheses
- maskA)
- (corresponds? maskedA))))))
-
-(context: "Let expressions."
- (<| (times +100)
- (do @
- [registerA r.nat
- inputA gen-primitive
- outputA gen-primitive
- #let [letA (` ("lux case" (~ inputA)
- {("lux case bind" (~ (code.nat registerA)))
- (~ outputA)}))]]
- (test "Can detect and reify simple 'let' expressions."
- (|> (expressionS.synthesize extensionL.no-syntheses
- letA)
- (case> (^ [_ (#.Form (list [_ (#.Text "lux let")] [_ (#.Nat registerS)] inputS outputS))])
- (and (n/= registerA registerS)
- (corresponds? inputA inputS)
- (corresponds? outputA outputS))
-
- _
- false))))))
-
-(context: "If expressions."
- (<| (times +100)
- (do @
- [then|else r.bool
- inputA gen-primitive
- thenA gen-primitive
- elseA gen-primitive
- #let [ifA (if then|else
- (` ("lux case" (~ inputA)
- {true (~ thenA)
- false (~ elseA)}))
- (` ("lux case" (~ inputA)
- {false (~ elseA)
- true (~ thenA)})))]]
- (test "Can detect and reify simple 'if' expressions."
- (|> (expressionS.synthesize extensionL.no-syntheses
- ifA)
- (case> (^ [_ (#.Form (list [_ (#.Text "lux if")] inputS thenS elseS))])
- (and (corresponds? inputA inputS)
- (corresponds? thenA thenS)
- (corresponds? elseA elseS))
-
- _
- false))))))