From 51a5c28b0f9efd514e3fae7c2634fd5e9bd714e2 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 22 Jul 2021 01:16:40 -0400 Subject: New JVM compiler can now compile JVM classes. --- stdlib/source/test/lux.lux | 80 ++++++++++++++++++++++++---------------------- 1 file changed, 42 insertions(+), 38 deletions(-) (limited to 'stdlib/source/test/lux.lux') diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index cbc63d90d..20d21d74d 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -93,40 +93,6 @@ value))))) )) -(template: (quadrance cat0 cat1) - (n.+ (n.* cat0 cat0) (n.* cat1 cat1))) - -(def: templates - Test - (do random.monad - [cat0 random.nat - cat1 random.nat] - (_.test "Template application is a stand-in for the templated code." - (n.= (n.+ (n.* cat0 cat0) (n.* cat1 cat1)) - (quadrance cat0 cat1))))) - -(def: cross_platform_support - Test - (do random.monad - [on_default random.nat - on_fake_host random.nat - on_valid_host random.nat] - ($_ _.and - (_.test "Can provide default in case there is no particular host/platform support." - (n.= on_default - (for {"" on_fake_host} - on_default))) - (_.test "Can pick code depending on the host/platform being targeted." - (n.= on_valid_host - (for {@.old on_valid_host - @.jvm on_valid_host - @.js on_valid_host - @.python on_valid_host - @.lua on_valid_host - @.ruby on_valid_host - @.php on_valid_host} - on_default)))))) - (def: sub_tests Test (with_expansions [## TODO: Update & expand tests for this @@ -732,6 +698,47 @@ (not (code\= (' ) (' )))))))) +(def: for_expansion + Test + (do random.monad + [left random.nat + right random.nat + dummy random.nat + #let [expected (n.+ left right)]] + ($_ _.and + (_.cover [/.as_is] + (`` (and (~~ (as_is true + true + true))))) + (_.cover [/.with_expansions] + (/.with_expansions [ (as_is left right)] + (n.= expected + (n.+ )))) + (_.cover [/.comment] + (/.with_expansions [ (/.comment dummy) + (as_is left right)] + (n.= expected + ($_ n.+ )))) + (_.cover [/.``] + (n.= expected + (/.`` ($_ n.+ + (~~ (as_is left right)) + (~~ (/.comment dummy)))))) + (_.cover [/.for] + (and (n.= expected + (/.for {"fake host" dummy} + expected)) + (n.= expected + (/.for {@.old expected + @.jvm expected + @.js expected + @.python expected + @.lua expected + @.ruby expected + @.php expected} + dummy)))) + ))) + (def: test Test (<| (_.covering /._) @@ -740,10 +747,6 @@ ..identity) (<| (_.context "Prelude macros.") ..prelude_macros) - (<| (_.context "Templates.") - ..templates) - (<| (_.context "Cross-platform support.") - ..cross_platform_support) ..for_bit ..for_try @@ -760,6 +763,7 @@ ..for_static ..for_slot ..for_associative + ..for_expansion ..sub_tests ))) -- cgit v1.2.3