diff options
author | Eduardo Julian | 2023-01-08 02:13:36 -0400 |
---|---|---|
committer | Eduardo Julian | 2023-01-08 02:13:36 -0400 |
commit | 617069b3986e9271d6e73191b899aa914e430dd6 (patch) | |
tree | 7a4255a4eb1460a58b64161a8200486a756265bc /stdlib/source/test | |
parent | ae2d5697d93a45dcbff768c32c4dc8fb291096cd (diff) |
Moved compiler target machinery under meta/compiler.
Diffstat (limited to 'stdlib/source/test')
27 files changed, 257 insertions, 154 deletions
diff --git a/stdlib/source/test/aedifex/cli.lux b/stdlib/source/test/aedifex/cli.lux index 90550b004..6afd9a84c 100644 --- a/stdlib/source/test/aedifex/cli.lux +++ b/stdlib/source/test/aedifex/cli.lux @@ -106,7 +106,11 @@ (def .public test Test (<| (_.covering /._) - (_.for [/.Compilation /.Command] + (_.for [/.Compilation + /.#Build /.#Test + + /.Command + /.#Version /.#Clean /.#POM /.#Dependencies /.#Install /.#Deploy /.#Compilation /.#Auto] (all _.and (_.for [/.equivalence] (equivalenceT.spec /.equivalence ..command)) diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index be6350aa8..7fe85af8e 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -29,7 +29,6 @@ ["f" frac] ["[0]" i64]]] ["[0]" meta (.use "[1]#[0]" monad) - ["@" target] ["[0]" static] ["[0]" location (.use "[1]#[0]" equivalence)] ["[0]" code (.use "[1]#[0]" equivalence) @@ -37,7 +36,9 @@ ["[0]" macro (.only) [syntax (.only syntax)] ["^" pattern] - ["[0]" template]]] + ["[0]" template]] + [compiler + ["@" target]]] [test ["_" property (.only Test)]]]] ... TODO: Must have 100% coverage on tests. diff --git a/stdlib/source/test/lux/abstract/equivalence.lux b/stdlib/source/test/lux/abstract/equivalence.lux index fffb537ad..56e22b921 100644 --- a/stdlib/source/test/lux/abstract/equivalence.lux +++ b/stdlib/source/test/lux/abstract/equivalence.lux @@ -19,7 +19,8 @@ ["n" nat] ["i" int]]] [meta - ["@" target]] + [compiler + ["@" target]]] [test ["_" property (.only Test)]]]] ["[0]" \\polytypic] diff --git a/stdlib/source/test/lux/abstract/functor.lux b/stdlib/source/test/lux/abstract/functor.lux index da06b6eaf..c30a974b2 100644 --- a/stdlib/source/test/lux/abstract/functor.lux +++ b/stdlib/source/test/lux/abstract/functor.lux @@ -17,7 +17,8 @@ [number ["n" nat]]] [meta - ["@" target]] + [compiler + ["@" target]]] [test ["_" property (.only Test)]]]] ["[0]" \\polytypic] diff --git a/stdlib/source/test/lux/control/concurrency/async.lux b/stdlib/source/test/lux/control/concurrency/async.lux index efa1e26dc..b043efcff 100644 --- a/stdlib/source/test/lux/control/concurrency/async.lux +++ b/stdlib/source/test/lux/control/concurrency/async.lux @@ -17,7 +17,8 @@ ["i" int] ["[0]" i64]]] [meta - ["@" target]] + [compiler + ["@" target]]] [world [time ["[0]" instant] diff --git a/stdlib/source/test/lux/control/concurrency/semaphore.lux b/stdlib/source/test/lux/control/concurrency/semaphore.lux index c14ddba68..4ff4babdc 100644 --- a/stdlib/source/test/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/test/lux/control/concurrency/semaphore.lux @@ -23,9 +23,10 @@ ["n" nat] ["[0]" i64]]] [meta - ["@" target] [type - ["[0]" refinement]]] + ["[0]" refinement]] + [compiler + ["@" target]]] [test ["_" property (.only Test)] ["[0]" unit]]]] diff --git a/stdlib/source/test/lux/data/format/json.lux b/stdlib/source/test/lux/data/format/json.lux index b97cb1afe..ee48081e4 100644 --- a/stdlib/source/test/lux/data/format/json.lux +++ b/stdlib/source/test/lux/data/format/json.lux @@ -32,13 +32,14 @@ ["[0]" i64] ["[0]" frac]]] ["[0]" meta (.only) - ["@" target] ["[0]" code] ["[0]" macro (.only) ["^" pattern] ["[0]" syntax (.only syntax)]] [type - ["[0]" unit]]] + ["[0]" unit]] + [compiler + ["@" target]]] [world [time ["[0]" date] diff --git a/stdlib/source/test/lux/debug.lux b/stdlib/source/test/lux/debug.lux index 870809042..ed4e44d29 100644 --- a/stdlib/source/test/lux/debug.lux +++ b/stdlib/source/test/lux/debug.lux @@ -23,12 +23,13 @@ [number [ratio (.only Ratio)]]] [meta - ["@" target] ["[0]" code (.only) ["<[1]>" \\parser]] [macro [syntax (.only syntax)] - ["[0]" expansion]]] + ["[0]" expansion]] + [compiler + ["@" target]]] [world [time (.only Time) [instant (.only Instant)] diff --git a/stdlib/source/test/lux/ffi.jvm.lux b/stdlib/source/test/lux/ffi.jvm.lux index a80a7f63b..651989969 100644 --- a/stdlib/source/test/lux/ffi.jvm.lux +++ b/stdlib/source/test/lux/ffi.jvm.lux @@ -31,9 +31,10 @@ [syntax (.only syntax)] ["[0]" template] ["[0]" expansion]] - [target - ["[0]" jvm - ["[1]" type (.use "[1]#[0]" equivalence)]]]] + [compiler + [target + ["[0]" jvm + ["[1]" type (.use "[1]#[0]" equivalence)]]]]] [test ["_" property (.only Test)]]]] [\\library diff --git a/stdlib/source/test/lux/math/number/frac.lux b/stdlib/source/test/lux/math/number/frac.lux index 30fd2d64c..75b68ea26 100644 --- a/stdlib/source/test/lux/math/number/frac.lux +++ b/stdlib/source/test/lux/math/number/frac.lux @@ -21,9 +21,10 @@ ["[0]" arithmetic ["[1]T" \\test]]] [meta - ["@" target] [macro - ["[0]" template]]] + ["[0]" template]] + [compiler + ["@" target]]] [test ["_" property (.only Test)]]]] [\\library diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux index fe12454a0..bb5da38b8 100644 --- a/stdlib/source/test/lux/meta.lux +++ b/stdlib/source/test/lux/meta.lux @@ -1,63 +1,56 @@ -(.`` (.`` (.require - [library - [lux (.except) - [abstract - [equivalence (.only Equivalence)] - ["[0]" monad (.only do) - ["[1]T" \\test]] - ["[0]" functor - ["[1]T" \\test (.only Injection Comparison)]] - ["[0]" apply - ["[1]T" \\test]]] - [control - ["[0]" maybe] - ["[0]" try (.only Try) (.use "[1]#[0]" functor)]] - [data - ["[0]" product] - ["[0]" bit (.use "[1]#[0]" equivalence)] - ["[0]" text (.use "[1]#[0]" equivalence) - ["%" \\format (.only format)]] - [collection - ["[0]" list (.use "[1]#[0]" functor monoid)] - ["[0]" set]]] - [math - ["[0]" random (.only Random)] - [number - ["n" nat]]] - [meta - ["@" target] - ["[0]" location] - ["[0]" symbol (.use "[1]#[0]" equivalence)] - [macro - ["^" pattern]]] - [test - ["_" property (.only Test)]]]] - [\\library - ["[0]" / (.only) - ["[0]" type (.use "[1]#[0]" equivalence)]]] - ["[0]" / - ["[1][0]" code] - ["[1][0]" location] - ["[1][0]" symbol] - ["[1][0]" configuration] - ["[1][0]" version] - ["[1][0]" type] - ["[1][0]" macro] - ["[1][0]" static] - ["[1][0]" extension] - ["[1][0]" global] - ["[1][0]" target (.only) - (.,, (.for "{old}" (.,, (.these ["[1]/[0]" jvm])) - "JVM" (.,, (.these ["[1]/[0]" jvm])) - "JavaScript" (.,, (.these ["[1]/[0]" js])) - "Lua" (.,, (.these ["[1]/[0]" lua])) - "Python" (.,, (.these ["[1]/[0]" python])) - "Ruby" (.,, (.these ["[1]/[0]" ruby])) - (.,, (.these))))] - ["[1][0]" compiler - ... ["[1]/[0]" phase] - ] - ]))) +(.require + [library + [lux (.except) + [abstract + [equivalence (.only Equivalence)] + ["[0]" monad (.only do) + ["[1]T" \\test]] + ["[0]" functor + ["[1]T" \\test (.only Injection Comparison)]] + ["[0]" apply + ["[1]T" \\test]]] + [control + ["[0]" maybe] + ["[0]" try (.only Try) (.use "[1]#[0]" functor)]] + [data + ["[0]" product] + ["[0]" bit (.use "[1]#[0]" equivalence)] + ["[0]" text (.use "[1]#[0]" equivalence) + ["%" \\format (.only format)]] + [collection + ["[0]" list (.use "[1]#[0]" functor monoid)] + ["[0]" set]]] + [math + ["[0]" random (.only Random)] + [number + ["n" nat]]] + [meta + ["[0]" location] + ["[0]" symbol (.use "[1]#[0]" equivalence)] + [macro + ["^" pattern]] + [compiler + ["@" target]]] + [test + ["_" property (.only Test)]]]] + [\\library + ["[0]" / (.only) + ["[0]" type (.use "[1]#[0]" equivalence)]]] + ["[0]" / + ["[1][0]" code] + ["[1][0]" location] + ["[1][0]" symbol] + ["[1][0]" configuration] + ["[1][0]" version] + ["[1][0]" type] + ["[1][0]" macro] + ["[1][0]" static] + ["[1][0]" extension] + ["[1][0]" global] + ["[1][0]" compiler + ... ["[1]/[0]" phase] + ] + ]) (def !expect (template (_ <pattern> <value>) @@ -1049,13 +1042,6 @@ /type.test /macro.test /static.test - /target.test - (,, (for @.jvm (,, (these /target/jvm.test)) - @.old (,, (these /target/jvm.test)) - @.js (,, (these /target/js.test)) - @.lua (,, (these /target/lua.test)) - @.python (,, (these /target/python.test)) - @.ruby (,, (these /target/ruby.test)))) (,, (for @.old (,, (these)) (,, (these /extension.test)))) /global.test diff --git a/stdlib/source/test/lux/meta/compiler.lux b/stdlib/source/test/lux/meta/compiler.lux index 58ac3c8a3..1f60bd4f4 100644 --- a/stdlib/source/test/lux/meta/compiler.lux +++ b/stdlib/source/test/lux/meta/compiler.lux @@ -1,36 +1,55 @@ -(.require - [library - [lux (.except) - [abstract - [monad (.only do)]] - [math - ["[0]" random (.only Random)]] - [test - ["_" property (.only Test)]]]] - [\\library - ["[0]" /]] - ["[0]" / - ["[1][0]" arity] - ["[1][0]" version] - ["[1][0]" reference] - ["[1][0]" language - ["[1]/[0]" lux]] - ["[1][0]" meta]]) +(.`` (.`` (.require + [library + [lux (.except) + [abstract + [monad (.only do)]] + [math + ["[0]" random (.only Random)]] + [meta + [compiler + ["@" target]]] + [test + ["_" property (.only Test)]]]] + [\\library + ["[0]" /]] + ["[0]" / + ["[1][0]" arity] + ["[1][0]" version] + ["[1][0]" reference] + ["[1][0]" language + ["[1]/[0]" lux]] + ["[1][0]" meta] + ["[1][0]" target (.only) + (.,, (.for "{old}" (.,, (.these ["[1]/[0]" jvm])) + "JVM" (.,, (.these ["[1]/[0]" jvm])) + "JavaScript" (.,, (.these ["[1]/[0]" js])) + "Lua" (.,, (.these ["[1]/[0]" lua])) + "Python" (.,, (.these ["[1]/[0]" python])) + "Ruby" (.,, (.these ["[1]/[0]" ruby])) + (.,, (.these))))]]))) -(def .public test - Test - (<| (_.covering /._) - (do [! random.monad] - []) - (all _.and - (_.coverage [/.Code /.Parameter /.Input] - true) +(`` (`` (def .public test + Test + (<| (_.covering /._) + (do [! random.monad] + []) + (all _.and + (_.coverage [/.Code /.Parameter /.Input] + true) - /arity.test - /version.test - /reference.test - - /language/lux.test + /arity.test + /version.test + /reference.test + + /language/lux.test - /meta.test - ))) + /meta.test + + /target.test + (,, (for @.jvm (,, (these /target/jvm.test)) + @.old (,, (these /target/jvm.test)) + @.js (,, (these /target/js.test)) + @.lua (,, (these /target/lua.test)) + @.python (,, (these /target/python.test)) + @.ruby (,, (these /target/ruby.test)))) + ))))) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase.lux index 922290058..ba39fe79e 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase.lux @@ -30,7 +30,8 @@ ["[1]/[0]" jvm ["[1]/[0]" host] ["[1]/[0]" primitive] - ["[1]/[0]" type]]]]) + ["[1]/[0]" type] + ["[1]/[0]" value]]]]) (def (injection value) (All (_ of) @@ -217,4 +218,5 @@ /translation/jvm/host.test /translation/jvm/primitive.test /translation/jvm/type.test + /translation/jvm/value.test ))) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/host.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/host.lux index 698a6d326..a1553a89d 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/host.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/host.lux @@ -12,9 +12,10 @@ [math ["[0]" random (.only Random)]] [meta - [target - [jvm - ["[0]" bytecode]]]] + [compiler + [target + [jvm + ["[0]" bytecode]]]]] [test ["_" property (.only Test)]]]] [\\library diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/type.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/type.lux index e99233eca..e33aad2ab 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/type.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/type.lux @@ -6,10 +6,11 @@ [math ["[0]" random (.only Random)]] [meta - [target - [jvm - ["[0]" type (.only Type) (.use "[1]#[0]" equivalence) - [category (.only Primitive Array Class)]]]]] + [compiler + [target + [jvm + ["[0]" type (.only Type) (.use "[1]#[0]" equivalence) + [category (.only Primitive Array Class)]]]]]] [test ["_" property (.only Test)]]]] [\\library diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/value.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/value.lux new file mode 100644 index 000000000..f54f596cd --- /dev/null +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/value.lux @@ -0,0 +1,64 @@ +(.require + [library + [lux (.except) + [abstract + [monad (.only do)]] + [control + ["[0]" io] + ["[0]" try]] + [data + ["[0]" bit (.use "[1]#[0]" equivalence)] + ["[0]" text]] + [math + ["[0]" random (.only Random)] + [number + ["[0]" int (.use "[1]#[0]" equivalence)] + ["[0]" frac (.use "[1]#[0]" equivalence)]]] + [meta + [compiler + [target + [jvm + ["//" bytecode] + ["[0]" type]]]]] + [test + ["_" property (.only Test)]]]] + [\\library + ["[0]" / (.only) + [// + ["[0]" host] + ["[0]" primitive]]]]) + +(def .public test + Test + (<| (_.covering /._) + (do [! random.monad] + [expected_bit random.bit + expected_i64 random.i64 + expected_f64 random.frac + expected_text (random.lower_cased 1) + + .let [$unit [0 0]]]) + (`` (all _.and + (_.coverage [/.field] + (not (text.empty? /.field))) + (_.coverage [/.boxed /.primitive] + (and (,, (with_template [<constructor> <expected> <lux_type> <=> <jvm_type>] + [(io.run! (do io.monad + [[class_loader host] host.host] + (in (when (of host evaluate $unit [{.#None} + (all //.composite + (<constructor> <expected>) + (/.primitive <jvm_type>) + (/.boxed <jvm_type>) + )]) + {try.#Success actual} + (<=> <expected> (as <lux_type> actual)) + + {try.#Failure error} + false))))] + + [primitive.bit expected_bit Bit bit#= type.boolean] + [primitive.i64 expected_i64 Int int#= type.long] + [primitive.f64 expected_f64 Frac frac#= type.double] + )))) + )))) diff --git a/stdlib/source/test/lux/meta/compiler/meta/cli.lux b/stdlib/source/test/lux/meta/compiler/meta/cli.lux index 77f39c97b..73cbe0155 100644 --- a/stdlib/source/test/lux/meta/compiler/meta/cli.lux +++ b/stdlib/source/test/lux/meta/compiler/meta/cli.lux @@ -32,7 +32,10 @@ (def .public test Test (<| (_.covering /._) - (_.for [/.Service /.service]) + (_.for [/.Service + /.#Compilation /.#Interpretation /.#Export + + /.service]) (let [(open "list#[0]") (list.equivalence text.equivalence)]) (do [! random.monad] [amount (of ! each (|>> (n.% 5) ++) random.nat) @@ -56,7 +59,8 @@ (list#conjoint (list#each (|>> (list "--source")) sources)) (list "--target" target))]] (all _.and - (_.for [/.Compilation] + (_.for [/.Compilation + /.#host_dependencies /.#libraries /.#compilers /.#sources /.#target /.#module /.#program /.#configuration] (`` (all _.and (,, (with_template [<type> <slot> <?>] [(_.coverage [<type>] diff --git a/stdlib/source/test/lux/meta/target.lux b/stdlib/source/test/lux/meta/compiler/target.lux index 322f270e9..322f270e9 100644 --- a/stdlib/source/test/lux/meta/target.lux +++ b/stdlib/source/test/lux/meta/compiler/target.lux diff --git a/stdlib/source/test/lux/meta/target/js.lux b/stdlib/source/test/lux/meta/compiler/target/js.lux index 2ad2b03ad..2ad2b03ad 100644 --- a/stdlib/source/test/lux/meta/target/js.lux +++ b/stdlib/source/test/lux/meta/compiler/target/js.lux diff --git a/stdlib/source/test/lux/meta/target/jvm.lux b/stdlib/source/test/lux/meta/compiler/target/jvm.lux index dffacdfaa..2fed717cd 100644 --- a/stdlib/source/test/lux/meta/target/jvm.lux +++ b/stdlib/source/test/lux/meta/compiler/target/jvm.lux @@ -32,7 +32,8 @@ ["[0]" i32 (.only I32)] ["[0]" i64]]] [meta - ["@" target]] + [compiler + ["@" target]]] [test ["_" property (.only Test)]]]] [\\library diff --git a/stdlib/source/test/lux/meta/target/lua.lux b/stdlib/source/test/lux/meta/compiler/target/lua.lux index 8aa357f30..8aa357f30 100644 --- a/stdlib/source/test/lux/meta/target/lua.lux +++ b/stdlib/source/test/lux/meta/compiler/target/lua.lux diff --git a/stdlib/source/test/lux/meta/target/python.lux b/stdlib/source/test/lux/meta/compiler/target/python.lux index ac5ba6d0b..ac5ba6d0b 100644 --- a/stdlib/source/test/lux/meta/target/python.lux +++ b/stdlib/source/test/lux/meta/compiler/target/python.lux diff --git a/stdlib/source/test/lux/meta/target/ruby.lux b/stdlib/source/test/lux/meta/compiler/target/ruby.lux index 900e630e7..900e630e7 100644 --- a/stdlib/source/test/lux/meta/target/ruby.lux +++ b/stdlib/source/test/lux/meta/compiler/target/ruby.lux diff --git a/stdlib/source/test/lux/meta/extension.lux b/stdlib/source/test/lux/meta/extension.lux index f98359d94..2d3064c95 100644 --- a/stdlib/source/test/lux/meta/extension.lux +++ b/stdlib/source/test/lux/meta/extension.lux @@ -24,21 +24,21 @@ ["[0]" location] ["[0]" code ["<[1]>" \\parser]] - ["@" target (.only) - ["[0]" js] - ["[0]" python] - ["[0]" lua] - ["[0]" ruby] - ["[0]" php] - ["[0]" scheme] - (.,, (.for "JVM" (.,, (.these ["[0]" jvm - ["[1]" bytecode] - ["[0]" class] - ["[0]" version] - [encoding - ["[0]" name]]])) - (.,, (.these))))] [compiler + ["@" target (.only) + ["[0]" js] + ["[0]" python] + ["[0]" lua] + ["[0]" ruby] + ["[0]" php] + ["[0]" scheme] + (.,, (.for "JVM" (.,, (.these ["[0]" jvm + ["[1]" bytecode] + ["[0]" class] + ["[0]" version] + [encoding + ["[0]" name]]])) + (.,, (.these))))] [meta [archive ["[0]" unit]]] diff --git a/stdlib/source/test/lux/meta/static.lux b/stdlib/source/test/lux/meta/static.lux index 2b69d4cb6..07b45a09e 100644 --- a/stdlib/source/test/lux/meta/static.lux +++ b/stdlib/source/test/lux/meta/static.lux @@ -15,8 +15,9 @@ ["r" rev] ["f" frac]]] ["[0]" meta (.only) - ["@" target] - ["[0]" code]] + ["[0]" code] + [compiler + ["@" target]]] [test ["_" property (.only Test)]]]] [\\library diff --git a/stdlib/source/test/lux/world/finance/market/analysis/pivot_point.lux b/stdlib/source/test/lux/world/finance/market/analysis/pivot_point.lux index 79eb95766..e9ef7baee 100644 --- a/stdlib/source/test/lux/world/finance/market/analysis/pivot_point.lux +++ b/stdlib/source/test/lux/world/finance/market/analysis/pivot_point.lux @@ -36,13 +36,23 @@ it) (money.>= (the session.#low session) it)))) - (_.coverage [/.Central_Pivot_Range /.central_pivot_range - /.#pivot_point /.#top_central /.#bottom_central] - (let [it (/.central_pivot_range session)] - (and (money.= (/.typical_price session) - (the /.#pivot_point it)) - (money.< (the /.#top_central it) - (the /.#pivot_point it)) - (money.> (the /.#bottom_central it) - (the /.#pivot_point it))))) + (_.coverage [/.Central_Pivot_Range + /.#pivot_point /.#top_central /.#bottom_central + + /.central_pivot_range] + (let [it (/.central_pivot_range session) + + pivot_is_typical! + (money.= (/.typical_price session) + (the /.#pivot_point it)) + + all_values_are_different! + (and (not (money.= (the /.#bottom_central it) + (the /.#pivot_point it))) + (not (money.= (the /.#top_central it) + (the /.#pivot_point it))) + (not (money.= (the /.#bottom_central it) + (the /.#top_central it))))] + (and pivot_is_typical! + all_values_are_different!))) ))) diff --git a/stdlib/source/test/lux/world/time/solar.lux b/stdlib/source/test/lux/world/time/solar.lux index 069470205..5611d4d5d 100644 --- a/stdlib/source/test/lux/world/time/solar.lux +++ b/stdlib/source/test/lux/world/time/solar.lux @@ -17,7 +17,8 @@ ["n" nat] ["i" int]]] [meta - ["@" target]] + [compiler + ["@" target]]] [test ["_" property (.only Test)]]]] [\\library |