diff options
author | Eduardo Julian | 2018-07-14 03:23:38 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-07-14 03:23:38 -0400 |
commit | 1137f61adeb416d89436a6849a07f28c8f329fc1 (patch) | |
tree | fd2eb9c78b2df7116fcb3620e04f6d0eb26410e3 /new-luxc/test | |
parent | 0c0472862f5c1e543e6c5614a4cd112ac7d4cc13 (diff) |
Switched to using new bit syntax in new-luxc.
Diffstat (limited to 'new-luxc/test')
12 files changed, 101 insertions, 101 deletions
diff --git a/new-luxc/test/test/luxc/lang/analysis/host.jvm.lux b/new-luxc/test/test/luxc/lang/analysis/host.jvm.lux index 1e6cafdfc..fcdcfbe6a 100644 --- a/new-luxc/test/test/luxc/lang/analysis/host.jvm.lux +++ b/new-luxc/test/test/luxc/lang/analysis/host.jvm.lux @@ -50,8 +50,8 @@ (#e.Error error) <failure>)))] - [success true false] - [failure false true] + [success #1 #0] + [failure #0 #1] ) (do-template [<name> <success> <failure>] @@ -71,8 +71,8 @@ (#e.Error error) <failure>)))] - [success' true false] - [failure' false true] + [success' #1 #0] + [failure' #0 #1] ) (context: "Conversions [double + float]." diff --git a/new-luxc/test/test/luxc/lang/analysis/type.lux b/new-luxc/test/test/luxc/lang/analysis/type.lux index b2d819ec5..707565fca 100644 --- a/new-luxc/test/test/luxc/lang/analysis/type.lux +++ b/new-luxc/test/test/luxc/lang/analysis/type.lux @@ -73,10 +73,10 @@ [#.Text text/=]) _ - false)) + #0)) (#e.Error error) - false))) + #0))) (test (format "Can analyse type-coercion.") (|> (do Monad<Meta> [runtime-bytecode @runtime.translate] @@ -89,5 +89,5 @@ (type/= codeT analysisT) (#e.Error error) - false))) + #0))) )))) diff --git a/new-luxc/test/test/luxc/lang/synthesis/loop.lux b/new-luxc/test/test/luxc/lang/synthesis/loop.lux index af818255b..c6efa7dbf 100644 --- a/new-luxc/test/test/luxc/lang/synthesis/loop.lux +++ b/new-luxc/test/test/luxc/lang/synthesis/loop.lux @@ -35,7 +35,7 @@ (does-recursion? arity bodyS) _ - false)) + #0)) (^ [_ (#.Form (list& [_ (#.Text "lux recur")] argsS))]) (n/= arity (list.size argsS)) @@ -48,7 +48,7 @@ (recur elseS)) _ - false + #0 ))) (def: (gen-body arity output) @@ -139,7 +139,7 @@ (and (n/= arity _arity))) _ - false)))))) + #0)))))) (context: "Loop." (<| (times +100) @@ -159,4 +159,4 @@ (loopS.contains-self-reference? _bodyS) _ - false)))))) + #0)))))) diff --git a/new-luxc/test/test/luxc/lang/synthesis/procedure.lux b/new-luxc/test/test/luxc/lang/synthesis/procedure.lux index 9648e5add..ab6c9de6f 100644 --- a/new-luxc/test/test/luxc/lang/synthesis/procedure.lux +++ b/new-luxc/test/test/luxc/lang/synthesis/procedure.lux @@ -30,5 +30,5 @@ (list.zip2 argsA argsS))) _ - false))) + #0))) )))) diff --git a/new-luxc/test/test/luxc/lang/translation/case.lux b/new-luxc/test/test/luxc/lang/translation/case.lux index 20d072651..391dc5ad8 100644 --- a/new-luxc/test/test/luxc/lang/translation/case.lux +++ b/new-luxc/test/test/luxc/lang/translation/case.lux @@ -70,15 +70,15 @@ (|> (run (` ("lux case" (~ valueS) ("lux case alt" ("lux case seq" (~ pathS) - ("lux case exec" true)) + ("lux case exec" #1)) ("lux case seq" ("lux case bind" +0) - ("lux case exec" false)))))) + ("lux case exec" #0)))))) (case> (#e.Success valueT) (:coerce Bit valueT) (#e.Error error) (exec (log! error) - false)))) + #0)))) (test "Can bind values." (|> (run (` ("lux case" (~ (code.nat to-bind)) ("lux case seq" ("lux case bind" +0) @@ -88,7 +88,7 @@ (#e.Error error) (exec (log! error) - false)))) + #0)))) ))) (context: "[JVM] Pattern-matching." diff --git a/new-luxc/test/test/luxc/lang/translation/common.lux b/new-luxc/test/test/luxc/lang/translation/common.lux index 9aba56d6b..769aea3f5 100644 --- a/new-luxc/test/test/luxc/lang/translation/common.lux +++ b/new-luxc/test/test/luxc/lang/translation/common.lux @@ -34,7 +34,7 @@ (#e.Error error) (exec (log! error) - false)) + #0)) (let [param <param-expr>])))] ["lux bit and" bit.and param] @@ -55,7 +55,7 @@ (#e.Error error) (exec (log! error) - false)) + #0)) (let [param (n/% +64 param)]))) )))) @@ -75,7 +75,7 @@ (#e.Error error) (exec (log! error) - false)) + #0)) (let [subject <subject-expr>])))] ["lux int to-frac" Frac int-to-frac f/= subject] @@ -93,7 +93,7 @@ (#e.Error error) (exec (log! error) - false)))))] + #0)))))] ["lux int +" i/+ Int i/=] ["lux int -" i/- Int i/=] @@ -117,7 +117,7 @@ (<comp> (<reference> param subject) (:coerce <outputT> valueT)) _ - false)))] + #0)))] ["lux frac +" f/+ Frac f/=] ["lux frac -" f/- Frac f/=] @@ -143,7 +143,7 @@ (<test> (:coerce Frac valueT)) _ - false)))] + #0)))] ["lux frac min" (f/= frac/bottom)] ["lux frac max" (f/= frac/top)] @@ -157,7 +157,7 @@ (#e.Error error) (exec (log! error) - false))))] + #0))))] ["lux frac to-int" "lux int to-frac" (f/< 1.0)])) )))) @@ -205,34 +205,34 @@ (:coerce Bit valueV) _ - false)) + #0)) (|> (run (` ("lux text =" (~ sample0S) (~ sample1S)))) (case> (#e.Success valueV) (not (:coerce Bit valueV)) _ - false)))) + #0)))) (test "Can compare texts for order." (|> (run (` ("lux text <" (~ sample1S) (~ sample0S)))) (case> (#e.Success valueV) (:coerce Bit valueV) _ - false))) + #0))) (test "Can get length of text." (|> (run (` ("lux text size" (~ sample0S)))) (case> (#e.Success valueV) (n/= sample-size (:coerce Nat valueV)) _ - false))) + #0))) (test "Can concatenate text." (|> (run (` ("lux text size" (~ concatenatedS)))) (case> (#e.Success valueV) (n/= (n/* +2 sample-size) (:coerce Nat valueV)) _ - false))) + #0))) (test "Can find index of sub-text." (and (|> (run (` ("lux text index" (~ concatenatedS) (~ sample0S) +0))) (case> (^multi (#e.Success valueV) @@ -240,14 +240,14 @@ (n/= +0 valueV) _ - false)) + #0)) (|> (run (` ("lux text index" (~ concatenatedS) (~ sample1S) +0))) (case> (^multi (#e.Success valueV) [(:coerce (Maybe Nat) valueV) (#.Some valueV)]) (n/= sample-size valueV) _ - false)))) + #0)))) (let [test-clip (function (_ from to expected) (|> (run (` ("lux text clip" (~ concatenatedS) @@ -258,7 +258,7 @@ (text/= expected valueV) _ - false)))] + #0)))] (test "Can clip text to extract sub-text." (and (test-clip +0 sample-size sample0) (test-clip sample-size (n/* +2 sample-size) sample1)))) @@ -272,7 +272,7 @@ sample0) _ - false))) + #0))) ))) (def: (array-spec run) @@ -291,22 +291,22 @@ (#e.Error error) (exec (log! error) - false)))) + #0)))) (test "Can get element from array (if it exists)." (and (|> (run (` ("lux array get" (~ array0S) (~ (code.nat idx))))) (case> (^multi (#e.Success valueV) [(:coerce (Maybe Nat) valueV) #.None]) - true + #1 _ - false)) + #0)) (|> (run (` ("lux array get" (~ array1S) (~ (code.nat idx))))) (case> (^multi (#e.Success valueV) [(:coerce (Maybe Nat) valueV) (#.Some valueV)]) (n/= value valueV) _ - false)))) + #0)))) (test "Can remove element from array." (|> (run (` ("lux array get" ("lux array remove" (~ array1S) @@ -314,10 +314,10 @@ (~ (code.nat idx))))) (case> (^multi (#e.Success valueV) [(:coerce (Maybe Nat) valueV) #.None]) - true + #1 _ - false))) + #0))) ))) (def: (math-spec run) @@ -330,11 +330,11 @@ [(test (format "Can apply '" <name> "' procedure.") (|> (run (` (<name> (~ (code.frac subject))))) (case> (#e.Success valueV) - true + #1 (#e.Error error) (exec (log! error) - false))))] + #0))))] ["lux math cos"] ["lux math sin"] @@ -350,11 +350,11 @@ [(test (format "Can apply '" <name> "' procedure.") (|> (run (` (<name> (~ (code.frac subject)) (~ (code.frac param))))) (case> (#e.Success valueV) - true + #1 (#e.Error error) (exec (log! error) - false))))] + #0))))] ["lux math pow"])) )))) @@ -367,11 +367,11 @@ (test "Can log messages." (|> (run (` ("lux io log" (~ (code.text (format "LOG: " message)))))) (case> (#e.Success valueV) - true + #1 (#e.Error error) (exec (log! error) - false)))) + #0)))) (test "Can throw runtime errors." (and (|> (run (` ("lux try" ("lux function" +1 [] ("lux io error" (~ (code.text message))))))) @@ -380,7 +380,7 @@ (text.contains? message error) _ - false)) + #0)) (|> (run (` ("lux try" ("lux function" +1 [] (~ (code.text message)))))) (case> (^multi (#e.Success valueV) @@ -388,7 +388,7 @@ (text/= message valueV) _ - false)))) + #0)))) (test "Can obtain current time in milli-seconds." (|> (run (` [("lux io current-time") ("lux io current-time")])) (case> (#e.Success valueV) @@ -397,7 +397,7 @@ (#e.Error error) (exec (log! error) - false)))) + #0)))) ))) (def: (atom-spec run) @@ -416,7 +416,7 @@ (#e.Error error) (exec (log! error) - false)))) + #0)))) (test "Can compare-and-swap atoms." (and (|> (run (` ("lux let" +0 (~ preS) ("lux let" +1 ("lux atom new" (0)) @@ -429,7 +429,7 @@ (#e.Error error) (exec (log! error) - false))) + #0))) (|> (run (` ("lux let" +0 (~ preS) ("lux let" +1 ("lux atom new" (0)) [("lux atom compare-and-swap" (1) (~ postS) (~ postS)) @@ -441,7 +441,7 @@ (#e.Error error) (exec (log! error) - false))))) + #0))))) ))) (def: (box-spec run) @@ -460,7 +460,7 @@ (#e.Error error) (exec (log! error) - false)))) + #0)))) (test "Can write boxes." (|> (run (` ("lux let" +0 (~ boxS) ("lux let" +1 ("lux box write" (~ postS) (0)) @@ -470,7 +470,7 @@ (#e.Error error) (exec (log! error) - false)))) + #0)))) ))) (def: (process-spec run) @@ -483,7 +483,7 @@ (#e.Error error) (exec (log! error) - false)))) + #0)))) (do r.Monad<Random> [delay (|> r.nat (:: @ map (n/% +10))) message (r.text +5)] @@ -493,11 +493,11 @@ ("lux function" +1 [] ("lux io log" (~ (code.text (format "SCHEDULE: " message)))))))) (case> (#e.Success valueV) - true + #1 (#e.Error error) (exec (log! error) - false))))) + #0))))) )) (def: (all-specs run) diff --git a/new-luxc/test/test/luxc/lang/translation/function.lux b/new-luxc/test/test/luxc/lang/translation/function.lux index fd96aeeb9..9eb25d380 100644 --- a/new-luxc/test/test/luxc/lang/translation/function.lux +++ b/new-luxc/test/test/luxc/lang/translation/function.lux @@ -55,7 +55,7 @@ (#e.Error error) (exec (log! error) - false)))) + #0)))) (test "Can partially apply functions." (or (n/= +1 arity) (let [partial-arity (n/inc cut-off) @@ -69,7 +69,7 @@ (#e.Error error) (exec (log! error) - false)))))) + #0)))))) (test "Can read environment." (or (n/= +1 arity) (let [env (|> (list.n/range +0 cut-off) @@ -88,7 +88,7 @@ (#e.Error error) (exec (log! error) - false)))))) + #0)))))) ))) (context: "[JVM] Function." diff --git a/new-luxc/test/test/luxc/lang/translation/js.lux b/new-luxc/test/test/luxc/lang/translation/js.lux index 42947b580..8175e82fc 100644 --- a/new-luxc/test/test/luxc/lang/translation/js.lux +++ b/new-luxc/test/test/luxc/lang/translation/js.lux @@ -26,7 +26,7 @@ (:coerce Bit valueV) _ - false))) + #0))) (type: Check (-> (e.Error Any) Bit)) @@ -37,7 +37,7 @@ (<=> (<pre> angle) (:coerce <type> valueV)) (#e.Error error) - false)))] + #0)))] [sin-check Frac math.sin f/=] [length-check Nat id n/=] @@ -75,10 +75,10 @@ (|> (run-js (` ("js object get" (~ field) (~ empty-object)))) (case> (^multi (#e.Success valueV) [(:coerce (Maybe Int) valueV) #.None]) - true + #1 _ - false))) + #0))) (test "Can get fields from objects." (|> (run-js (` ("js object get" (~ field) (~ object)))) (case> (^multi (#e.Success valueV) @@ -86,16 +86,16 @@ (i/= value (:coerce Int valueV)) _ - false))) + #0))) (test "Can delete fields from objects." (|> (run-js (let [post-delete (` ("js object delete" (~ field) (~ object)))] (` ("js object get" (~ field) (~ post-delete))))) (case> (^multi (#e.Success valueV) [(:coerce (Maybe Int) valueV) #.None]) - true + #1 _ - false))) + #0))) (test "Can instance new objects." (let [base (` ("js object new" ("js global" "Number") (~ (code.text (%f frac-value)))))] (|> (run-js (` ("lux frac +" (~ base) 0.0))) @@ -103,7 +103,7 @@ (f/= frac-value (:coerce Frac valueV)) (#e.Error error) - false)))) + #0)))) (test "Can call methods on objects." (|> (run-js (` ("js object call" ("js global" "Math") "sin" (~ (code.text (%f frac-value)))))) (sin-check frac-value))) @@ -130,7 +130,7 @@ (n/= reference sample) _ - false))) + #0))) (test "Can write an element into an array." (let [idxS (code.nat idx) overwriteS (code.nat overwrite)] @@ -142,7 +142,7 @@ (n/= overwrite sample) _ - false)))) + #0)))) (test "Can delete an element from an array." (let [idxS (code.nat idx) deleteS (` ("js array delete" (~ idxS) (~ arrayS)))] @@ -152,9 +152,9 @@ (case> (^multi (#e.Success elemV) [(:coerce (Maybe Nat) elemV) #.None]) - true + #1 _ - false)) + #0)) ))) )))) diff --git a/new-luxc/test/test/luxc/lang/translation/jvm.lux b/new-luxc/test/test/luxc/lang/translation/jvm.lux index 34f1af508..f31496b08 100644 --- a/new-luxc/test/test/luxc/lang/translation/jvm.lux +++ b/new-luxc/test/test/luxc/lang/translation/jvm.lux @@ -40,7 +40,7 @@ (<test> <sample> (:coerce <cast> valueT)) (#e.Error error) - false)))] + #0)))] ["jvm convert double-to-float" "jvm convert float-to-double" code.frac frac-sample Frac f/=] ["jvm convert double-to-int" "jvm convert int-to-double" code.frac frac-sample Frac f/=] @@ -72,7 +72,7 @@ (<test> <sample> (:coerce <cast> valueT)) (#e.Error error) - false)))] + #0)))] ["jvm convert long-to-int" "jvm convert int-to-char" "jvm convert char-to-long" code.int int-sample Int i/=] ["jvm convert long-to-int" "jvm convert int-to-byte" "jvm convert byte-to-long" code.int int-sample Int i/=] @@ -99,7 +99,7 @@ (<test> <sample> (:coerce <cast> valueT)) (#e.Error error) - false)))] + #0)))] ["jvm convert long-to-int" "jvm convert int-to-char" "jvm convert char-to-byte" "jvm convert byte-to-long" code.int int-sample Int i/=] ["jvm convert long-to-int" "jvm convert int-to-char" "jvm convert char-to-short" "jvm convert short-to-long" code.int int-sample Int i/=] @@ -141,7 +141,7 @@ (:coerce <type> valueT)) (#e.Error error) - false)))] + #0)))] [(format "jvm " <domain> " +") <+>] [(format "jvm " <domain> " -") <->] @@ -180,7 +180,7 @@ (:coerce Nat valueT)) (#e.Error error) - false)))] + #0)))] [(format "jvm " <domain> " and") bit.and] [(format "jvm " <domain> " or") bit.or] @@ -214,7 +214,7 @@ (:coerce <type> valueT)) (#e.Error error) - false)))] + #0)))] [(format "jvm " <domain> " shl") bit.left-shift Nat n/= id code.nat] [(format "jvm " <domain> " shr") bit.arithmetic-right-shift Int i/= nat-to-int (|>> nat-to-int code.int)] @@ -246,7 +246,7 @@ (:coerce Bit valueT)) (#e.Error error) - false)))] + #0)))] [(format "jvm " <domain> " =") <=>] [(format "jvm " <domain> " <") <<>] @@ -301,7 +301,7 @@ (<test> <value> (:coerce <type> outputZ)) (#e.Error error) - false)))] + #0)))] ["boolean" Bit valueZ bit/= (code.bit valueZ) id] @@ -349,7 +349,7 @@ (<test> <value> (:coerce <type> outputT)) (#e.Error error) - false)))] + #0)))] ["char" Int valueC i/= (|> (code.int valueC) (~) "jvm convert long-to-int" "jvm convert int-to-char" (`)) @@ -377,7 +377,7 @@ (f/= valueD (:coerce Frac outputT)) (#e.Error error) - false))) + #0))) (test "jvm array length" (|> (do macro.Monad<Meta> [sampleI (expressionT.translate (` ("jvm array length" ("jvm array new" +0 "java.lang.Object" (~ (code.nat size))))))] @@ -388,7 +388,7 @@ (n/= size (:coerce Nat outputT)) (#e.Error error) - false))) + #0))) ))))) (host.import: java/lang/Class @@ -439,7 +439,7 @@ (:coerce Bit outputT) (#e.Error error) - false))) + #0))) (test "jvm object null?" (|> (do macro.Monad<Meta> [sampleI (expressionT.translate (` ("jvm object null?" (~ (code.int sample)))))] @@ -450,7 +450,7 @@ (not (:coerce Bit outputT)) (#e.Error error) - false))) + #0))) (test "jvm object synchronized" (|> (do macro.Monad<Meta> [sampleI (expressionT.translate (` ("jvm object synchronized" (~ (code.int monitor)) (~ (code.int sample)))))] @@ -461,7 +461,7 @@ (i/= sample (:coerce Int outputT)) (#e.Error error) - false))) + #0))) (test "jvm object throw" (|> (do macro.Monad<Meta> [_ runtimeT.translate @@ -478,10 +478,10 @@ (text.contains? exception-message error) (#e.Success outputT) - false) + #0) (#e.Error error) - false))) + #0))) (test "jvm object class" (|> (do macro.Monad<Meta> [sampleI (expressionT.translate (` ("jvm object class" (~ (code.text class)))))] @@ -492,7 +492,7 @@ (|> outputT (:coerce Class) (Class::getName []) (text/= class)) (#e.Error error) - false))) + #0))) (test "jvm object instance?" (|> (do macro.Monad<Meta> [sampleI (expressionT.translate (` ("jvm object instance?" (~ (code.text instance-class)) (~ instance))))] @@ -503,7 +503,7 @@ (:coerce Bit outputT) (#e.Error error) - false))) + #0))) )))) (host.import: java/util/GregorianCalendar @@ -535,7 +535,7 @@ (i/= GregorianCalendar::AD (:coerce Int outputT)) (#e.Error error) - false))) + #0))) (test "jvm member static put" (|> (do macro.Monad<Meta> [sampleI (expressionT.translate (` ("jvm member static put" "java.awt.datatransfer.DataFlavor" "allHtmlFlavor" "java.awt.datatransfer.DataFlavor" @@ -547,7 +547,7 @@ (is? hostL.unit (:coerce Text outputT)) (#e.Error error) - false))) + #0))) (test "jvm member virtual get" (|> (do macro.Monad<Meta> [sampleI (expressionT.translate (` ("jvm member virtual get" "org.omg.CORBA.ValueMember" "name" "java.lang.String" (~ value-memberS))))] @@ -558,7 +558,7 @@ (text/= sample-string (:coerce Text outputT)) (#e.Error error) - false))) + #0))) (test "jvm member virtual put" (|> (do macro.Monad<Meta> [sampleI (expressionT.translate (` ("jvm member virtual get" "org.omg.CORBA.ValueMember" "name" "java.lang.String" @@ -571,7 +571,7 @@ (text/= other-sample-string (:coerce Text outputT)) (#e.Error error) - false))) + #0))) )))) (host.import: java/lang/Object) @@ -600,7 +600,7 @@ (i/= sample (:coerce Int outputT)) (#e.Error error) - false))) + #0))) (test "jvm member invoke virtual" (|> (do macro.Monad<Meta> [sampleI (expressionT.translate (` ("jvm object cast" "boolean" "java.lang.Boolean" @@ -613,7 +613,7 @@ (:coerce Bit outputT) (#e.Error error) - false))) + #0))) (test "jvm member invoke interface" (|> (do macro.Monad<Meta> [sampleI (expressionT.translate (` ("jvm object cast" "boolean" "java.lang.Boolean" @@ -626,7 +626,7 @@ (:coerce Bit outputT) (#e.Error error) - false))) + #0))) (test "jvm member invoke constructor" (|> (do macro.Monad<Meta> [sampleI (expressionT.translate array-listS)] @@ -637,5 +637,5 @@ (host.instance? ArrayList (:coerce Object outputT)) (#e.Error error) - false))) + #0))) )))) diff --git a/new-luxc/test/test/luxc/lang/translation/primitive.lux b/new-luxc/test/test/luxc/lang/translation/primitive.lux index a58b3b97e..14a887873 100644 --- a/new-luxc/test/test/luxc/lang/translation/primitive.lux +++ b/new-luxc/test/test/luxc/lang/translation/primitive.lux @@ -31,7 +31,7 @@ (#e.Error error) (exec (log! error) - false))))] + #0))))] ["bit" Bit //synthesis.bit %bit% bit/=] ["int" Int //synthesis.i64 %int% i/=] diff --git a/new-luxc/test/test/luxc/lang/translation/reference.lux b/new-luxc/test/test/luxc/lang/translation/reference.lux index 17cd78d54..66dd8de9f 100644 --- a/new-luxc/test/test/luxc/lang/translation/reference.lux +++ b/new-luxc/test/test/luxc/lang/translation/reference.lux @@ -39,7 +39,7 @@ (#e.Error error) (exec (log! error) - false)))))) + #0)))))) (def: (variables-spec run) (-> Runner Test) @@ -55,7 +55,7 @@ (#e.Error error) (exec (log! error) - false)))))) + #0)))))) (def: (references-spec run define) (-> Runner Definer Test) diff --git a/new-luxc/test/test/luxc/lang/translation/structure.lux b/new-luxc/test/test/luxc/lang/translation/structure.lux index 17068bb72..3251844b7 100644 --- a/new-luxc/test/test/luxc/lang/translation/structure.lux +++ b/new-luxc/test/test/luxc/lang/translation/structure.lux @@ -38,7 +38,7 @@ (#e.Error error) (exec (log! error) - false)))))) + #0)))))) (def: (variants-spec run) (-> Runner Test) @@ -69,7 +69,7 @@ (#e.Error error) (exec (log! error) - false)))))) + #0)))))) (def: (structure-spec run) (-> Runner Test) |