diff options
author | Eduardo Julian | 2021-06-12 01:32:40 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-06-12 01:32:40 -0400 |
commit | af3e6e2cb011dc2ad9204440990731a2f272716d (patch) | |
tree | 3521c74b05fc5b3ddddbe901d32ace87dbb6c018 /stdlib/source/test | |
parent | 8f575da5095e3b259d4eb6b6f13d3e37ef1d38e4 (diff) |
Constraining the year of the snapshot time in Aedifex.
Diffstat (limited to 'stdlib/source/test')
-rw-r--r-- | stdlib/source/test/aedifex/artifact.lux | 10 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/artifact/snapshot.lux | 8 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/artifact/snapshot/stamp.lux | 14 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/artifact/snapshot/time.lux | 12 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/artifact/snapshot/version.lux | 4 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/artifact/time.lux | 8 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/artifact/time/date.lux | 16 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/artifact/versioning.lux | 3 | ||||
-rw-r--r-- | stdlib/source/test/lux.lux | 1 | ||||
-rw-r--r-- | stdlib/source/test/lux/type.lux | 4 | ||||
-rw-r--r-- | stdlib/source/test/lux/type/variance.lux | 34 |
11 files changed, 76 insertions, 38 deletions
diff --git a/stdlib/source/test/aedifex/artifact.lux b/stdlib/source/test/aedifex/artifact.lux index 9d2cf9069..935d835bb 100644 --- a/stdlib/source/test/aedifex/artifact.lux +++ b/stdlib/source/test/aedifex/artifact.lux @@ -19,11 +19,11 @@ [net ["." uri]]]] ["." / #_ - ["#." type] ["#." extension] + ["#." snapshot] ["#." time] - ["#." versioning] - ["#." snapshot]] + ["#." type] + ["#." versioning]] {#program ["." /]}) @@ -43,9 +43,9 @@ (_.for [/.equivalence] ($equivalence.spec /.equivalence ..random)) - /type.test /extension.test + /snapshot.test /time.test + /type.test /versioning.test - /snapshot.test )))) diff --git a/stdlib/source/test/aedifex/artifact/snapshot.lux b/stdlib/source/test/aedifex/artifact/snapshot.lux index 192978ebf..d48c8f34e 100644 --- a/stdlib/source/test/aedifex/artifact/snapshot.lux +++ b/stdlib/source/test/aedifex/artifact/snapshot.lux @@ -14,10 +14,9 @@ ["." random (#+ Random) ("#\." monad)]]] ["$." / #_ ["#." build] - ["#." time] ["#." stamp] - ["#." version - ["#/." value]]] + ["#." time] + ["#." version]] {#program ["." /]}) @@ -45,8 +44,7 @@ (try.default false)))) $/build.test - $/time.test $/stamp.test + $/time.test $/version.test - $/version/value.test )))) diff --git a/stdlib/source/test/aedifex/artifact/snapshot/stamp.lux b/stdlib/source/test/aedifex/artifact/snapshot/stamp.lux index a36e5af9d..f2051d037 100644 --- a/stdlib/source/test/aedifex/artifact/snapshot/stamp.lux +++ b/stdlib/source/test/aedifex/artifact/snapshot/stamp.lux @@ -37,12 +37,10 @@ (do random.monad [expected ..random] - ($_ _.and - (_.cover [/.format /.parser] - (|> expected - /.format - (<xml>.run /.parser) - (try\map (\ /.equivalence = expected)) - (try.default false))) - )) + (_.cover [/.format /.parser] + (|> expected + /.format + (<xml>.run /.parser) + (try\map (\ /.equivalence = expected)) + (try.default false)))) ))) diff --git a/stdlib/source/test/aedifex/artifact/snapshot/time.lux b/stdlib/source/test/aedifex/artifact/snapshot/time.lux index 567c70ce4..3acb37232 100644 --- a/stdlib/source/test/aedifex/artifact/snapshot/time.lux +++ b/stdlib/source/test/aedifex/artifact/snapshot/time.lux @@ -11,15 +11,15 @@ [parser ["<.>" text]]] [math - ["." random (#+ Random)]] - [time - ["." instant]]] + ["." random (#+ Random)]]] {#program - ["." /]}) + ["." /]} + ["$." /// #_ + ["#." time]]) (def: #export random (Random /.Time) - random.instant) + $///time.random) (def: #export test Test @@ -36,7 +36,7 @@ (|> expected /.format (<text>.run /.parser) - (try\map (\ instant.equivalence = expected)) + (try\map (\ /.equivalence = expected)) (try.default false))) )) ))) diff --git a/stdlib/source/test/aedifex/artifact/snapshot/version.lux b/stdlib/source/test/aedifex/artifact/snapshot/version.lux index e08691c3c..59ed7189f 100644 --- a/stdlib/source/test/aedifex/artifact/snapshot/version.lux +++ b/stdlib/source/test/aedifex/artifact/snapshot/version.lux @@ -14,6 +14,8 @@ ["." random (#+ Random)]]] {#program ["." /]} + ["." / #_ + ["#." value]] ["$." /// #_ ["#." type] ["#." time]]) @@ -43,4 +45,6 @@ (<xml>.run /.parser) (try\map (\ /.equivalence = expected)) (try.default false)))) + + /value.test ))) diff --git a/stdlib/source/test/aedifex/artifact/time.lux b/stdlib/source/test/aedifex/artifact/time.lux index b14032a8c..b9b0ab4e0 100644 --- a/stdlib/source/test/aedifex/artifact/time.lux +++ b/stdlib/source/test/aedifex/artifact/time.lux @@ -13,9 +13,7 @@ [math ["." random (#+ Random)] [number - ["i" int]]] - [time - ["." instant]]] + ["i" int]]]] {#program ["." /]} ["." / #_ @@ -27,7 +25,7 @@ (do random.monad [date /date.random time /time.random] - (wrap (instant.from_date_time date time)))) + (wrap [date time]))) (def: #export test Test @@ -43,7 +41,7 @@ (|> expected /.format (<text>.run /.parser) - (try\map (\ instant.equivalence = expected)) + (try\map (\ /.equivalence = expected)) (try.default false)))) /date.test diff --git a/stdlib/source/test/aedifex/artifact/time/date.lux b/stdlib/source/test/aedifex/artifact/time/date.lux index 932d1698e..a68a60a56 100644 --- a/stdlib/source/test/aedifex/artifact/time/date.lux +++ b/stdlib/source/test/aedifex/artifact/time/date.lux @@ -13,25 +13,27 @@ ["n" nat] ["i" int]]] [time - ["." date (#+ Date)] + ["." date] ["." year]]] {#program ["." /]}) (def: #export random - (Random Date) + (Random /.Date) (random.one (function (_ raw) (try.to_maybe (do try.monad - [year (|> raw date.year year.value i.abs (i.% +9,000) (i.+ +1,000) year.year)] - (date.date year - (date.month raw) - (date.day_of_month raw))))) + [year (|> raw date.year year.value i.abs (i.% +9,000) (i.+ +1,000) year.year) + raw (date.date year + (date.month raw) + (date.day_of_month raw))] + (/.date raw)))) random.date)) (def: #export test Test (<| (_.covering /._) + (_.for [/.Date]) ($_ _.and (do random.monad [expected ..random] @@ -39,6 +41,6 @@ (|> expected /.format (<text>.run /.parser) - (try\map (\ date.equivalence = expected)) + (try\map (\ /.equivalence = expected)) (try.default false)))) ))) diff --git a/stdlib/source/test/aedifex/artifact/versioning.lux b/stdlib/source/test/aedifex/artifact/versioning.lux index ab0e94236..c438caca5 100644 --- a/stdlib/source/test/aedifex/artifact/versioning.lux +++ b/stdlib/source/test/aedifex/artifact/versioning.lux @@ -15,6 +15,7 @@ {#program ["." /]} ["$." // #_ + ["#." time] ["#." snapshot ["#/." version]]]) @@ -22,7 +23,7 @@ (Random /.Versioning) ($_ random.and $//snapshot.random - random.instant + $//time.random (random.list 5 $//snapshot/version.random) )) diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index d305c19c9..ad63d30cb 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -7,6 +7,7 @@ [program (#+ program:)] ["_" test (#+ Test)] ["@" target] + ["." debug] [abstract [monad (#+ do)] [predicate (#+ Predicate)]] diff --git a/stdlib/source/test/lux/type.lux b/stdlib/source/test/lux/type.lux index 654aeb748..b881aec70 100644 --- a/stdlib/source/test/lux/type.lux +++ b/stdlib/source/test/lux/type.lux @@ -24,7 +24,8 @@ ["#." quotient] ["#." refinement] ["#." resource] - ["#." unit]]) + ["#." unit] + ["#." variance]]) (def: short (Random Text) @@ -178,4 +179,5 @@ /refinement.test /resource.test /unit.test + /variance.test ))) diff --git a/stdlib/source/test/lux/type/variance.lux b/stdlib/source/test/lux/type/variance.lux new file mode 100644 index 000000000..83927d03c --- /dev/null +++ b/stdlib/source/test/lux/type/variance.lux @@ -0,0 +1,34 @@ +(.module: + [lux #* + ["_" test (#+ Test)] + [abstract + [monad (#+ do)]] + [math + ["." random (#+ Random)]]] + {1 + ["." / + ["/#" // #_ + ["#." check]]]}) + +(type: Super + (Ex [sub] [Text sub])) + +(type: Sub + (Super Bit)) + +(def: #export test + Test + (<| (_.covering /._) + ($_ _.and + (_.cover [/.Co] + (and (//check.checks? (type (/.Co Super)) (type (/.Co Sub))) + (not (//check.checks? (type (/.Co Sub)) (type (/.Co Super)))))) + (_.cover [/.Contra] + (and (//check.checks? (type (/.Contra Sub)) (type (/.Contra Super))) + (not (//check.checks? (type (/.Contra Super)) (type (/.Contra Sub)))))) + (_.cover [/.In] + (and (//check.checks? (type (/.In Super)) (type (/.In Super))) + (//check.checks? (type (/.In Sub)) (type (/.In Sub))) + (not (//check.checks? (type (/.In Sub)) (type (/.In Super)))) + (not (//check.checks? (type (/.In Super)) (type (/.In Sub)))))) + ))) |