aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/aedifex
diff options
context:
space:
mode:
authorEduardo Julian2020-12-15 22:05:05 -0400
committerEduardo Julian2020-12-15 22:05:05 -0400
commitabc5c5293603229b447b8b5dfa7f3275571ad982 (patch)
tree26a5a40c6583568522ca9d3714219112e602a693 /stdlib/source/test/aedifex
parent71ade9a07f08c0d61ebd70e64c2745f1ba33cb54 (diff)
Compiling "lux syntax char case!" with TABLESWITCH instead of LOOKUPSWITCH.
Diffstat (limited to 'stdlib/source/test/aedifex')
-rw-r--r--stdlib/source/test/aedifex/artifact/type.lux14
-rw-r--r--stdlib/source/test/aedifex/metadata.lux2
-rw-r--r--stdlib/source/test/aedifex/metadata/snapshot.lux84
3 files changed, 99 insertions, 1 deletions
diff --git a/stdlib/source/test/aedifex/artifact/type.lux b/stdlib/source/test/aedifex/artifact/type.lux
index 84807a8c6..5dc1b9caa 100644
--- a/stdlib/source/test/aedifex/artifact/type.lux
+++ b/stdlib/source/test/aedifex/artifact/type.lux
@@ -11,10 +11,22 @@
["." set]
["." list]]]
[math
- ["." random (#+ Random)]]]
+ ["." random (#+ Random) ("#\." monad)]]]
{#program
["." /]})
+(def: #export random
+ (Random /.Type)
+ ($_ random.either
+ ($_ random.either
+ (random\wrap /.lux-library)
+ (random\wrap /.jvm-library))
+ ($_ random.either
+ (random\wrap /.pom)
+ (random\wrap /.md5)
+ (random\wrap /.sha-1))
+ ))
+
(def: #export test
Test
(<| (_.covering /._)
diff --git a/stdlib/source/test/aedifex/metadata.lux b/stdlib/source/test/aedifex/metadata.lux
index 5b8b47b00..6a1ac503a 100644
--- a/stdlib/source/test/aedifex/metadata.lux
+++ b/stdlib/source/test/aedifex/metadata.lux
@@ -9,6 +9,7 @@
["." random]]]
["." / #_
["#." artifact]
+ ["#." snapshot]
[//
["@." artifact]]]
{#program
@@ -29,4 +30,5 @@
)))
/artifact.test
+ /snapshot.test
)))
diff --git a/stdlib/source/test/aedifex/metadata/snapshot.lux b/stdlib/source/test/aedifex/metadata/snapshot.lux
new file mode 100644
index 000000000..e17765038
--- /dev/null
+++ b/stdlib/source/test/aedifex/metadata/snapshot.lux
@@ -0,0 +1,84 @@
+(.module:
+ [lux #*
+ ["_" test (#+ Test)]
+ [abstract
+ [monad (#+ do)]
+ {[0 #spec]
+ [/
+ ["$." equivalence]]}]
+ [control
+ ["." try ("#\." functor)]
+ [parser
+ ["<.>" xml]]]
+ [data
+ [number
+ ["n" nat]]]
+ ["." time
+ ["." date]
+ ["." year]
+ ["." month]
+ ["." instant (#+ Instant)]
+ ["." duration]]
+ [math
+ ["." random (#+ Random)]]
+ [macro
+ ["." code]]]
+ ["$." /// #_
+ [artifact
+ ["#." type]]]
+ {#program
+ ["." /]})
+
+(def: random-instant
+ (Random Instant)
+ (do {! random.monad}
+ [year (\ ! map (|>> (n.% 10,000) .int) random.nat)
+ month (\ ! map (n.% 13) random.nat)
+ day-of-month (\ ! map (n.% 29) random.nat)
+ hour (\ ! map (n.% 24) random.nat)
+ minute (\ ! map (n.% 60) random.nat)
+ second (\ ! map (n.% 60) random.nat)]
+ (wrap (try.assume
+ (do try.monad
+ [year (year.year year)
+ month (month.by-number month)
+ date (date.date year month day-of-month)
+ time (time.time
+ {#time.hour hour
+ #time.minute minute
+ #time.second second
+ #time.milli-second 0})]
+ (wrap (instant.from-date-time date time)))))))
+
+(def: random-versioning
+ (Random /.Versioning)
+ ($_ random.and
+ ..random-instant
+ random.nat
+ (random.list 5 $///type.random)
+ ))
+
+(def: #export random
+ (Random /.Metadata)
+ ($_ random.and
+ (random.ascii/alpha 5)
+ (random.ascii/alpha 5)
+ (random.ascii/alpha 5)
+ ..random-versioning))
+
+(def: #export test
+ Test
+ (<| (_.covering /._)
+ (_.for [/.Metadata])
+ ($_ _.and
+ (_.for [/.equivalence]
+ ($equivalence.spec /.equivalence ..random))
+ (do random.monad
+ [expected ..random]
+ (_.cover [/.write /.parser]
+ (|> expected
+ /.write
+ (<xml>.run /.parser)
+ (try\map (\ /.equivalence = expected))
+ (try.default false))))
+ )))