From ce71205758372cad17e09ac1b4b31dc4cea63528 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 27 Apr 2019 01:03:52 -0400 Subject: Ported tests for type analysis. --- new-luxc/test/test/luxc/lang/analysis/type.lux | 93 -------------------------- 1 file changed, 93 deletions(-) delete mode 100644 new-luxc/test/test/luxc/lang/analysis/type.lux (limited to 'new-luxc/test') diff --git a/new-luxc/test/test/luxc/lang/analysis/type.lux b/new-luxc/test/test/luxc/lang/analysis/type.lux deleted file mode 100644 index dc1a0fea9..000000000 --- a/new-luxc/test/test/luxc/lang/analysis/type.lux +++ /dev/null @@ -1,93 +0,0 @@ -(.module: - lux - (lux [io] - (control [monad #+ do] - pipe) - (data [bit "bit/" Eq] - [text "text/" Eq] - (text format - ["l" lexer]) - [number] - ["e" error] - [product] - (coll [list "list/" Functor Fold])) - ["r" math/random "r/" Monad] - [macro #+ Monad] - (macro [code]) - (lang [type "type/" Eq]) - test) - (luxc ["&" lang] - (lang ["&." module] - ["~" analysis] - (analysis [".A" expression] - ["@" type] - ["@." common]) - (translation (jvm ["@." runtime])) - [eval])) - (// common) - (test/luxc common)) - -(def: check - (r.Random [Code Type Code]) - (with-expansions [ (template [ ] - [(do r.Monad - [value ] - (wrap [(` ) - - ( value)]))] - - [r.bit (+0 "#Bit" (+0)) code.bit] - [r.nat (+0 "#Nat" (+0)) code.nat] - [r.int (+0 "#Int" (+0)) code.int] - [r.rev (+0 "#Rev" (+0)) code.rev] - [r.frac (+0 "#Frac" (+0)) code.frac] - [(r.text +5) (+0 "#Text" (+0)) code.text] - )] - ($_ r.either - ))) - -(context: "Type checking/coercion." - (<| (times +100) - (do @ - [[typeC codeT exprC] check] - ($_ seq - (test (format "Can analyse type-checking.") - (|> (do Monad - [runtime-bytecode @runtime.translate] - (&.with-scope - (@common.with-unknown-type - (@.analyse-check analyse eval.eval typeC exprC)))) - (&.with-current-module "") - (macro.run (io.run init-jvm)) - (case> (#e.Success [_ [analysisT analysisA]]) - (and (type/= codeT analysisT) - (case [exprC analysisA] - (^template [ ] - [[_ ( expected)] [_ ( actual)]] - ( expected actual)) - ([#.Bit bit/=] - [#.Nat n/=] - [#.Int i/=] - [#.Rev r/=] - [#.Frac f/=] - [#.Text text/=]) - - _ - #0)) - - (#e.Error error) - #0))) - (test (format "Can analyse type-coercion.") - (|> (do Monad - [runtime-bytecode @runtime.translate] - (&.with-scope - (@common.with-unknown-type - (@.analyse-coerce analyse eval.eval typeC exprC)))) - (&.with-current-module "") - (macro.run (io.run init-jvm)) - (case> (#e.Success [_ [analysisT analysisA]]) - (type/= codeT analysisT) - - (#e.Error error) - #0))) - )))) -- cgit v1.2.3