aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/world
diff options
context:
space:
mode:
authorEduardo Julian2023-01-04 18:37:14 -0400
committerEduardo Julian2023-01-04 18:37:14 -0400
commit3ca054b6b992e2233d763aabc5c938ee10d116a4 (patch)
tree90b93c5a922fa312331f33cc4c93962c76db4636 /stdlib/source/test/lux/world
parentad1391ea1cdd33167339d25dbff2567f5a8d5c68 (diff)
Added simple machinery for aliasing of definitions.
Diffstat (limited to '')
-rw-r--r--stdlib/source/test/lux/world/finance/market/price.lux106
-rw-r--r--stdlib/source/test/lux/world/locale.lux10
-rw-r--r--stdlib/source/test/lux/world/locale/language.lux6
-rw-r--r--stdlib/source/test/lux/world/locale/territory.lux6
-rw-r--r--stdlib/source/test/lux/world/net/http/version.lux6
-rw-r--r--stdlib/source/test/lux/world/net/mime.lux6
-rw-r--r--stdlib/source/test/lux/world/net/uri/scheme.lux6
-rw-r--r--stdlib/source/test/lux/world/output/video/resolution.lux6
-rw-r--r--stdlib/source/test/lux/world/time/day.lux6
-rw-r--r--stdlib/source/test/lux/world/time/instant.lux6
-rw-r--r--stdlib/source/test/lux/world/time/month.lux6
11 files changed, 81 insertions, 89 deletions
diff --git a/stdlib/source/test/lux/world/finance/market/price.lux b/stdlib/source/test/lux/world/finance/market/price.lux
index 28c0db1f5..6525ce793 100644
--- a/stdlib/source/test/lux/world/finance/market/price.lux
+++ b/stdlib/source/test/lux/world/finance/market/price.lux
@@ -14,90 +14,82 @@
["[0]" text (.only)
["%" \\format]]]
[math
- ["[0]" random (.only Random) (.use "[1]#[0]" functor)]
+ ["[0]" random (.only Random)]
[number
+ ["n" nat]
["i" int]]]
[test
["_" property (.only Test)]]]]
[\\library
["[0]" / (.only)
[///
- [money
- ["[0]" currency (.only Currency)]]]]])
+ ["[0]" money (.only)
+ ["[0]" currency (.only Currency)]]]]]
+ [///
+ ["[0]T" money]])
-(def .public (random $)
+(def .public (random $ max_sub_units)
(All (_ $)
- (-> (Currency $)
+ (-> (Currency $) Nat
(Random (/.Action $))))
- (random#each (/.action $)
- random.int))
+ (do random.monad
+ [from (moneyT.random $ max_sub_units)
+ to (moneyT.random $ max_sub_units)]
+ (in (/.action from to))))
(def .public test
Test
(<| (_.covering /._)
(do [! random.monad]
- [expected_movement random.int
+ [parameter (..random currency.usd 1000,00)
+ subject (..random currency.usd 1000,00)
- expected_parameter random.int
- expected_subject random.int])
+ from (moneyT.random currency.usd 1000,00)
+ to (moneyT.random currency.usd 1000,00)])
(_.for [/.Price /.Action])
(all _.and
(_.for [/.equivalence /.=]
- (equivalenceT.spec /.equivalence (..random currency.usd)))
+ (equivalenceT.spec /.equivalence (..random currency.usd 1000,00)))
(_.for [/.order /.<]
- (orderT.spec /.order (..random currency.usd)))
+ (orderT.spec /.order (..random currency.usd 1000,00)))
(_.coverage [/.action /.currency /.movement]
- (let [it (/.action currency.usd expected_movement)]
+ (let [it (/.action from to)]
(and (same? currency.usd (/.currency it))
- (same? expected_movement (/.movement it)))))
+ (i.= (int (n.- (money.amount from) (money.amount to)))
+ (/.movement it)))))
(_.coverage [/.+ /.-]
- (let [parameter (/.action currency.usd expected_parameter)
- subject (/.action currency.usd expected_subject)]
- (and (|> subject
- (/.+ parameter)
- (of /.equivalence = subject)
- not)
- (|> subject
- (/.+ parameter)
- (/.- parameter)
- (of /.equivalence = subject)))))
+ (and (|> subject
+ (/.+ parameter)
+ (of /.equivalence = subject)
+ not)
+ (|> subject
+ (/.+ parameter)
+ (/.- parameter)
+ (of /.equivalence = subject))))
(_.coverage [/.min]
- (let [expected_parameter (/.action currency.usd expected_parameter)
- expected_subject (/.action currency.usd expected_subject)]
- (and (/.<= expected_parameter
- (/.min expected_parameter expected_subject))
- (/.<= expected_subject
- (/.min expected_parameter expected_subject)))))
+ (and (/.<= parameter
+ (/.min parameter subject))
+ (/.<= subject
+ (/.min parameter subject))))
(_.coverage [/.max]
- (let [expected_parameter (/.action currency.usd expected_parameter)
- expected_subject (/.action currency.usd expected_subject)]
- (and (/.>= expected_parameter
- (/.max expected_parameter expected_subject))
- (/.>= expected_subject
- (/.max expected_parameter expected_subject)))))
- (let [expected_parameter (/.action currency.usd expected_parameter)
- expected_subject (/.action currency.usd expected_subject)]
- (all _.and
- (_.coverage [/.>]
- (bit#= (/.> expected_parameter expected_subject)
- (/.< expected_subject expected_parameter)))
- (_.coverage [/.<= /.>=]
- (bit#= (/.<= expected_parameter expected_subject)
- (/.>= expected_subject expected_parameter)))
- ))
- (_.coverage [/.units /.sub_units]
- (let [expected (/.action currency.usd expected_movement)
- actual (/.action currency.usd (i.+ (/.units expected)
- (/.sub_units expected)))]
- (/.= expected actual)))
- (_.coverage [/.of_units /.of_sub_units]
- (let [expected (/.action currency.usd expected_movement)
- actual (/.+ (/.of_units currency.usd (/.units expected))
- (/.of_sub_units currency.usd (/.sub_units expected)))]
- (/.= expected actual)))
+ (and (/.>= parameter
+ (/.max parameter subject))
+ (/.>= subject
+ (/.max parameter subject))))
+ (_.coverage [/.>]
+ (bit#= (/.> parameter subject)
+ (/.< subject parameter)))
+ (_.coverage [/.<= /.>=]
+ (bit#= (/.<= parameter subject)
+ (/.>= subject parameter)))
+ (_.coverage [/.units /.sub_units
+ /.of_units /.of_sub_units]
+ (/.= subject
+ (/.+ (/.of_units currency.usd (/.units subject))
+ (/.of_sub_units currency.usd (/.sub_units subject)))))
(do !
- [it (..random currency.usd)]
+ [it (..random currency.usd 1000,00)]
(_.coverage [/.format]
(and (text.starts_with? (%.int (/.movement it))
(text.replaced_once "." "" (/.format it)))
diff --git a/stdlib/source/test/lux/world/locale.lux b/stdlib/source/test/lux/world/locale.lux
index 92510dd26..73dd6ddd2 100644
--- a/stdlib/source/test/lux/world/locale.lux
+++ b/stdlib/source/test/lux/world/locale.lux
@@ -3,8 +3,8 @@
[lux (.except)
[abstract
[monad (.only do)]
- [\\specification
- ["$[0]" hash]]
+ ["[0]" hash
+ ["[1]T" \\test]]
["[0]" equivalence
["[1]T" \\test]]]
[math
@@ -63,15 +63,15 @@
(|> ..random_language
(of ! each (function (_ language)
(/.locale language {.#Some fixed_territory} {.#Some fixed_encoding})))
- ($hash.spec /.hash))
+ (hashT.spec /.hash))
(|> ..random_territory
(of ! each (function (_ territory)
(/.locale fixed_language {.#Some territory} {.#Some fixed_encoding})))
- ($hash.spec /.hash))
+ (hashT.spec /.hash))
(|> ..random_encoding
(of ! each (function (_ encoding)
(/.locale fixed_language {.#Some fixed_territory} {.#Some encoding})))
- ($hash.spec /.hash))
+ (hashT.spec /.hash))
)))
(do random.monad
diff --git a/stdlib/source/test/lux/world/locale/language.lux b/stdlib/source/test/lux/world/locale/language.lux
index 12020bfe7..66546e29f 100644
--- a/stdlib/source/test/lux/world/locale/language.lux
+++ b/stdlib/source/test/lux/world/locale/language.lux
@@ -4,8 +4,8 @@
[abstract
[monad (.only do)]
[hash (.only Hash)]
- [\\specification
- ["$[0]" hash]]]
+ ["[0]" hash
+ ["[1]T" \\test]]]
[control
["[0]" maybe]]
[data
@@ -295,7 +295,7 @@
(_.for [/.Language])
(all _.and
(_.for [/.hash]
- ($hash.spec /.hash ..random))
+ (hashT.spec /.hash ..random))
..languages_test
..aliases_test
diff --git a/stdlib/source/test/lux/world/locale/territory.lux b/stdlib/source/test/lux/world/locale/territory.lux
index f39ff6627..c3799f7b6 100644
--- a/stdlib/source/test/lux/world/locale/territory.lux
+++ b/stdlib/source/test/lux/world/locale/territory.lux
@@ -4,8 +4,8 @@
[abstract
[monad (.only do)]
[hash (.only Hash)]
- [\\specification
- ["$[0]" hash]]]
+ ["[0]" hash
+ ["[1]T" \\test]]]
[control
["[0]" maybe]]
[data
@@ -221,7 +221,7 @@
(_.for [/.Territory])
(all _.and
(_.for [/.hash]
- ($hash.spec /.hash ..random))
+ (hashT.spec /.hash ..random))
..territories_test
..aliases_test
diff --git a/stdlib/source/test/lux/world/net/http/version.lux b/stdlib/source/test/lux/world/net/http/version.lux
index 5891f3768..2f4b38625 100644
--- a/stdlib/source/test/lux/world/net/http/version.lux
+++ b/stdlib/source/test/lux/world/net/http/version.lux
@@ -3,8 +3,8 @@
[lux (.except)
[abstract
[monad (.only do)]
- [\\specification
- ["$[0]" hash]]
+ ["[0]" hash
+ ["[1]T" \\test]]
["[0]" equivalence
["[1]T" \\test]]]
[data
@@ -39,7 +39,7 @@
(_.for [/.equivalence]
(equivalenceT.spec /.equivalence ..random))
(_.for [/.hash]
- ($hash.spec /.hash ..random))
+ (hashT.spec /.hash ..random))
(_.coverage [/.v0_9 /.v1_0 /.v1_1 /.v2_0]
(let [options (list /.v0_9 /.v1_0 /.v1_1 /.v2_0)
diff --git a/stdlib/source/test/lux/world/net/mime.lux b/stdlib/source/test/lux/world/net/mime.lux
index 18f6521c1..65ea9535a 100644
--- a/stdlib/source/test/lux/world/net/mime.lux
+++ b/stdlib/source/test/lux/world/net/mime.lux
@@ -5,8 +5,8 @@
[monad (.only do)]
["[0]" equivalence
["[1]T" \\test]]
- [\\specification
- ["[0]S" hash]]]
+ ["[0]" hash
+ ["[1]T" \\test]]]
[data
["[0]" text (.only)
["[0]" encoding (.only)
@@ -160,7 +160,7 @@
(_.for [/.equivalence]
(equivalenceT.spec /.equivalence ..random))
(_.for [/.hash]
- (hashS.spec /.hash ..random))
+ (hashT.spec /.hash ..random))
(_.coverage [/.mime /.name]
(|> expected
diff --git a/stdlib/source/test/lux/world/net/uri/scheme.lux b/stdlib/source/test/lux/world/net/uri/scheme.lux
index 200b0fce5..ba02871ec 100644
--- a/stdlib/source/test/lux/world/net/uri/scheme.lux
+++ b/stdlib/source/test/lux/world/net/uri/scheme.lux
@@ -3,8 +3,8 @@
[lux (.except)
[abstract
[monad (.only do)]
- [\\specification
- ["$[0]" hash]]
+ ["[0]" hash
+ ["[1]T" \\test]]
["[0]" equivalence
["[1]T" \\test]]]
[data
@@ -61,7 +61,7 @@
(_.for [/.equivalence]
(equivalenceT.spec /.equivalence ..random))
(_.for [/.hash]
- ($hash.spec /.hash ..random))
+ (hashT.spec /.hash ..random))
(_.coverage [/.name /.scheme]
(|> expected
diff --git a/stdlib/source/test/lux/world/output/video/resolution.lux b/stdlib/source/test/lux/world/output/video/resolution.lux
index c05173d2a..0dec2c08a 100644
--- a/stdlib/source/test/lux/world/output/video/resolution.lux
+++ b/stdlib/source/test/lux/world/output/video/resolution.lux
@@ -3,8 +3,8 @@
[lux (.except)
[abstract
[monad (.only do)]
- [\\specification
- ["$[0]" hash]]
+ ["[0]" hash
+ ["[1]T" \\test]]
["[0]" equivalence
["[1]T" \\test]]]
[control
@@ -60,7 +60,7 @@
(_.for [/.equivalence]
(equivalenceT.spec /.equivalence ..random))
(_.for [/.hash]
- ($hash.spec /.hash ..random))
+ (hashT.spec /.hash ..random))
(_.coverage [<resolutions>]
(n.= (list.size ..listing)
diff --git a/stdlib/source/test/lux/world/time/day.lux b/stdlib/source/test/lux/world/time/day.lux
index be1812d92..4af557a8a 100644
--- a/stdlib/source/test/lux/world/time/day.lux
+++ b/stdlib/source/test/lux/world/time/day.lux
@@ -3,8 +3,8 @@
[lux (.except)
[abstract
[monad (.only do)]
- [\\specification
- ["$[0]" hash]]
+ ["[0]" hash
+ ["[1]T" \\test]]
["[0]" enum
["[1]T" \\test]]
["[0]" codec
@@ -54,7 +54,7 @@
(_.for [/.equivalence]
(equivalenceT.spec /.equivalence ..random))
(_.for [/.hash]
- ($hash.spec /.hash ..random))
+ (hashT.spec /.hash ..random))
(_.for [/.order]
(orderT.spec /.order ..random))
(_.for [/.enum]
diff --git a/stdlib/source/test/lux/world/time/instant.lux b/stdlib/source/test/lux/world/time/instant.lux
index 889cfa612..104aa82a1 100644
--- a/stdlib/source/test/lux/world/time/instant.lux
+++ b/stdlib/source/test/lux/world/time/instant.lux
@@ -3,8 +3,8 @@
[lux (.except)
[abstract
[monad (.only do)]
- [\\specification
- ["$[0]" hash]]
+ ["[0]" hash
+ ["[1]T" \\test]]
["[0]" enum
["[1]T" \\test]]
["[0]" codec
@@ -40,7 +40,7 @@
(_.for [/.equivalence]
(equivalenceT.spec /.equivalence random.instant))
(_.for [/.hash]
- ($hash.spec /.hash random.instant))
+ (hashT.spec /.hash random.instant))
(_.for [/.order]
(orderT.spec /.order random.instant))
(_.for [/.enum]
diff --git a/stdlib/source/test/lux/world/time/month.lux b/stdlib/source/test/lux/world/time/month.lux
index 29cb2d725..9f30db09b 100644
--- a/stdlib/source/test/lux/world/time/month.lux
+++ b/stdlib/source/test/lux/world/time/month.lux
@@ -3,8 +3,8 @@
[lux (.except)
[abstract
[monad (.only do)]
- [\\specification
- ["$[0]" hash]]
+ ["[0]" hash
+ ["[1]T" \\test]]
["[0]" enum
["[1]T" \\test]]
["[0]" codec
@@ -48,7 +48,7 @@
(_.for [/.equivalence]
(equivalenceT.spec /.equivalence ..random))
(_.for [/.hash]
- ($hash.spec /.hash ..random))
+ (hashT.spec /.hash ..random))
(_.for [/.order]
(orderT.spec /.order ..random))
(_.for [/.enum]