aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/data
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/lux/data')
-rw-r--r--stdlib/source/test/lux/data/binary.lux222
-rw-r--r--stdlib/source/test/lux/data/bit.lux18
-rw-r--r--stdlib/source/test/lux/data/collection/array.lux546
-rw-r--r--stdlib/source/test/lux/data/collection/bits.lux94
-rw-r--r--stdlib/source/test/lux/data/collection/dictionary.lux322
-rw-r--r--stdlib/source/test/lux/data/collection/dictionary/ordered.lux128
-rw-r--r--stdlib/source/test/lux/data/collection/dictionary/plist.lux82
-rw-r--r--stdlib/source/test/lux/data/collection/list.lux516
-rw-r--r--stdlib/source/test/lux/data/collection/queue.lux134
-rw-r--r--stdlib/source/test/lux/data/collection/queue/priority.lux96
-rw-r--r--stdlib/source/test/lux/data/collection/sequence.lux224
-rw-r--r--stdlib/source/test/lux/data/collection/set.lux134
-rw-r--r--stdlib/source/test/lux/data/collection/set/multi.lux292
-rw-r--r--stdlib/source/test/lux/data/collection/set/ordered.lux202
-rw-r--r--stdlib/source/test/lux/data/collection/stack.lux62
-rw-r--r--stdlib/source/test/lux/data/collection/stream.lux128
-rw-r--r--stdlib/source/test/lux/data/collection/tree.lux56
-rw-r--r--stdlib/source/test/lux/data/collection/tree/finger.lux194
-rw-r--r--stdlib/source/test/lux/data/collection/tree/zipper.lux396
-rw-r--r--stdlib/source/test/lux/data/color.lux142
-rw-r--r--stdlib/source/test/lux/data/color/named.lux12
-rw-r--r--stdlib/source/test/lux/data/format/json.lux162
-rw-r--r--stdlib/source/test/lux/data/format/tar.lux452
-rw-r--r--stdlib/source/test/lux/data/format/xml.lux14
-rw-r--r--stdlib/source/test/lux/data/product.lux24
-rw-r--r--stdlib/source/test/lux/data/sum.lux124
-rw-r--r--stdlib/source/test/lux/data/text.lux330
-rw-r--r--stdlib/source/test/lux/data/text/buffer.lux24
-rw-r--r--stdlib/source/test/lux/data/text/encoding.lux4
-rw-r--r--stdlib/source/test/lux/data/text/escape.lux96
-rw-r--r--stdlib/source/test/lux/data/text/format.lux54
-rw-r--r--stdlib/source/test/lux/data/text/regex.lux340
-rw-r--r--stdlib/source/test/lux/data/text/unicode/block.lux36
-rw-r--r--stdlib/source/test/lux/data/text/unicode/set.lux52
34 files changed, 2856 insertions, 2856 deletions
diff --git a/stdlib/source/test/lux/data/binary.lux b/stdlib/source/test/lux/data/binary.lux
index d46560ddc..9e4e8e6b6 100644
--- a/stdlib/source/test/lux/data/binary.lux
+++ b/stdlib/source/test/lux/data/binary.lux
@@ -96,51 +96,51 @@
($equivalence.spec (function (_ left right)
(!.= left right))
(..random size)))
- (_.cover [!.empty]
- (!.= (!.empty size) (!.empty size)))
- (_.cover [!.size]
- (|> (!.empty size) !.size (n.= size)))
+ (_.coverage [!.empty]
+ (!.= (!.empty size) (!.empty size)))
+ (_.coverage [!.size]
+ (|> (!.empty size) !.size (n.= size)))
(~~ (template [<power> <bytes/?> <has/?>]
- [(_.cover [<bytes/?> <has/?>]
- (let [bytes (i64.left_shifted <power> 1)
- binary (!.empty bytes)
- cap (case bytes
- 8 (-- 0)
- _ (|> 1 (i64.left_shifted (n.* 8 bytes)) --))
- capped_value (i64.and cap value)
-
- pre (<bytes/?> 0 binary)
- _ (<has/?> 0 value binary)
- post (<bytes/?> 0 binary)]
- (and (n.= 0 pre)
- (n.= capped_value post))))]
+ [(_.coverage [<bytes/?> <has/?>]
+ (let [bytes (i64.left_shifted <power> 1)
+ binary (!.empty bytes)
+ cap (case bytes
+ 8 (-- 0)
+ _ (|> 1 (i64.left_shifted (n.* 8 bytes)) --))
+ capped_value (i64.and cap value)
+
+ pre (<bytes/?> 0 binary)
+ _ (<has/?> 0 value binary)
+ post (<bytes/?> 0 binary)]
+ (and (n.= 0 pre)
+ (n.= capped_value post))))]
[0 !.bits_8 !.has_8!]
[1 !.bits_16 !.has_16!]
[2 !.bits_32 !.has_32!]
[3 !.bits_64 !.has_64!]))
- (_.cover [!.slice]
- (let [random_slice (!.slice offset length sample)
- idxs (is (List Nat)
- (case length
- 0 (list)
- _ (enum.range n.enum 0 (-- length))))
- reader (function (_ binary idx)
- (!.bits_8 idx binary))]
- (and (n.= length (!.size random_slice))
- (# (list.equivalence n.equivalence) =
- (list#each (|>> (n.+ offset) (reader sample)) idxs)
- (list#each (reader random_slice) idxs)))))
- (_.cover [!.copy!]
- (and (let [it (!.copy! size 0 sample 0 (!.empty size))]
- (and (not (same? sample it))
- (!.= sample it)))
- (let [sample/0 (!.bits_8 0 sample)
- copy (!.copy! 1 0 sample 0 (!.empty 2))
- copy/0 (!.bits_8 0 copy)
- copy/1 (!.bits_8 1 copy)]
- (and (n.= sample/0 copy/0)
- (n.= 0 copy/1)))))
+ (_.coverage [!.slice]
+ (let [random_slice (!.slice offset length sample)
+ idxs (is (List Nat)
+ (case length
+ 0 (list)
+ _ (enum.range n.enum 0 (-- length))))
+ reader (function (_ binary idx)
+ (!.bits_8 idx binary))]
+ (and (n.= length (!.size random_slice))
+ (# (list.equivalence n.equivalence) =
+ (list#each (|>> (n.+ offset) (reader sample)) idxs)
+ (list#each (reader random_slice) idxs)))))
+ (_.coverage [!.copy!]
+ (and (let [it (!.copy! size 0 sample 0 (!.empty size))]
+ (and (not (same? sample it))
+ (!.= sample it)))
+ (let [sample/0 (!.bits_8 0 sample)
+ copy (!.copy! 1 0 sample 0 (!.empty 2))
+ copy/0 (!.bits_8 0 copy)
+ copy/1 (!.bits_8 1 copy)]
+ (and (n.= sample/0 copy/0)
+ (n.= 0 copy/1)))))
)))))
(def: .public test
@@ -160,84 +160,84 @@
($equivalence.spec /.equivalence (..random size)))
(_.for [/.monoid]
($monoid.spec /.equivalence /.monoid (..random size)))
- (_.cover [/.mix]
- (n.= (# list.mix mix n.+ 0 (..as_list sample))
- (/.mix n.+ 0 sample)))
+ (_.coverage [/.mix]
+ (n.= (# list.mix mix n.+ 0 (..as_list sample))
+ (/.mix n.+ 0 sample)))
- (_.cover [/.empty]
- (# /.equivalence =
- (/.empty size)
- (/.empty size)))
- (_.cover [/.size]
- (|> (/.empty size) /.size (n.= size)))
+ (_.coverage [/.empty]
+ (# /.equivalence =
+ (/.empty size)
+ (/.empty size)))
+ (_.coverage [/.size]
+ (|> (/.empty size) /.size (n.= size)))
(_.for [/.index_out_of_bounds]
(all _.and
- (_.cover [/.bits_8 /.has_8!]
- (..binary_io 0 /.bits_8 /.has_8! value))
- (_.cover [/.bits_16 /.has_16!]
- (..binary_io 1 /.bits_16 /.has_16! value))
- (_.cover [/.bits_32 /.has_32!]
- (..binary_io 2 /.bits_32 /.has_32! value))
- (_.cover [/.bits_64 /.has_64!]
- (..binary_io 3 /.bits_64 /.has_64! value))))
- (_.cover [/.slice]
- (let [random_slice (try.trusted (/.slice offset length sample))
- idxs (is (List Nat)
- (case length
- 0 (list)
- _ (enum.range n.enum 0 (-- length))))
- reader (function (_ binary idx)
- (/.bits_8 idx binary))]
- (and (n.= length (/.size random_slice))
- (case [(monad.each try.monad (|>> (n.+ offset) (reader sample)) idxs)
- (monad.each try.monad (reader random_slice) idxs)]
- [{try.#Success binary_vals} {try.#Success slice_vals}]
- (# (list.equivalence n.equivalence) = binary_vals slice_vals)
+ (_.coverage [/.bits_8 /.has_8!]
+ (..binary_io 0 /.bits_8 /.has_8! value))
+ (_.coverage [/.bits_16 /.has_16!]
+ (..binary_io 1 /.bits_16 /.has_16! value))
+ (_.coverage [/.bits_32 /.has_32!]
+ (..binary_io 2 /.bits_32 /.has_32! value))
+ (_.coverage [/.bits_64 /.has_64!]
+ (..binary_io 3 /.bits_64 /.has_64! value))))
+ (_.coverage [/.slice]
+ (let [random_slice (try.trusted (/.slice offset length sample))
+ idxs (is (List Nat)
+ (case length
+ 0 (list)
+ _ (enum.range n.enum 0 (-- length))))
+ reader (function (_ binary idx)
+ (/.bits_8 idx binary))]
+ (and (n.= length (/.size random_slice))
+ (case [(monad.each try.monad (|>> (n.+ offset) (reader sample)) idxs)
+ (monad.each try.monad (reader random_slice) idxs)]
+ [{try.#Success binary_vals} {try.#Success slice_vals}]
+ (# (list.equivalence n.equivalence) = binary_vals slice_vals)
- _
- #0))))
- (_.cover [/.slice_out_of_bounds]
- (and (throws? /.slice_out_of_bounds (/.slice size size sample))
- (let [verdict (throws? /.slice_out_of_bounds (/.slice offset size sample))]
- (case offset
- 0 (not verdict)
- _ verdict))))
- (_.cover [/.after]
- (and (# /.equivalence = sample (/.after 0 sample))
- (# /.equivalence = (/.empty 0) (/.after size sample))
- (n.= (n.- offset size) (/.size (/.after offset sample)))
- (case (list.reversed (..as_list sample))
- {.#End}
- false
+ _
+ #0))))
+ (_.coverage [/.slice_out_of_bounds]
+ (and (throws? /.slice_out_of_bounds (/.slice size size sample))
+ (let [verdict (throws? /.slice_out_of_bounds (/.slice offset size sample))]
+ (case offset
+ 0 (not verdict)
+ _ verdict))))
+ (_.coverage [/.after]
+ (and (# /.equivalence = sample (/.after 0 sample))
+ (# /.equivalence = (/.empty 0) (/.after size sample))
+ (n.= (n.- offset size) (/.size (/.after offset sample)))
+ (case (list.reversed (..as_list sample))
+ {.#End}
+ false
- {.#Item head tail}
- (n.= (list.mix n.+ 0 tail)
- (/.mix n.+ 0 (/.after 1 sample))))))
- (_.cover [/.copy!]
- (and (case (/.copy! size 0 sample 0 (/.empty size))
- {try.#Success output}
- (and (not (same? sample output))
- (# /.equivalence = sample output))
+ {.#Item head tail}
+ (n.= (list.mix n.+ 0 tail)
+ (/.mix n.+ 0 (/.after 1 sample))))))
+ (_.coverage [/.copy!]
+ (and (case (/.copy! size 0 sample 0 (/.empty size))
+ {try.#Success output}
+ (and (not (same? sample output))
+ (# /.equivalence = sample output))
- {try.#Failure _}
- false)
- (succeed
- (do try.monad
- [sample/0 (/.bits_8 0 sample)
- copy (/.copy! 1 0 sample 0 (/.empty 2))
- copy/0 (/.bits_8 0 copy)
- copy/1 (/.bits_8 1 copy)]
- (in (and (n.= sample/0 copy/0)
- (n.= 0 copy/1)))))))
- (_.cover [/.cannot_copy]
- (and (not (throws? /.cannot_copy
- (/.copy! size 0 sample 0 (/.empty size))))
- (throws? /.cannot_copy
- (/.copy! (n.+ offset size) 0 sample 0 (/.empty size)))
- (throws? /.cannot_copy
- (/.copy! size offset sample 0 (/.empty size)))
- (throws? /.cannot_copy
- (/.copy! size 0 sample offset (/.empty size)))))
+ {try.#Failure _}
+ false)
+ (succeed
+ (do try.monad
+ [sample/0 (/.bits_8 0 sample)
+ copy (/.copy! 1 0 sample 0 (/.empty 2))
+ copy/0 (/.bits_8 0 copy)
+ copy/1 (/.bits_8 1 copy)]
+ (in (and (n.= sample/0 copy/0)
+ (n.= 0 copy/1)))))))
+ (_.coverage [/.cannot_copy]
+ (and (not (throws? /.cannot_copy
+ (/.copy! size 0 sample 0 (/.empty size))))
+ (throws? /.cannot_copy
+ (/.copy! (n.+ offset size) 0 sample 0 (/.empty size)))
+ (throws? /.cannot_copy
+ (/.copy! size offset sample 0 (/.empty size)))
+ (throws? /.cannot_copy
+ (/.copy! size 0 sample offset (/.empty size)))))
..test|unsafe
))))
diff --git a/stdlib/source/test/lux/data/bit.lux b/stdlib/source/test/lux/data/bit.lux
index fed07f172..25e1c5c8e 100644
--- a/stdlib/source/test/lux/data/bit.lux
+++ b/stdlib/source/test/lux/data/bit.lux
@@ -33,13 +33,13 @@
(_.for [/.codec]
($codec.spec /.equivalence /.codec random.bit))
- (_.cover [/.no /.yes]
- (and (# /.equivalence = false /.no)
- (# /.equivalence = true /.yes)))
- (_.cover [/.off /.on]
- (and (# /.equivalence = false /.off)
- (# /.equivalence = true /.on)))
- (_.cover [/.complement]
- (and (not (# /.equivalence = value ((/.complement function.identity) value)))
- (# /.equivalence = value ((/.complement not) value))))
+ (_.coverage [/.no /.yes]
+ (and (# /.equivalence = false /.no)
+ (# /.equivalence = true /.yes)))
+ (_.coverage [/.off /.on]
+ (and (# /.equivalence = false /.off)
+ (# /.equivalence = true /.on)))
+ (_.coverage [/.complement]
+ (and (not (# /.equivalence = value ((/.complement function.identity) value)))
+ (# /.equivalence = value ((/.complement not) value))))
))))
diff --git a/stdlib/source/test/lux/data/collection/array.lux b/stdlib/source/test/lux/data/collection/array.lux
index bbb829d98..278394bd3 100644
--- a/stdlib/source/test/lux/data/collection/array.lux
+++ b/stdlib/source/test/lux/data/collection/array.lux
@@ -68,50 +68,50 @@
(if (n.even? value)
{.#Some (# n.decimal encoded value)}
{.#None})))]
- (_.cover [/.one]
- (case [(|> evens
- (/#each (# n.decimal encoded))
- (/.item 0))
- (/.one choose evens)]
- [{.#Some expected} {.#Some actual}]
- (text#= expected actual)
+ (_.coverage [/.one]
+ (case [(|> evens
+ (/#each (# n.decimal encoded))
+ (/.item 0))
+ (/.one choose evens)]
+ [{.#Some expected} {.#Some actual}]
+ (text#= expected actual)
- [{.#None} {.#None}]
- true
+ [{.#None} {.#None}]
+ true
- _
- false)))
- (_.cover [/.example]
- (# (maybe.equivalence n.equivalence) =
- (/.example n.even? the_array)
- (list.example n.even? (/.list {.#None} the_array))))
- (_.cover [/.example']
- (case [(/.example n.even? the_array)
- (/.example' (function (_ idx member)
- (n.even? member))
- the_array)]
- [{.#Some expected} {.#Some [idx actual]}]
- (case (/.item idx the_array)
- {.#Some again}
- (and (n.= expected actual)
- (n.= actual again))
-
- {.#None}
- false)
+ _
+ false)))
+ (_.coverage [/.example]
+ (# (maybe.equivalence n.equivalence) =
+ (/.example n.even? the_array)
+ (list.example n.even? (/.list {.#None} the_array))))
+ (_.coverage [/.example']
+ (case [(/.example n.even? the_array)
+ (/.example' (function (_ idx member)
+ (n.even? member))
+ the_array)]
+ [{.#Some expected} {.#Some [idx actual]}]
+ (case (/.item idx the_array)
+ {.#Some again}
+ (and (n.= expected actual)
+ (n.= actual again))
+
+ {.#None}
+ false)
- [{.#None} {.#None}]
- true
+ [{.#None} {.#None}]
+ true
- _
- false))
- (_.cover [/.every?]
- (# bit.equivalence =
- (list.every? n.even? (/.list {.#None} the_array))
- (/.every? n.even? the_array)))
- (_.cover [/.any?]
- (# bit.equivalence =
- (list.any? n.even? (/.list {.#None} the_array))
- (/.any? n.even? the_array)))
+ _
+ false))
+ (_.coverage [/.every?]
+ (# bit.equivalence =
+ (list.every? n.even? (/.list {.#None} the_array))
+ (/.every? n.even? the_array)))
+ (_.coverage [/.any?]
+ (# bit.equivalence =
+ (list.any? n.even? (/.list {.#None} the_array))
+ (/.any? n.even? the_array)))
)))
(def: test|unsafe
@@ -151,76 +151,76 @@
init
it)))))
- (_.cover [!.empty !.size]
- (n.= size (!.size (is (Array Nat)
- (!.empty size)))))
- (_.cover [!.type]
- (case !.Array
- (pattern (<| {.#Named (symbol !.Array)}
- {.#UnivQ (list)}
- {.#Primitive nominal_type (list {.#Parameter 1})}))
- (same? !.type nominal_type)
+ (_.coverage [!.empty !.size]
+ (n.= size (!.size (is (Array Nat)
+ (!.empty size)))))
+ (_.coverage [!.type]
+ (case !.Array
+ (pattern (<| {.#Named (symbol !.Array)}
+ {.#UnivQ (list)}
+ {.#Primitive nominal_type (list {.#Parameter 1})}))
+ (same? !.type nominal_type)
- _
- false))
- (_.cover [!.lacks?]
- (let [the_array (|> (!.empty 2)
- (is (Array Nat))
- (!.has! 0 expected))]
- (and (not (!.lacks? 0 the_array))
- (!.lacks? 1 the_array))))
- (_.cover [!.item !.has!]
- (|> (!.empty 2)
- (is (Array Nat))
- (!.has! 0 expected)
- (!.item 0)
- (n.= expected)))
- (_.cover [!.lacks!]
- (|> (!.empty 1)
- (is (Array Nat))
- (!.has! 0 expected)
- (!.lacks! 0)
- (!.lacks? 0)))
- (_.cover [!.lacks?]
- (let [the_array (|> (!.empty 2)
- (is (Array Nat))
- (!.has! 0 expected))]
- (and (not (!.lacks? 0 the_array))
- (!.lacks? 1 the_array))))
- (_.cover [!.has?]
- (let [the_array (|> (!.empty 2)
- (is (Array Nat))
- (!.has! 0 expected))]
- (and (!.has? 0 the_array)
- (not (!.has? 1 the_array)))))
- (_.cover [!.revised!]
- (|> (!.empty 1)
- (is (Array Nat))
- (!.has! 0 base)
- (!.revised! 0 (n.+ shift))
- (!.item 0)
- (n.= expected)))
- (_.cover [!.upsert!]
- (let [the_array (|> (!.empty 2)
- (is (Array Nat))
- (!.has! 0 base)
- (!.upsert! 0 dummy (n.+ shift))
- (!.upsert! 1 base (n.+ shift)))]
- (and (n.= expected (!.item 0 the_array))
- (n.= expected (!.item 1 the_array)))))
+ _
+ false))
+ (_.coverage [!.lacks?]
+ (let [the_array (|> (!.empty 2)
+ (is (Array Nat))
+ (!.has! 0 expected))]
+ (and (not (!.lacks? 0 the_array))
+ (!.lacks? 1 the_array))))
+ (_.coverage [!.item !.has!]
+ (|> (!.empty 2)
+ (is (Array Nat))
+ (!.has! 0 expected)
+ (!.item 0)
+ (n.= expected)))
+ (_.coverage [!.lacks!]
+ (|> (!.empty 1)
+ (is (Array Nat))
+ (!.has! 0 expected)
+ (!.lacks! 0)
+ (!.lacks? 0)))
+ (_.coverage [!.lacks?]
+ (let [the_array (|> (!.empty 2)
+ (is (Array Nat))
+ (!.has! 0 expected))]
+ (and (not (!.lacks? 0 the_array))
+ (!.lacks? 1 the_array))))
+ (_.coverage [!.has?]
+ (let [the_array (|> (!.empty 2)
+ (is (Array Nat))
+ (!.has! 0 expected))]
+ (and (!.has? 0 the_array)
+ (not (!.has? 1 the_array)))))
+ (_.coverage [!.revised!]
+ (|> (!.empty 1)
+ (is (Array Nat))
+ (!.has! 0 base)
+ (!.revised! 0 (n.+ shift))
+ (!.item 0)
+ (n.= expected)))
+ (_.coverage [!.upsert!]
+ (let [the_array (|> (!.empty 2)
+ (is (Array Nat))
+ (!.has! 0 base)
+ (!.upsert! 0 dummy (n.+ shift))
+ (!.upsert! 1 base (n.+ shift)))]
+ (and (n.= expected (!.item 0 the_array))
+ (n.= expected (!.item 1 the_array)))))
(do !
[occupancy (# ! each (n.% (++ size)) random.nat)]
- (_.cover [!.occupancy !.vacancy]
- (let [the_array (loop (again [output (is (Array Nat)
- (!.empty size))
- idx 0])
- (if (n.< occupancy idx)
- (again (!.has! idx expected output)
- (++ idx))
- output))]
- (and (n.= occupancy (!.occupancy the_array))
- (n.= size (n.+ (!.occupancy the_array)
- (!.vacancy the_array)))))))
+ (_.coverage [!.occupancy !.vacancy]
+ (let [the_array (loop (again [output (is (Array Nat)
+ (!.empty size))
+ idx 0])
+ (if (n.< occupancy idx)
+ (again (!.has! idx expected output)
+ (++ idx))
+ output))]
+ (and (n.= occupancy (!.occupancy the_array))
+ (n.= size (n.+ (!.occupancy the_array)
+ (!.vacancy the_array)))))))
(do !
[the_list (random.list size random.nat)
.let [the_array (!.clone the_array)
@@ -229,79 +229,79 @@
(not (or (n.even? value)
(set.member? members value))))
random.nat)]
- (_.cover [!.of_list !.list]
- (and (|> the_list !.of_list (!.list {.#None})
- (# (list.equivalence n.equivalence) = the_list))
- (|> the_array (!.list {.#None}) !.of_list
- (!.= n.equivalence the_array))
- (exec
- (!.only! n.even? the_array)
- (list.every? (function (_ value)
- (or (n.even? value)
- (same? default value)))
- (!.list {.#Some default} the_array))))))
+ (_.coverage [!.of_list !.list]
+ (and (|> the_list !.of_list (!.list {.#None})
+ (# (list.equivalence n.equivalence) = the_list))
+ (|> the_array (!.list {.#None}) !.of_list
+ (!.= n.equivalence the_array))
+ (exec
+ (!.only! n.even? the_array)
+ (list.every? (function (_ value)
+ (or (n.even? value)
+ (same? default value)))
+ (!.list {.#Some default} the_array))))))
(do !
[amount (# ! each (n.% (++ size)) random.nat)]
- (_.cover [!.copy!]
- (let [copy (is (Array Nat)
- (!.empty size))]
- (exec (!.copy! amount 0 the_array 0 copy)
- (# (list.equivalence n.equivalence) =
- (list.first amount (!.list {.#None} the_array))
- (!.list {.#None} copy))))))
- (_.cover [!.clone]
- (let [clone (!.clone the_array)]
- (and (not (same? the_array clone))
- (!.= n.equivalence the_array clone))))
+ (_.coverage [!.copy!]
+ (let [copy (is (Array Nat)
+ (!.empty size))]
+ (exec (!.copy! amount 0 the_array 0 copy)
+ (# (list.equivalence n.equivalence) =
+ (list.first amount (!.list {.#None} the_array))
+ (!.list {.#None} copy))))))
+ (_.coverage [!.clone]
+ (let [clone (!.clone the_array)]
+ (and (not (same? the_array clone))
+ (!.= n.equivalence the_array clone))))
(let [the_array (!.clone the_array)
evens (|> the_array (!.list {.#None}) (list.only n.even?))
odds (|> the_array (!.list {.#None}) (list.only n.odd?))]
- (_.cover [!.only!]
- (exec (!.only! n.even? the_array)
- (and (n.= (list.size evens) (!.occupancy the_array))
- (n.= (list.size odds) (!.vacancy the_array))
- (|> the_array
- (!.list {.#None})
- (# (list.equivalence n.equivalence) = evens))))))
+ (_.coverage [!.only!]
+ (exec (!.only! n.even? the_array)
+ (and (n.= (list.size evens) (!.occupancy the_array))
+ (n.= (list.size odds) (!.vacancy the_array))
+ (|> the_array
+ (!.list {.#None})
+ (# (list.equivalence n.equivalence) = evens))))))
(let [choose (is (-> Nat (Maybe Text))
(function (_ value)
(if (n.even? value)
{.#Some (# n.decimal encoded value)}
{.#None})))]
- (_.cover [!.one]
- (|> evens
- (!.one choose)
- (maybe#each (text#= (|> evens
- (!.each (# n.decimal encoded))
- (!.item 0))))
- (maybe.else false))))
- (_.cover [!.example]
- (# (maybe.equivalence n.equivalence) =
- (!.example n.even? the_array)
- (list.example n.even? (!.list {.#None} the_array))))
- (_.cover [!.example']
- (case [(!.example n.even? the_array)
- (!.example' (function (_ idx member)
- (n.even? member))
- the_array)]
- [{.#Some expected} {.#Some [idx actual]}]
- (and (not (!.lacks? idx the_array))
- (n.= expected actual)
- (n.= actual (!.item idx the_array)))
+ (_.coverage [!.one]
+ (|> evens
+ (!.one choose)
+ (maybe#each (text#= (|> evens
+ (!.each (# n.decimal encoded))
+ (!.item 0))))
+ (maybe.else false))))
+ (_.coverage [!.example]
+ (# (maybe.equivalence n.equivalence) =
+ (!.example n.even? the_array)
+ (list.example n.even? (!.list {.#None} the_array))))
+ (_.coverage [!.example']
+ (case [(!.example n.even? the_array)
+ (!.example' (function (_ idx member)
+ (n.even? member))
+ the_array)]
+ [{.#Some expected} {.#Some [idx actual]}]
+ (and (not (!.lacks? idx the_array))
+ (n.= expected actual)
+ (n.= actual (!.item idx the_array)))
- [{.#None} {.#None}]
- true
+ [{.#None} {.#None}]
+ true
- _
- false))
- (_.cover [!.every?]
- (# bit.equivalence =
- (list.every? n.even? (!.list {.#None} the_array))
- (!.every? n.even? the_array)))
- (_.cover [!.any?]
- (# bit.equivalence =
- (list.any? n.even? (!.list {.#None} the_array))
- (!.any? n.even? the_array)))
+ _
+ false))
+ (_.coverage [!.every?]
+ (# bit.equivalence =
+ (list.every? n.even? (!.list {.#None} the_array))
+ (!.every? n.even? the_array)))
+ (_.coverage [!.any?]
+ (# bit.equivalence =
+ (list.any? n.even? (!.list {.#None} the_array))
+ (!.any? n.even? the_array)))
)))))
(def: .public test
@@ -319,91 +319,91 @@
..structures
..search
- (_.cover [/.empty /.size]
- (n.= size (/.size (is (Array Nat)
- (/.empty size)))))
- (_.cover [/.type_name]
- (case /.Array
- (pattern (<| {.#Named (symbol /.Array)}
- {.#Named (symbol !.Array)}
- {.#UnivQ (list)}
- {.#Primitive nominal_type (list {.#Parameter 1})}))
- (same? /.type_name nominal_type)
+ (_.coverage [/.empty /.size]
+ (n.= size (/.size (is (Array Nat)
+ (/.empty size)))))
+ (_.coverage [/.type_name]
+ (case /.Array
+ (pattern (<| {.#Named (symbol /.Array)}
+ {.#Named (symbol !.Array)}
+ {.#UnivQ (list)}
+ {.#Primitive nominal_type (list {.#Parameter 1})}))
+ (same? /.type_name nominal_type)
- _
- false))
- (_.cover [/.item /.has!]
- (let [the_array (|> (/.empty 2)
- (is (Array Nat))
- (/.has! 0 expected))]
- (case [(/.item 0 the_array)
- (/.item 1 the_array)]
- [{.#Some actual} {.#None}]
- (n.= expected actual)
+ _
+ false))
+ (_.coverage [/.item /.has!]
+ (let [the_array (|> (/.empty 2)
+ (is (Array Nat))
+ (/.has! 0 expected))]
+ (case [(/.item 0 the_array)
+ (/.item 1 the_array)]
+ [{.#Some actual} {.#None}]
+ (n.= expected actual)
- _
- false)))
- (_.cover [/.lacks!]
- (let [the_array (|> (/.empty 1)
- (is (Array Nat))
- (/.has! 0 expected))]
- (case [(/.item 0 the_array)
- (/.item 0 (/.lacks! 0 the_array))]
- [{.#Some actual} {.#None}]
- (n.= expected actual)
+ _
+ false)))
+ (_.coverage [/.lacks!]
+ (let [the_array (|> (/.empty 1)
+ (is (Array Nat))
+ (/.has! 0 expected))]
+ (case [(/.item 0 the_array)
+ (/.item 0 (/.lacks! 0 the_array))]
+ [{.#Some actual} {.#None}]
+ (n.= expected actual)
- _
- false)))
- (_.cover [/.lacks?]
- (let [the_array (|> (/.empty 2)
- (is (Array Nat))
- (/.has! 0 expected))]
- (and (not (/.lacks? 0 the_array))
- (/.lacks? 1 the_array))))
- (_.cover [/.has?]
- (let [the_array (|> (/.empty 2)
- (is (Array Nat))
- (/.has! 0 expected))]
- (and (/.has? 0 the_array)
- (not (/.has? 1 the_array)))))
- (_.cover [/.revised!]
- (let [the_array (|> (/.empty 1)
- (is (Array Nat))
- (/.has! 0 base)
- (/.revised! 0 (n.+ shift)))]
- (case (/.item 0 the_array)
- {.#Some actual}
- (n.= expected actual)
+ _
+ false)))
+ (_.coverage [/.lacks?]
+ (let [the_array (|> (/.empty 2)
+ (is (Array Nat))
+ (/.has! 0 expected))]
+ (and (not (/.lacks? 0 the_array))
+ (/.lacks? 1 the_array))))
+ (_.coverage [/.has?]
+ (let [the_array (|> (/.empty 2)
+ (is (Array Nat))
+ (/.has! 0 expected))]
+ (and (/.has? 0 the_array)
+ (not (/.has? 1 the_array)))))
+ (_.coverage [/.revised!]
+ (let [the_array (|> (/.empty 1)
+ (is (Array Nat))
+ (/.has! 0 base)
+ (/.revised! 0 (n.+ shift)))]
+ (case (/.item 0 the_array)
+ {.#Some actual}
+ (n.= expected actual)
- _
- false)))
- (_.cover [/.upsert!]
- (let [the_array (|> (/.empty 2)
- (is (Array Nat))
- (/.has! 0 base)
- (/.upsert! 0 dummy (n.+ shift))
- (/.upsert! 1 base (n.+ shift)))]
- (case [(/.item 0 the_array)
- (/.item 1 the_array)]
- [{.#Some actual/0} {.#Some actual/1}]
- (and (n.= expected actual/0)
- (n.= expected actual/1))
+ _
+ false)))
+ (_.coverage [/.upsert!]
+ (let [the_array (|> (/.empty 2)
+ (is (Array Nat))
+ (/.has! 0 base)
+ (/.upsert! 0 dummy (n.+ shift))
+ (/.upsert! 1 base (n.+ shift)))]
+ (case [(/.item 0 the_array)
+ (/.item 1 the_array)]
+ [{.#Some actual/0} {.#Some actual/1}]
+ (and (n.= expected actual/0)
+ (n.= expected actual/1))
- _
- false)))
+ _
+ false)))
(do !
[occupancy (# ! each (n.% (++ size)) random.nat)]
- (_.cover [/.occupancy /.vacancy]
- (let [the_array (loop (again [output (is (Array Nat)
- (/.empty size))
- idx 0])
- (if (n.< occupancy idx)
- (again (/.has! idx expected output)
- (++ idx))
- output))]
- (and (n.= occupancy (/.occupancy the_array))
- (n.= size (n.+ (/.occupancy the_array)
- (/.vacancy the_array)))))))
+ (_.coverage [/.occupancy /.vacancy]
+ (let [the_array (loop (again [output (is (Array Nat)
+ (/.empty size))
+ idx 0])
+ (if (n.< occupancy idx)
+ (again (/.has! idx expected output)
+ (++ idx))
+ output))]
+ (and (n.= occupancy (/.occupancy the_array))
+ (n.= size (n.+ (/.occupancy the_array)
+ (/.vacancy the_array)))))))
(do !
[the_list (random.list size random.nat)
.let [the_array (/.clone the_array)
@@ -412,38 +412,38 @@
(not (or (n.even? value)
(set.member? members value))))
random.nat)]
- (_.cover [/.of_list /.list]
- (and (|> the_list /.of_list (/.list {.#None})
- (# (list.equivalence n.equivalence) = the_list))
- (|> the_array (/.list {.#None}) /.of_list
- (# (/.equivalence n.equivalence) = the_array))
- (exec
- (/.only! n.even? the_array)
- (list.every? (function (_ value)
- (or (n.even? value)
- (same? default value)))
- (/.list {.#Some default} the_array))))))
+ (_.coverage [/.of_list /.list]
+ (and (|> the_list /.of_list (/.list {.#None})
+ (# (list.equivalence n.equivalence) = the_list))
+ (|> the_array (/.list {.#None}) /.of_list
+ (# (/.equivalence n.equivalence) = the_array))
+ (exec
+ (/.only! n.even? the_array)
+ (list.every? (function (_ value)
+ (or (n.even? value)
+ (same? default value)))
+ (/.list {.#Some default} the_array))))))
(do !
[amount (# ! each (n.% (++ size)) random.nat)]
- (_.cover [/.copy!]
- (let [copy (is (Array Nat)
- (/.empty size))]
- (exec (/.copy! amount 0 the_array 0 copy)
- (# (list.equivalence n.equivalence) =
- (list.first amount (/.list {.#None} the_array))
- (/.list {.#None} copy))))))
- (_.cover [/.clone]
- (let [clone (/.clone the_array)]
- (and (not (same? the_array clone))
- (# (/.equivalence n.equivalence) = the_array clone))))
+ (_.coverage [/.copy!]
+ (let [copy (is (Array Nat)
+ (/.empty size))]
+ (exec (/.copy! amount 0 the_array 0 copy)
+ (# (list.equivalence n.equivalence) =
+ (list.first amount (/.list {.#None} the_array))
+ (/.list {.#None} copy))))))
+ (_.coverage [/.clone]
+ (let [clone (/.clone the_array)]
+ (and (not (same? the_array clone))
+ (# (/.equivalence n.equivalence) = the_array clone))))
(let [the_array (/.clone the_array)
evens (|> the_array (/.list {.#None}) (list.only n.even?))
odds (|> the_array (/.list {.#None}) (list.only n.odd?))]
- (_.cover [/.only!]
- (exec (/.only! n.even? the_array)
- (and (n.= (list.size evens) (/.occupancy the_array))
- (n.= (list.size odds) (/.vacancy the_array))
- (|> the_array (/.list {.#None}) (# (list.equivalence n.equivalence) = evens))))))
+ (_.coverage [/.only!]
+ (exec (/.only! n.even? the_array)
+ (and (n.= (list.size evens) (/.occupancy the_array))
+ (n.= (list.size odds) (/.vacancy the_array))
+ (|> the_array (/.list {.#None}) (# (list.equivalence n.equivalence) = evens))))))
..test|unsafe
))))
diff --git a/stdlib/source/test/lux/data/collection/bits.lux b/stdlib/source/test/lux/data/collection/bits.lux
index 8547bcf42..717ed5337 100644
--- a/stdlib/source/test/lux/data/collection/bits.lux
+++ b/stdlib/source/test/lux/data/collection/bits.lux
@@ -39,57 +39,57 @@
(do random.monad
[sample ..random]
- (_.cover [/.empty? /.size]
- (if (/.empty? sample)
- (n.= 0 (/.size sample))
- (n.> 0 (/.size sample)))))
- (_.cover [/.empty]
- (/.empty? /.empty))
+ (_.coverage [/.empty? /.size]
+ (if (/.empty? sample)
+ (n.= 0 (/.size sample))
+ (n.> 0 (/.size sample)))))
+ (_.coverage [/.empty]
+ (/.empty? /.empty))
(do [! random.monad]
[size (# ! each (|>> (n.% 1,000) ++) random.nat)
idx (# ! each (n.% size) random.nat)
sample ..random]
(all _.and
- (_.cover [/.bit /.one]
- (and (|> /.empty (/.bit idx) not)
- (|> /.empty (/.one idx) (/.bit idx))))
- (_.cover [/.zero]
- (|> /.empty (/.one idx) (/.zero idx) (/.bit idx) not))
- (_.cover [/.flipped]
- (and (|> /.empty (/.flipped idx) (/.bit idx))
- (|> /.empty (/.flipped idx) (/.flipped idx) (/.bit idx) not)))
- (_.cover [/.Chunk /.capacity /.chunk_size]
- (and (n.= 0 (/.capacity /.empty))
- (|> /.empty (/.one idx) /.capacity
- (n.- idx)
- (predicate.or (n.>= 0)
- (n.< /.chunk_size)))
- (let [grown (/.flipped idx /.empty)]
- (and (n.> 0 (/.capacity grown))
- (same? /.empty (/.flipped idx grown))))))
- (_.cover [/.intersects?]
- (and (not (/.intersects? /.empty
- /.empty))
- (/.intersects? (/.one idx /.empty)
- (/.one idx /.empty))
- (not (/.intersects? (/.one (++ idx) /.empty)
- (/.one idx /.empty)))
- (not (/.intersects? sample (/.not sample)))))
- (_.cover [/.not]
- (and (same? /.empty (/.not /.empty))
- (or (same? /.empty sample)
- (and (not (# /.equivalence = sample (/.not sample)))
- (# /.equivalence = sample (/.not (/.not sample)))))))
- (_.cover [/.xor]
- (and (same? /.empty (/.xor sample sample))
- (n.= (/.size (/.xor sample (/.not sample)))
- (/.capacity sample))))
- (_.cover [/.or]
- (and (# /.equivalence = sample (/.or sample sample))
- (n.= (/.size (/.or sample (/.not sample)))
- (/.capacity sample))))
- (_.cover [/.and]
- (and (# /.equivalence = sample (/.and sample sample))
- (same? /.empty (/.and sample (/.not sample)))))
+ (_.coverage [/.bit /.one]
+ (and (|> /.empty (/.bit idx) not)
+ (|> /.empty (/.one idx) (/.bit idx))))
+ (_.coverage [/.zero]
+ (|> /.empty (/.one idx) (/.zero idx) (/.bit idx) not))
+ (_.coverage [/.flipped]
+ (and (|> /.empty (/.flipped idx) (/.bit idx))
+ (|> /.empty (/.flipped idx) (/.flipped idx) (/.bit idx) not)))
+ (_.coverage [/.Chunk /.capacity /.chunk_size]
+ (and (n.= 0 (/.capacity /.empty))
+ (|> /.empty (/.one idx) /.capacity
+ (n.- idx)
+ (predicate.or (n.>= 0)
+ (n.< /.chunk_size)))
+ (let [grown (/.flipped idx /.empty)]
+ (and (n.> 0 (/.capacity grown))
+ (same? /.empty (/.flipped idx grown))))))
+ (_.coverage [/.intersects?]
+ (and (not (/.intersects? /.empty
+ /.empty))
+ (/.intersects? (/.one idx /.empty)
+ (/.one idx /.empty))
+ (not (/.intersects? (/.one (++ idx) /.empty)
+ (/.one idx /.empty)))
+ (not (/.intersects? sample (/.not sample)))))
+ (_.coverage [/.not]
+ (and (same? /.empty (/.not /.empty))
+ (or (same? /.empty sample)
+ (and (not (# /.equivalence = sample (/.not sample)))
+ (# /.equivalence = sample (/.not (/.not sample)))))))
+ (_.coverage [/.xor]
+ (and (same? /.empty (/.xor sample sample))
+ (n.= (/.size (/.xor sample (/.not sample)))
+ (/.capacity sample))))
+ (_.coverage [/.or]
+ (and (# /.equivalence = sample (/.or sample sample))
+ (n.= (/.size (/.or sample (/.not sample)))
+ (/.capacity sample))))
+ (_.coverage [/.and]
+ (and (# /.equivalence = sample (/.and sample sample))
+ (same? /.empty (/.and sample (/.not sample)))))
)))))
diff --git a/stdlib/source/test/lux/data/collection/dictionary.lux b/stdlib/source/test/lux/data/collection/dictionary.lux
index 9c1121143..b48338682 100644
--- a/stdlib/source/test/lux/data/collection/dictionary.lux
+++ b/stdlib/source/test/lux/data/collection/dictionary.lux
@@ -39,18 +39,18 @@
test_val (random.only (|>> (list.member? n.equivalence (/.values dict)) not)
random.nat)]
(all _.and
- (_.cover [/.size]
- (n.= size (/.size dict)))
+ (_.coverage [/.size]
+ (n.= size (/.size dict)))
- (_.cover [/.empty?]
- (case size
- 0 (/.empty? dict)
- _ (not (/.empty? dict))))
+ (_.coverage [/.empty?]
+ (case size
+ 0 (/.empty? dict)
+ _ (not (/.empty? dict))))
- (_.cover [/.empty]
- (let [sample (/.empty n.hash)]
- (and (n.= 0 (/.size sample))
- (/.empty? sample))))
+ (_.coverage [/.empty]
+ (let [sample (/.empty n.hash)]
+ (and (n.= 0 (/.size sample))
+ (/.empty? sample))))
(do !
[constant random.nat
@@ -59,75 +59,75 @@
(def: equivalence n.equivalence)
(def: (hash _)
constant)))]]
- (_.cover [/.key_hash]
- (same? hash (/.key_hash (/.empty hash)))))
+ (_.coverage [/.key_hash]
+ (same? hash (/.key_hash (/.empty hash)))))
- (_.cover [/.entries]
- (let [entries (/.entries dict)
+ (_.coverage [/.entries]
+ (let [entries (/.entries dict)
- correct_size!
- (n.= (/.size dict)
- (list.size entries))
+ correct_size!
+ (n.= (/.size dict)
+ (list.size entries))
- unique_keys!
- (|> entries
- (list#each product.left)
- (set.of_list n.hash)
- set.size
- (n.= (/.size dict)))
+ unique_keys!
+ (|> entries
+ (list#each product.left)
+ (set.of_list n.hash)
+ set.size
+ (n.= (/.size dict)))
- correct_pairing!
- (list.every? (function (_ [key value])
- (|> dict
- (/.value key)
- (maybe#each (n.= value))
- (maybe.else false)))
- entries)]
- (and correct_size!
- unique_keys!
- correct_pairing!)))
- (_.cover [/.keys]
- (let [keys (/.keys dict)
+ correct_pairing!
+ (list.every? (function (_ [key value])
+ (|> dict
+ (/.value key)
+ (maybe#each (n.= value))
+ (maybe.else false)))
+ entries)]
+ (and correct_size!
+ unique_keys!
+ correct_pairing!)))
+ (_.coverage [/.keys]
+ (let [keys (/.keys dict)
- correct_size!
- (n.= (/.size dict)
- (list.size keys))
+ correct_size!
+ (n.= (/.size dict)
+ (list.size keys))
- unique_keys!
- (|> keys
- (set.of_list n.hash)
- set.size
- (n.= (/.size dict)))
+ unique_keys!
+ (|> keys
+ (set.of_list n.hash)
+ set.size
+ (n.= (/.size dict)))
- recognized!
- (list.every? (/.key? dict) keys)]
- (and correct_size!
- unique_keys!
- recognized!)))
- (_.cover [/.values]
- (n.= (/.size dict)
- (list.size (/.values dict))))
+ recognized!
+ (list.every? (/.key? dict) keys)]
+ (and correct_size!
+ unique_keys!
+ recognized!)))
+ (_.coverage [/.values]
+ (n.= (/.size dict)
+ (list.size (/.values dict))))
- (_.cover [/.composite]
- (let [merging_with_oneself (let [(open "[0]") (/.equivalence n.equivalence)]
- (= dict (/.composite dict dict)))
- overwritting_keys (let [dict' (|> dict /.entries
- (list#each (function (_ [k v]) [k (++ v)]))
- (/.of_list n.hash))
- (open "[0]") (/.equivalence n.equivalence)]
- (= dict' (/.composite dict' dict)))]
- (and merging_with_oneself
- overwritting_keys)))
+ (_.coverage [/.composite]
+ (let [merging_with_oneself (let [(open "[0]") (/.equivalence n.equivalence)]
+ (= dict (/.composite dict dict)))
+ overwritting_keys (let [dict' (|> dict /.entries
+ (list#each (function (_ [k v]) [k (++ v)]))
+ (/.of_list n.hash))
+ (open "[0]") (/.equivalence n.equivalence)]
+ (= dict' (/.composite dict' dict)))]
+ (and merging_with_oneself
+ overwritting_keys)))
- (_.cover [/.composite_with]
- (list.every? (function (_ [x x*2]) (n.= (n.* 2 x) x*2))
- (list.zipped_2 (/.values dict)
- (/.values (/.composite_with n.+ dict dict)))))
+ (_.coverage [/.composite_with]
+ (list.every? (function (_ [x x*2]) (n.= (n.* 2 x) x*2))
+ (list.zipped_2 (/.values dict)
+ (/.values (/.composite_with n.+ dict dict)))))
- (_.cover [/.of_list]
- (let [(open "[0]") (/.equivalence n.equivalence)]
- (and (= dict dict)
- (|> dict /.entries (/.of_list n.hash) (= dict)))))
+ (_.coverage [/.of_list]
+ (let [(open "[0]") (/.equivalence n.equivalence)]
+ (and (= dict dict)
+ (|> dict /.entries (/.of_list n.hash) (= dict)))))
)))
(def: for_entries
@@ -141,111 +141,111 @@
test_val (random.only (|>> (list.member? n.equivalence (/.values dict)) not)
random.nat)]
(all _.and
- (_.cover [/.key?]
- (list.every? (/.key? dict)
- (/.keys dict)))
+ (_.coverage [/.key?]
+ (list.every? (/.key? dict)
+ (/.keys dict)))
- (_.cover [/.value]
- (and (list.every? (function (_ key) (case (/.value key dict)
- {.#Some _} true
- _ false))
- (/.keys dict))
- (case (/.value non_key dict)
- {.#Some _} false
- _ true)))
+ (_.coverage [/.value]
+ (and (list.every? (function (_ key) (case (/.value key dict)
+ {.#Some _} true
+ _ false))
+ (/.keys dict))
+ (case (/.value non_key dict)
+ {.#Some _} false
+ _ true)))
- (_.cover [/.has]
- (and (n.= (++ (/.size dict))
- (/.size (/.has non_key test_val dict)))
- (case (/.value non_key (/.has non_key test_val dict))
- {.#Some v} (n.= test_val v)
- _ true)))
+ (_.coverage [/.has]
+ (and (n.= (++ (/.size dict))
+ (/.size (/.has non_key test_val dict)))
+ (case (/.value non_key (/.has non_key test_val dict))
+ {.#Some v} (n.= test_val v)
+ _ true)))
- (_.cover [/.has' /.key_already_exists]
- (let [can_put_new_keys!
- (case (/.has' non_key test_val dict)
- {try.#Success dict}
- (case (/.value non_key dict)
- {.#Some v} (n.= test_val v)
- _ true)
+ (_.coverage [/.has' /.key_already_exists]
+ (let [can_put_new_keys!
+ (case (/.has' non_key test_val dict)
+ {try.#Success dict}
+ (case (/.value non_key dict)
+ {.#Some v} (n.= test_val v)
+ _ true)
- {try.#Failure _}
- false)
-
- cannot_put_old_keys!
- (or (n.= 0 size)
- (let [first_key (|> dict /.keys list.head maybe.trusted)]
- (case (/.has' first_key test_val dict)
- {try.#Success _}
- false
-
- {try.#Failure error}
- (exception.match? /.key_already_exists error))))]
- (and can_put_new_keys!
- cannot_put_old_keys!)))
-
- (_.cover [/.lacks]
- (and (let [base (/.has non_key test_val dict)]
- (and (/.key? base non_key)
- (not (/.key? (/.lacks non_key base) non_key))))
- (case (list.head (/.keys dict))
- {.#None}
- true
+ {try.#Failure _}
+ false)
+
+ cannot_put_old_keys!
+ (or (n.= 0 size)
+ (let [first_key (|> dict /.keys list.head maybe.trusted)]
+ (case (/.has' first_key test_val dict)
+ {try.#Success _}
+ false
- {.#Some known_key}
- (n.= (-- (/.size dict))
- (/.size (/.lacks known_key dict))))))
+ {try.#Failure error}
+ (exception.match? /.key_already_exists error))))]
+ (and can_put_new_keys!
+ cannot_put_old_keys!)))
+
+ (_.coverage [/.lacks]
+ (and (let [base (/.has non_key test_val dict)]
+ (and (/.key? base non_key)
+ (not (/.key? (/.lacks non_key base) non_key))))
+ (case (list.head (/.keys dict))
+ {.#None}
+ true
+
+ {.#Some known_key}
+ (n.= (-- (/.size dict))
+ (/.size (/.lacks known_key dict))))))
- (_.cover [/.revised]
- (let [base (/.has non_key test_val dict)
- updt (/.revised non_key ++ base)]
- (case [(/.value non_key base) (/.value non_key updt)]
- [{.#Some x} {.#Some y}]
- (n.= (++ x) y)
+ (_.coverage [/.revised]
+ (let [base (/.has non_key test_val dict)
+ updt (/.revised non_key ++ base)]
+ (case [(/.value non_key base) (/.value non_key updt)]
+ [{.#Some x} {.#Some y}]
+ (n.= (++ x) y)
- _
- false)))
+ _
+ false)))
- (_.cover [/.revised']
- (let [can_upsert_new_key!
- (case (/.value non_key (/.revised' non_key test_val ++ dict))
- {.#Some inserted}
- (n.= (++ test_val) inserted)
+ (_.coverage [/.revised']
+ (let [can_upsert_new_key!
+ (case (/.value non_key (/.revised' non_key test_val ++ dict))
+ {.#Some inserted}
+ (n.= (++ test_val) inserted)
- {.#None}
- false)
+ {.#None}
+ false)
- can_upsert_old_key!
- (case (list.head (/.entries dict))
- {.#None}
- true
-
- {.#Some [known_key known_value]}
- (case (/.value known_key (/.revised' known_key test_val ++ dict))
- {.#Some updated}
- (n.= (++ known_value) updated)
+ can_upsert_old_key!
+ (case (list.head (/.entries dict))
+ {.#None}
+ true
+
+ {.#Some [known_key known_value]}
+ (case (/.value known_key (/.revised' known_key test_val ++ dict))
+ {.#Some updated}
+ (n.= (++ known_value) updated)
- {.#None}
- false))]
- (and can_upsert_new_key!
- can_upsert_old_key!)))
+ {.#None}
+ false))]
+ (and can_upsert_new_key!
+ can_upsert_old_key!)))
- (_.cover [/.sub]
- (|> dict
- (/.has non_key test_val)
- (/.sub (list non_key))
- /.size
- (n.= 1)))
+ (_.coverage [/.sub]
+ (|> dict
+ (/.has non_key test_val)
+ (/.sub (list non_key))
+ /.size
+ (n.= 1)))
- (_.cover [/.re_bound]
- (or (n.= 0 size)
- (let [first_key (|> dict /.keys list.head maybe.trusted)
- rebound (/.re_bound first_key non_key dict)]
- (and (n.= (/.size dict) (/.size rebound))
- (/.key? rebound non_key)
- (not (/.key? rebound first_key))
- (n.= (maybe.trusted (/.value first_key dict))
- (maybe.trusted (/.value non_key rebound)))))))
+ (_.coverage [/.re_bound]
+ (or (n.= 0 size)
+ (let [first_key (|> dict /.keys list.head maybe.trusted)
+ rebound (/.re_bound first_key non_key dict)]
+ (and (n.= (/.size dict) (/.size rebound))
+ (/.key? rebound non_key)
+ (not (/.key? rebound first_key))
+ (n.= (maybe.trusted (/.value first_key dict))
+ (maybe.trusted (/.value non_key rebound)))))))
)))
(def: .public test
diff --git a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux
index 6dd9ce772..6e3acefa2 100644
--- a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux
+++ b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux
@@ -66,72 +66,72 @@
(_.for [/.equivalence]
($equivalence.spec (/.equivalence n.equivalence) (..dictionary n.order random.nat random.nat size)))
- (_.cover [/.size]
- (n.= size (/.size sample)))
- (_.cover [/.empty?]
- (bit#= (n.= 0 (/.size sample))
- (/.empty? sample)))
- (_.cover [/.empty]
- (/.empty? (/.empty n.order)))
- (_.cover [/.min]
- (case [(/.min sample) (list.head sorted_values)]
- [{.#None} {.#None}]
- #1
+ (_.coverage [/.size]
+ (n.= size (/.size sample)))
+ (_.coverage [/.empty?]
+ (bit#= (n.= 0 (/.size sample))
+ (/.empty? sample)))
+ (_.coverage [/.empty]
+ (/.empty? (/.empty n.order)))
+ (_.coverage [/.min]
+ (case [(/.min sample) (list.head sorted_values)]
+ [{.#None} {.#None}]
+ #1
- [{.#Some reference} {.#Some sample}]
- (n.= reference sample)
+ [{.#Some reference} {.#Some sample}]
+ (n.= reference sample)
- _
- #0))
- (_.cover [/.max]
- (case [(/.max sample) (list.last sorted_values)]
- [{.#None} {.#None}]
- #1
+ _
+ #0))
+ (_.coverage [/.max]
+ (case [(/.max sample) (list.last sorted_values)]
+ [{.#None} {.#None}]
+ #1
- [{.#Some reference} {.#Some sample}]
- (n.= reference sample)
+ [{.#Some reference} {.#Some sample}]
+ (n.= reference sample)
- _
- #0))
- (_.cover [/.entries]
- (list#= (/.entries sample)
- sorted_pairs))
- (_.cover [/.keys /.values]
- (list#= (/.entries sample)
- (list.zipped_2 (/.keys sample) (/.values sample))))
- (_.cover [/.of_list]
- (|> sample
- /.entries (/.of_list n.order)
- (/#= sample)))
- (_.cover [/.key?]
- (and (list.every? (/.key? sample)
- (/.keys sample))
- (not (/.key? sample extra_key))))
- (_.cover [/.has]
- (and (not (/.key? sample extra_key))
- (let [sample+ (/.has extra_key extra_value sample)]
- (and (/.key? sample+ extra_key)
- (n.= (++ (/.size sample))
- (/.size sample+))))))
- (_.cover [/.value]
- (let [sample+ (/.has extra_key extra_value sample)]
- (case [(/.value extra_key sample)
- (/.value extra_key sample+)]
- [{.#None} {.#Some actual}]
- (n.= extra_value actual)
-
- _
- false)))
- (_.cover [/.lacks]
- (|> sample
- (/.has extra_key extra_value)
- (/.lacks extra_key)
- (/#= sample)))
- (_.cover [/.revised]
- (|> sample
- (/.has extra_key extra_value)
- (/.revised extra_key (n.+ shift))
- (/.value extra_key)
- (maybe#each (n.= (n.+ shift extra_value)))
- (maybe.else false)))
+ _
+ #0))
+ (_.coverage [/.entries]
+ (list#= (/.entries sample)
+ sorted_pairs))
+ (_.coverage [/.keys /.values]
+ (list#= (/.entries sample)
+ (list.zipped_2 (/.keys sample) (/.values sample))))
+ (_.coverage [/.of_list]
+ (|> sample
+ /.entries (/.of_list n.order)
+ (/#= sample)))
+ (_.coverage [/.key?]
+ (and (list.every? (/.key? sample)
+ (/.keys sample))
+ (not (/.key? sample extra_key))))
+ (_.coverage [/.has]
+ (and (not (/.key? sample extra_key))
+ (let [sample+ (/.has extra_key extra_value sample)]
+ (and (/.key? sample+ extra_key)
+ (n.= (++ (/.size sample))
+ (/.size sample+))))))
+ (_.coverage [/.value]
+ (let [sample+ (/.has extra_key extra_value sample)]
+ (case [(/.value extra_key sample)
+ (/.value extra_key sample+)]
+ [{.#None} {.#Some actual}]
+ (n.= extra_value actual)
+
+ _
+ false)))
+ (_.coverage [/.lacks]
+ (|> sample
+ (/.has extra_key extra_value)
+ (/.lacks extra_key)
+ (/#= sample)))
+ (_.coverage [/.revised]
+ (|> sample
+ (/.has extra_key extra_value)
+ (/.revised extra_key (n.+ shift))
+ (/.value extra_key)
+ (maybe#each (n.= (n.+ shift extra_value)))
+ (maybe.else false)))
))))
diff --git a/stdlib/source/test/lux/data/collection/dictionary/plist.lux b/stdlib/source/test/lux/data/collection/dictionary/plist.lux
index 113b166f3..ecac86868 100644
--- a/stdlib/source/test/lux/data/collection/dictionary/plist.lux
+++ b/stdlib/source/test/lux/data/collection/dictionary/plist.lux
@@ -53,45 +53,45 @@
/.monoid
(..random 10 (random.lower_case 1) random.nat)))
- (_.cover [/.size]
- (n.= size (/.size sample)))
- (_.cover [/.empty?]
- (bit#= (n.= 0 (/.size sample))
- (/.empty? sample)))
- (_.cover [/.empty]
- (/.empty? /.empty))
- (_.cover [/.keys /.values]
- (# (/.equivalence n.equivalence) =
- sample
- (list.zipped_2 (/.keys sample)
- (/.values sample))))
- (_.cover [/.contains?]
- (and (list.every? (function (_ key)
- (/.contains? key sample))
- (/.keys sample))
- (not (/.contains? extra_key sample))))
- (_.cover [/.has]
- (let [sample+ (/.has extra_key extra_value sample)]
- (and (not (/.contains? extra_key sample))
- (/.contains? extra_key sample+)
- (n.= (++ (/.size sample))
- (/.size sample+)))))
- (_.cover [/.value]
- (|> sample
- (/.has extra_key extra_value)
- (/.value extra_key)
- (maybe#each (n.= extra_value))
- (maybe.else false)))
- (_.cover [/.revised]
- (|> sample
- (/.has extra_key extra_value)
- (/.revised extra_key (n.+ shift))
- (/.value extra_key)
- (maybe#each (n.= (n.+ shift extra_value)))
- (maybe.else false)))
- (_.cover [/.lacks]
- (|> sample
- (/.has extra_key extra_value)
- (/.lacks extra_key)
- (# (/.equivalence n.equivalence) = sample)))
+ (_.coverage [/.size]
+ (n.= size (/.size sample)))
+ (_.coverage [/.empty?]
+ (bit#= (n.= 0 (/.size sample))
+ (/.empty? sample)))
+ (_.coverage [/.empty]
+ (/.empty? /.empty))
+ (_.coverage [/.keys /.values]
+ (# (/.equivalence n.equivalence) =
+ sample
+ (list.zipped_2 (/.keys sample)
+ (/.values sample))))
+ (_.coverage [/.contains?]
+ (and (list.every? (function (_ key)
+ (/.contains? key sample))
+ (/.keys sample))
+ (not (/.contains? extra_key sample))))
+ (_.coverage [/.has]
+ (let [sample+ (/.has extra_key extra_value sample)]
+ (and (not (/.contains? extra_key sample))
+ (/.contains? extra_key sample+)
+ (n.= (++ (/.size sample))
+ (/.size sample+)))))
+ (_.coverage [/.value]
+ (|> sample
+ (/.has extra_key extra_value)
+ (/.value extra_key)
+ (maybe#each (n.= extra_value))
+ (maybe.else false)))
+ (_.coverage [/.revised]
+ (|> sample
+ (/.has extra_key extra_value)
+ (/.revised extra_key (n.+ shift))
+ (/.value extra_key)
+ (maybe#each (n.= (n.+ shift extra_value)))
+ (maybe.else false)))
+ (_.coverage [/.lacks]
+ (|> sample
+ (/.has extra_key extra_value)
+ (/.lacks extra_key)
+ (# (/.equivalence n.equivalence) = sample)))
))))
diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux
index 379c31458..9351adb21 100644
--- a/stdlib/source/test/lux/data/collection/list.lux
+++ b/stdlib/source/test/lux/data/collection/list.lux
@@ -71,17 +71,17 @@
(let [lifted (/.lifted io.monad)
(open "io#[0]") io.monad
expected (n.+ parameter subject)]
- (_.cover [/.with /.lifted]
- (|> (io.run! (do (/.with io.monad)
- [a (lifted (io#in parameter))
- b (in subject)]
- (in (n.+ a b))))
- (pipe.case
- (pattern (list actual))
- (n.= expected actual)
-
- _
- false)))))
+ (_.coverage [/.with /.lifted]
+ (|> (io.run! (do (/.with io.monad)
+ [a (lifted (io#in parameter))
+ b (in subject)]
+ (in (n.+ a b))))
+ (pipe.case
+ (pattern (list actual))
+ (n.= expected actual)
+
+ _
+ false)))))
))
(def: whole
@@ -91,41 +91,41 @@
.let [(open "/#[0]") (/.equivalence n.equivalence)]
sample (# ! each set.list (random.set n.hash size random.nat))]
(all _.and
- (_.cover [/.size]
- (n.= size (/.size sample)))
- (_.cover [/.empty?]
- (# bit.equivalence =
- (/.empty? sample)
- (n.= 0 (/.size sample))))
- (_.cover [/.repeated]
- (n.= size (/.size (/.repeated size []))))
- (_.cover [/.reversed]
- (or (n.< 2 (/.size sample))
- (let [not_same!
- (not (/#= sample
- (/.reversed sample)))
+ (_.coverage [/.size]
+ (n.= size (/.size sample)))
+ (_.coverage [/.empty?]
+ (# bit.equivalence =
+ (/.empty? sample)
+ (n.= 0 (/.size sample))))
+ (_.coverage [/.repeated]
+ (n.= size (/.size (/.repeated size []))))
+ (_.coverage [/.reversed]
+ (or (n.< 2 (/.size sample))
+ (let [not_same!
+ (not (/#= sample
+ (/.reversed sample)))
- self_symmetry!
- (/#= sample
- (/.reversed (/.reversed sample)))]
- (and not_same!
- self_symmetry!))))
- (_.cover [/.every? /.any?]
- (if (/.every? n.even? sample)
- (not (/.any? (bit.complement n.even?) sample))
- (/.any? (bit.complement n.even?) sample)))
- (_.cover [/.sorted]
- (let [<<< n.<
-
- size_preservation!
- (n.= (/.size sample)
- (/.size (/.sorted <<< sample)))
-
- symmetry!
- (/#= (/.sorted <<< sample)
- (/.reversed (/.sorted (function.flipped <<<) sample)))]
- (and size_preservation!
- symmetry!)))
+ self_symmetry!
+ (/#= sample
+ (/.reversed (/.reversed sample)))]
+ (and not_same!
+ self_symmetry!))))
+ (_.coverage [/.every? /.any?]
+ (if (/.every? n.even? sample)
+ (not (/.any? (bit.complement n.even?) sample))
+ (/.any? (bit.complement n.even?) sample)))
+ (_.coverage [/.sorted]
+ (let [<<< n.<
+
+ size_preservation!
+ (n.= (/.size sample)
+ (/.size (/.sorted <<< sample)))
+
+ symmetry!
+ (/#= (/.sorted <<< sample)
+ (/.reversed (/.sorted (function.flipped <<<) sample)))]
+ (and size_preservation!
+ symmetry!)))
)))
(def: indices
@@ -136,56 +136,56 @@
[sample ..random
.let [size (/.size sample)]]
(all _.and
- (_.cover [/.indices]
- (let [indices (/.indices size)
+ (_.coverage [/.indices]
+ (let [indices (/.indices size)
- expected_amount!
- (n.= size (/.size indices))
+ expected_amount!
+ (n.= size (/.size indices))
- already_sorted!
- (/#= indices
- (/.sorted n.< indices))
+ already_sorted!
+ (/#= indices
+ (/.sorted n.< indices))
- expected_numbers!
- (/.every? (n.= (-- size))
- (/.zipped_with_2 n.+
- indices
- (/.sorted n.> indices)))]
- (and expected_amount!
- already_sorted!
- expected_numbers!)))
- (_.cover [/.enumeration]
- (let [enumeration (/.enumeration sample)
+ expected_numbers!
+ (/.every? (n.= (-- size))
+ (/.zipped_with_2 n.+
+ indices
+ (/.sorted n.> indices)))]
+ (and expected_amount!
+ already_sorted!
+ expected_numbers!)))
+ (_.coverage [/.enumeration]
+ (let [enumeration (/.enumeration sample)
- has_correct_indices!
- (/#= (/.indices (/.size enumeration))
- (/#each product.left enumeration))
+ has_correct_indices!
+ (/#= (/.indices (/.size enumeration))
+ (/#each product.left enumeration))
- has_correct_values!
- (/#= sample
- (/#each product.right enumeration))]
- (and has_correct_indices!
- has_correct_values!)))
- (_.cover [/.item]
- (/.every? (function (_ [index expected])
- (case (/.item index sample)
- {.#Some actual}
- (n.= expected actual)
-
- {.#None}
- false))
- (/.enumeration sample)))
+ has_correct_values!
+ (/#= sample
+ (/#each product.right enumeration))]
+ (and has_correct_indices!
+ has_correct_values!)))
+ (_.coverage [/.item]
+ (/.every? (function (_ [index expected])
+ (case (/.item index sample)
+ {.#Some actual}
+ (n.= expected actual)
+
+ {.#None}
+ false))
+ (/.enumeration sample)))
(do !
[index (case size
0 random.nat
_ (# ! each (n.% size) random.nat))
.let [changed? (/#= sample (/.revised index ++ sample))
same? (/#= sample (/.revised size ++ sample))]]
- (_.cover [/.revised]
- (case size
- 0 (and changed?
- same?)
- _ (not changed?))))
+ (_.coverage [/.revised]
+ (case size
+ 0 (and changed?
+ same?)
+ _ (not changed?))))
))))
(def: slice
@@ -199,42 +199,42 @@
idx (# ! each (n.% size) random.nat)
sub_size (# ! each (|>> (n.% size) ++) random.nat)]
(all _.and
- (_.cover [/.only]
- (let [positives (/.only n.even? sample)
- negatives (/.only (bit.complement n.even?) sample)]
- (and (/.every? n.even? positives)
- (not (/.any? n.even? negatives))
+ (_.coverage [/.only]
+ (let [positives (/.only n.even? sample)
+ negatives (/.only (bit.complement n.even?) sample)]
+ (and (/.every? n.even? positives)
+ (not (/.any? n.even? negatives))
- (n.= (/.size sample)
- (n.+ (/.size positives)
- (/.size negatives))))))
- (_.cover [/.partition]
- (let [[positives negatives] (/.partition n.even? sample)]
- (and (/#= (/.only n.even? sample)
- positives)
- (/#= (/.only (bit.complement n.even?) sample)
- negatives))))
- (_.cover [/.split_at]
- (let [[left right] (/.split_at idx sample)]
- (/#= sample
- (/#composite left right))))
- (_.cover [/.split_when]
- (let [[left right] (/.split_when n.even? sample)]
- (/#= sample
- (/#composite left right))))
- (_.cover [/.first /.after]
+ (n.= (/.size sample)
+ (n.+ (/.size positives)
+ (/.size negatives))))))
+ (_.coverage [/.partition]
+ (let [[positives negatives] (/.partition n.even? sample)]
+ (and (/#= (/.only n.even? sample)
+ positives)
+ (/#= (/.only (bit.complement n.even?) sample)
+ negatives))))
+ (_.coverage [/.split_at]
+ (let [[left right] (/.split_at idx sample)]
+ (/#= sample
+ (/#composite left right))))
+ (_.coverage [/.split_when]
+ (let [[left right] (/.split_when n.even? sample)]
+ (/#= sample
+ (/#composite left right))))
+ (_.coverage [/.first /.after]
+ (/#= sample
+ (/#composite (/.first idx sample)
+ (/.after idx sample))))
+ (_.coverage [/.while /.until]
+ (/#= sample
+ (/#composite (/.while n.even? sample)
+ (/.until n.even? sample))))
+ (_.coverage [/.sub]
+ (let [subs (/.sub sub_size sample)]
+ (and (/.every? (|>> /.size (n.<= sub_size)) subs)
(/#= sample
- (/#composite (/.first idx sample)
- (/.after idx sample))))
- (_.cover [/.while /.until]
- (/#= sample
- (/#composite (/.while n.even? sample)
- (/.until n.even? sample))))
- (_.cover [/.sub]
- (let [subs (/.sub sub_size sample)]
- (and (/.every? (|>> /.size (n.<= sub_size)) subs)
- (/#= sample
- (/.together subs)))))
+ (/.together subs)))))
))))
(def: member
@@ -243,31 +243,31 @@
(do [! random.monad]
[sample ..random]
(`` (all _.and
- (_.cover [/.member?]
- (/.every? (/.member? n.equivalence sample)
- sample))
+ (_.coverage [/.member?]
+ (/.every? (/.member? n.equivalence sample)
+ sample))
(~~ (template [<head> <tail> <pre>]
[(all _.and
- (_.cover [<head>]
- (case [(<pre> sample) (<head> sample)]
- [{.#Item expected _} {.#Some actual}]
- (n.= expected actual)
+ (_.coverage [<head>]
+ (case [(<pre> sample) (<head> sample)]
+ [{.#Item expected _} {.#Some actual}]
+ (n.= expected actual)
- [{.#End} {.#None}]
- true
+ [{.#End} {.#None}]
+ true
- _
- false))
- (_.cover [<tail>]
- (case [(<pre> sample) (<tail> sample)]
- [{.#Item _ expected} {.#Some actual}]
- (/#= (<pre> expected) actual)
+ _
+ false))
+ (_.coverage [<tail>]
+ (case [(<pre> sample) (<tail> sample)]
+ [{.#Item _ expected} {.#Some actual}]
+ (/#= (<pre> expected) actual)
- [{.#End} {.#None}]
- true
+ [{.#End} {.#None}]
+ true
- _
- false))
+ _
+ false))
)]
[/.head /.tail |>]
@@ -292,82 +292,82 @@
sample/1 ..random
sample/2 ..random]
(all _.and
- (_.cover [/.pairs]
- (let [even_sized? (|> sample/0
- /.size
- (n.% 2)
- (n.= 0))]
- (case (/.pairs sample/0)
- {.#Some pairs/0}
- (and even_sized?
- (n.= (n./ 2 (/.size sample/0))
- (/.size pairs/0)))
+ (_.coverage [/.pairs]
+ (let [even_sized? (|> sample/0
+ /.size
+ (n.% 2)
+ (n.= 0))]
+ (case (/.pairs sample/0)
+ {.#Some pairs/0}
+ (and even_sized?
+ (n.= (n./ 2 (/.size sample/0))
+ (/.size pairs/0)))
- {.#None}
- (not even_sized?))))
- (_.cover [/.zipped_2]
- (let [zipped (/.zipped_2 sample/0 sample/1)
- zipped::size (/.size zipped)
+ {.#None}
+ (not even_sized?))))
+ (_.coverage [/.zipped_2]
+ (let [zipped (/.zipped_2 sample/0 sample/1)
+ zipped::size (/.size zipped)
- size_of_smaller_list!
- (n.= zipped::size
- (n.min (/.size sample/0) (/.size sample/1)))
+ size_of_smaller_list!
+ (n.= zipped::size
+ (n.min (/.size sample/0) (/.size sample/1)))
- can_extract_values!
- (and (/#= (/.first zipped::size sample/0)
- (/#each product.left zipped))
- (/#= (/.first zipped::size sample/1)
- (/#each product.right zipped)))]
- (and size_of_smaller_list!
- can_extract_values!)))
- (_.cover [/.zipped_3]
- (let [zipped (/.zipped_3 sample/0 sample/1 sample/2)
- zipped::size (/.size zipped)
-
- size_of_smaller_list!
- (n.= zipped::size
- (all n.min
- (/.size sample/0)
- (/.size sample/1)
- (/.size sample/2)))
+ can_extract_values!
+ (and (/#= (/.first zipped::size sample/0)
+ (/#each product.left zipped))
+ (/#= (/.first zipped::size sample/1)
+ (/#each product.right zipped)))]
+ (and size_of_smaller_list!
+ can_extract_values!)))
+ (_.coverage [/.zipped_3]
+ (let [zipped (/.zipped_3 sample/0 sample/1 sample/2)
+ zipped::size (/.size zipped)
+
+ size_of_smaller_list!
+ (n.= zipped::size
+ (all n.min
+ (/.size sample/0)
+ (/.size sample/1)
+ (/.size sample/2)))
- can_extract_values!
- (and (/#= (/.first zipped::size sample/0)
- (/#each product.left zipped))
- (/#= (/.first zipped::size sample/1)
- (/#each (|>> product.right product.left) zipped))
- (/#= (/.first zipped::size sample/2)
- (/#each (|>> product.right product.right) zipped)))]
- (and size_of_smaller_list!
- can_extract_values!)))
- (_.cover [/.zipped]
- (and (# (/.equivalence (product.equivalence n.equivalence n.equivalence)) =
- (/.zipped_2 sample/0 sample/1)
- ((/.zipped 2) sample/0 sample/1))
- (# (/.equivalence (all product.equivalence n.equivalence n.equivalence n.equivalence)) =
- (/.zipped_3 sample/0 sample/1 sample/2)
- ((/.zipped 3) sample/0 sample/1 sample/2))))
+ can_extract_values!
+ (and (/#= (/.first zipped::size sample/0)
+ (/#each product.left zipped))
+ (/#= (/.first zipped::size sample/1)
+ (/#each (|>> product.right product.left) zipped))
+ (/#= (/.first zipped::size sample/2)
+ (/#each (|>> product.right product.right) zipped)))]
+ (and size_of_smaller_list!
+ can_extract_values!)))
+ (_.coverage [/.zipped]
+ (and (# (/.equivalence (product.equivalence n.equivalence n.equivalence)) =
+ (/.zipped_2 sample/0 sample/1)
+ ((/.zipped 2) sample/0 sample/1))
+ (# (/.equivalence (all product.equivalence n.equivalence n.equivalence n.equivalence)) =
+ (/.zipped_3 sample/0 sample/1 sample/2)
+ ((/.zipped 3) sample/0 sample/1 sample/2))))
- (_.cover [/.zipped_with_2]
- (/#= (/#each (function (_ [left right])
- (+/2 left right))
- (/.zipped_2 sample/0 sample/1))
- (/.zipped_with_2 +/2 sample/0 sample/1)))
- (_.cover [/.zipped_with_3]
- (/#= (/#each (function (_ [left mid right])
- (+/3 left mid right))
- (/.zipped_3 sample/0 sample/1 sample/2))
- (/.zipped_with_3 +/3 sample/0 sample/1 sample/2)))
- (_.cover [/.zipped_with]
- (and (/#= (/.zipped_with_2 +/2 sample/0 sample/1)
- ((/.zipped_with 2) +/2 sample/0 sample/1))
- (/#= (/.zipped_with_3 +/3 sample/0 sample/1 sample/2)
- ((/.zipped_with 3) +/3 sample/0 sample/1 sample/2))))
- (_.cover [/.together]
- (and (/#= (/#composite sample/0 sample/1)
- (/.together (list sample/0 sample/1)))
- (/#= (all /#composite sample/0 sample/1 sample/2)
- (/.together (list sample/0 sample/1 sample/2)))))
+ (_.coverage [/.zipped_with_2]
+ (/#= (/#each (function (_ [left right])
+ (+/2 left right))
+ (/.zipped_2 sample/0 sample/1))
+ (/.zipped_with_2 +/2 sample/0 sample/1)))
+ (_.coverage [/.zipped_with_3]
+ (/#= (/#each (function (_ [left mid right])
+ (+/3 left mid right))
+ (/.zipped_3 sample/0 sample/1 sample/2))
+ (/.zipped_with_3 +/3 sample/0 sample/1 sample/2)))
+ (_.coverage [/.zipped_with]
+ (and (/#= (/.zipped_with_2 +/2 sample/0 sample/1)
+ ((/.zipped_with 2) +/2 sample/0 sample/1))
+ (/#= (/.zipped_with_3 +/3 sample/0 sample/1 sample/2)
+ ((/.zipped_with 3) +/3 sample/0 sample/1 sample/2))))
+ (_.coverage [/.together]
+ (and (/#= (/#composite sample/0 sample/1)
+ (/.together (list sample/0 sample/1)))
+ (/#= (all /#composite sample/0 sample/1 sample/2)
+ (/.together (list sample/0 sample/1 sample/2)))))
))))
(def: search
@@ -382,33 +382,33 @@
(do [! random.monad]
[sample ..random]
(all _.and
- (_.cover [/.one]
- (case [(|> sample
- (/.only n.even?)
- (/#each (# n.decimal encoded))
- /.head)
- (/.one choice sample)]
- [{.#Some expected} {.#Some actual}]
- (text#= expected actual)
+ (_.coverage [/.one]
+ (case [(|> sample
+ (/.only n.even?)
+ (/#each (# n.decimal encoded))
+ /.head)
+ (/.one choice sample)]
+ [{.#Some expected} {.#Some actual}]
+ (text#= expected actual)
- [{.#None} {.#None}]
- true
+ [{.#None} {.#None}]
+ true
- _
- false))
- (_.cover [/.all]
- (# (/.equivalence text.equivalence) =
- (|> sample
- (/.only n.even?)
- (/#each (# n.decimal encoded)))
- (/.all choice sample)))
- (_.cover [/.example]
- (case (/.example n.even? sample)
- {.#Some found}
- (n.even? found)
+ _
+ false))
+ (_.coverage [/.all]
+ (# (/.equivalence text.equivalence) =
+ (|> sample
+ (/.only n.even?)
+ (/#each (# n.decimal encoded)))
+ (/.all choice sample)))
+ (_.coverage [/.example]
+ (case (/.example n.even? sample)
+ {.#Some found}
+ (n.even? found)
- {.#None}
- (not (/.any? n.even? sample))))
+ {.#None}
+ (not (/.any? n.even? sample))))
))))
(def: .public test
@@ -429,33 +429,33 @@
..grouping
..search
- (_.cover [/.interposed]
- (or (/.empty? sample)
- (let [sample+ (/.interposed separator sample)]
- (and (n.= (|> (/.size sample) (n.* 2) --)
- (/.size sample+))
- (|> sample+
- /.pairs
- (maybe.else (list))
- (/.every? (|>> product.right (n.= separator))))))))
- (_.cover [/.iterations]
- (or (/.empty? sample)
- (let [size (/.size sample)]
- (/#= (/.indices size)
- (/.iterations (function (_ index)
- (if (n.< size index)
- {.#Some (++ index)}
- {.#None}))
- 0)))))
- (_.cover [/.mixes]
- (/#= (/#each (function (_ index)
- (# /.mix mix n.+ 0 (/.first index sample)))
- (/.indices (++ (/.size sample))))
- (/.mixes n.+ 0 sample)))
+ (_.coverage [/.interposed]
+ (or (/.empty? sample)
+ (let [sample+ (/.interposed separator sample)]
+ (and (n.= (|> (/.size sample) (n.* 2) --)
+ (/.size sample+))
+ (|> sample+
+ /.pairs
+ (maybe.else (list))
+ (/.every? (|>> product.right (n.= separator))))))))
+ (_.coverage [/.iterations]
+ (or (/.empty? sample)
+ (let [size (/.size sample)]
+ (/#= (/.indices size)
+ (/.iterations (function (_ index)
+ (if (n.< size index)
+ {.#Some (++ index)}
+ {.#None}))
+ 0)))))
+ (_.coverage [/.mixes]
+ (/#= (/#each (function (_ index)
+ (# /.mix mix n.+ 0 (/.first index sample)))
+ (/.indices (++ (/.size sample))))
+ (/.mixes n.+ 0 sample)))
(do random.monad
[expected random.nat
.let [(open "/#[0]") (/.equivalence n.equivalence)]]
- (_.cover [/.when]
- (and (/#= (list expected) (/.when true (list expected)))
- (/#= (list) (/.when false (list expected))))))
+ (_.coverage [/.when]
+ (and (/#= (list expected) (/.when true (list expected)))
+ (/#= (list) (/.when false (list expected))))))
)))))
diff --git a/stdlib/source/test/lux/data/collection/queue.lux b/stdlib/source/test/lux/data/collection/queue.lux
index aa6365a41..ef8575e81 100644
--- a/stdlib/source/test/lux/data/collection/queue.lux
+++ b/stdlib/source/test/lux/data/collection/queue.lux
@@ -40,80 +40,80 @@
(_.for [/.functor]
($functor.spec ..injection /.equivalence /.functor))
- (_.cover [/.of_list /.list]
- (|> members /.of_list /.list
- (# (list.equivalence n.equivalence) = members)))
- (_.cover [/.size]
- (n.= size (/.size sample)))
- (_.cover [/.empty?]
- (bit#= (n.= 0 size) (/.empty? sample)))
- (_.cover [/.empty]
- (let [empty_is_empty!
- (/.empty? /.empty)
+ (_.coverage [/.of_list /.list]
+ (|> members /.of_list /.list
+ (# (list.equivalence n.equivalence) = members)))
+ (_.coverage [/.size]
+ (n.= size (/.size sample)))
+ (_.coverage [/.empty?]
+ (bit#= (n.= 0 size) (/.empty? sample)))
+ (_.coverage [/.empty]
+ (let [empty_is_empty!
+ (/.empty? /.empty)
- all_empty_queues_look_the_same!
- (bit#= (/.empty? sample)
- (# (/.equivalence n.equivalence) =
- sample
- /.empty))]
- (and empty_is_empty!
- all_empty_queues_look_the_same!)))
- (_.cover [/.front]
- (case [members (/.front sample)]
- [{.#Item head tail} {.#Some first}]
- (n.= head first)
-
- [{.#End} {.#None}]
- true
+ all_empty_queues_look_the_same!
+ (bit#= (/.empty? sample)
+ (# (/.equivalence n.equivalence) =
+ sample
+ /.empty))]
+ (and empty_is_empty!
+ all_empty_queues_look_the_same!)))
+ (_.coverage [/.front]
+ (case [members (/.front sample)]
+ [{.#Item head tail} {.#Some first}]
+ (n.= head first)
+
+ [{.#End} {.#None}]
+ true
- _
- false))
- (_.cover [/.member?]
- (let [every_member_is_identified!
- (list.every? (/.member? n.equivalence sample)
- (/.list sample))
+ _
+ false))
+ (_.coverage [/.member?]
+ (let [every_member_is_identified!
+ (list.every? (/.member? n.equivalence sample)
+ (/.list sample))
- non_member_is_not_identified!
- (not (/.member? n.equivalence sample non_member))]
- (and every_member_is_identified!
- non_member_is_not_identified!)))
- (_.cover [/.end]
- (let [pushed (/.end non_member sample)
+ non_member_is_not_identified!
+ (not (/.member? n.equivalence sample non_member))]
+ (and every_member_is_identified!
+ non_member_is_not_identified!)))
+ (_.coverage [/.end]
+ (let [pushed (/.end non_member sample)
- size_increases!
- (n.= (++ (/.size sample)) (/.size pushed))
+ size_increases!
+ (n.= (++ (/.size sample)) (/.size pushed))
- new_member_is_identified!
- (/.member? n.equivalence pushed non_member)
+ new_member_is_identified!
+ (/.member? n.equivalence pushed non_member)
- has_expected_order!
- (# (list.equivalence n.equivalence) =
- (list#composite (/.list sample) (list non_member))
- (/.list pushed))]
- (and size_increases!
- new_member_is_identified!
- has_expected_order!)))
- (_.cover [/.next]
- (case members
- {.#Item target expected}
- (let [popped (/.next sample)
+ has_expected_order!
+ (# (list.equivalence n.equivalence) =
+ (list#composite (/.list sample) (list non_member))
+ (/.list pushed))]
+ (and size_increases!
+ new_member_is_identified!
+ has_expected_order!)))
+ (_.coverage [/.next]
+ (case members
+ {.#Item target expected}
+ (let [popped (/.next sample)
- size_decreases!
- (n.= (-- (/.size sample))
- (/.size popped))
+ size_decreases!
+ (n.= (-- (/.size sample))
+ (/.size popped))
- popped_member_is_not_identified!
- (not (/.member? n.equivalence popped target))
+ popped_member_is_not_identified!
+ (not (/.member? n.equivalence popped target))
- has_expected_order!
- (# (list.equivalence n.equivalence) =
- expected
- (/.list popped))]
- (and size_decreases!
- popped_member_is_not_identified!
- has_expected_order!))
-
- {.#End}
- (and (/.empty? sample)
- (/.empty? (/.next sample)))))
+ has_expected_order!
+ (# (list.equivalence n.equivalence) =
+ expected
+ (/.list popped))]
+ (and size_decreases!
+ popped_member_is_not_identified!
+ has_expected_order!))
+
+ {.#End}
+ (and (/.empty? sample)
+ (/.empty? (/.next sample)))))
))))
diff --git a/stdlib/source/test/lux/data/collection/queue/priority.lux b/stdlib/source/test/lux/data/collection/queue/priority.lux
index d0a8faf6c..c802d6368 100644
--- a/stdlib/source/test/lux/data/collection/queue/priority.lux
+++ b/stdlib/source/test/lux/data/collection/queue/priority.lux
@@ -40,55 +40,55 @@
max_member random.nat
min_member random.nat]
(all _.and
- (_.cover [/.size]
- (n.= size (/.size sample)))
- (_.cover [/.empty?]
- (bit#= (n.= 0 (/.size sample))
- (/.empty? sample)))
- (_.cover [/.empty]
- (/.empty? /.empty))
- (_.cover [/.front]
- (case (/.front sample)
- {.#Some first}
- (n.> 0 (/.size sample))
-
- {.#None}
- (/.empty? sample)))
- (_.cover [/.member?]
- (case (/.front sample)
- {.#Some first}
- (/.member? n.equivalence sample first)
-
- {.#None}
- (/.empty? sample)))
- (_.cover [/.end]
- (let [sample+ (/.end non_member_priority non_member sample)]
- (and (not (/.member? n.equivalence sample non_member))
- (n.= (++ (/.size sample))
- (/.size sample+))
- (/.member? n.equivalence sample+ non_member))))
- (_.cover [/.next]
- (let [sample- (/.next sample)]
- (or (and (/.empty? sample)
- (/.empty? sample-))
- (n.= (-- (/.size sample))
- (/.size sample-)))))
+ (_.coverage [/.size]
+ (n.= size (/.size sample)))
+ (_.coverage [/.empty?]
+ (bit#= (n.= 0 (/.size sample))
+ (/.empty? sample)))
+ (_.coverage [/.empty]
+ (/.empty? /.empty))
+ (_.coverage [/.front]
+ (case (/.front sample)
+ {.#Some first}
+ (n.> 0 (/.size sample))
+
+ {.#None}
+ (/.empty? sample)))
+ (_.coverage [/.member?]
+ (case (/.front sample)
+ {.#Some first}
+ (/.member? n.equivalence sample first)
+
+ {.#None}
+ (/.empty? sample)))
+ (_.coverage [/.end]
+ (let [sample+ (/.end non_member_priority non_member sample)]
+ (and (not (/.member? n.equivalence sample non_member))
+ (n.= (++ (/.size sample))
+ (/.size sample+))
+ (/.member? n.equivalence sample+ non_member))))
+ (_.coverage [/.next]
+ (let [sample- (/.next sample)]
+ (or (and (/.empty? sample)
+ (/.empty? sample-))
+ (n.= (-- (/.size sample))
+ (/.size sample-)))))
(_.for [/.Priority]
(all _.and
- (_.cover [/.max]
- (|> /.empty
- (/.end /.min min_member)
- (/.end /.max max_member)
- /.front
- (maybe#each (n.= max_member))
- (maybe.else false)))
- (_.cover [/.min]
- (|> /.empty
- (/.end /.max max_member)
- (/.end /.min min_member)
- /.next
- /.front
- (maybe#each (n.= min_member))
- (maybe.else false)))
+ (_.coverage [/.max]
+ (|> /.empty
+ (/.end /.min min_member)
+ (/.end /.max max_member)
+ /.front
+ (maybe#each (n.= max_member))
+ (maybe.else false)))
+ (_.coverage [/.min]
+ (|> /.empty
+ (/.end /.max max_member)
+ (/.end /.min min_member)
+ /.next
+ /.front
+ (maybe#each (n.= min_member))
+ (maybe.else false)))
))
))))
diff --git a/stdlib/source/test/lux/data/collection/sequence.lux b/stdlib/source/test/lux/data/collection/sequence.lux
index a88a1f8de..f3c3bb0d0 100644
--- a/stdlib/source/test/lux/data/collection/sequence.lux
+++ b/stdlib/source/test/lux/data/collection/sequence.lux
@@ -54,29 +54,29 @@
.let [sample (|> sample set.list /.of_list)]
.let [(open "/#[0]") (/.equivalence n.equivalence)]]
(all _.and
- (_.cover [/.size]
- (n.= size (/.size sample)))
- (_.cover [/.empty?]
- (bit#= (/.empty? sample) (n.= 0 (/.size sample))))
- (_.cover [/.empty]
- (/.empty? /.empty))
- (_.cover [/.list /.of_list]
- (|> sample /.list /.of_list (/#= sample)))
- (_.cover [/.reversed]
- (or (n.< 2 (/.size sample))
- (let [not_same!
- (not (/#= sample
- (/.reversed sample)))
+ (_.coverage [/.size]
+ (n.= size (/.size sample)))
+ (_.coverage [/.empty?]
+ (bit#= (/.empty? sample) (n.= 0 (/.size sample))))
+ (_.coverage [/.empty]
+ (/.empty? /.empty))
+ (_.coverage [/.list /.of_list]
+ (|> sample /.list /.of_list (/#= sample)))
+ (_.coverage [/.reversed]
+ (or (n.< 2 (/.size sample))
+ (let [not_same!
+ (not (/#= sample
+ (/.reversed sample)))
- self_symmetry!
- (/#= sample
- (/.reversed (/.reversed sample)))]
- (and not_same!
- self_symmetry!))))
- (_.cover [/.every? /.any?]
- (if (/.every? n.even? sample)
- (not (/.any? (bit.complement n.even?) sample))
- (/.any? (bit.complement n.even?) sample)))
+ self_symmetry!
+ (/#= sample
+ (/.reversed (/.reversed sample)))]
+ (and not_same!
+ self_symmetry!))))
+ (_.coverage [/.every? /.any?]
+ (if (/.every? n.even? sample)
+ (not (/.any? (bit.complement n.even?) sample))
+ (/.any? (bit.complement n.even?) sample)))
)))
(def: index_based
@@ -92,41 +92,41 @@
random.nat)
.let [sample (|> sample set.list /.of_list)]]
(all _.and
- (_.cover [/.item]
- (case (/.item good_index sample)
- {try.#Success member}
- (/.member? n.equivalence sample member)
-
- {try.#Failure error}
- false))
- (_.cover [/.has]
- (<| (try.else false)
- (do try.monad
- [sample (/.has good_index non_member sample)
- actual (/.item good_index sample)]
- (in (same? non_member actual)))))
- (_.cover [/.revised]
- (<| (try.else false)
- (do try.monad
- [sample (/.has good_index non_member sample)
- sample (/.revised good_index ++ sample)
- actual (/.item good_index sample)]
- (in (n.= (++ non_member) actual)))))
- (_.cover [/.within_bounds?]
- (and (/.within_bounds? sample good_index)
- (not (/.within_bounds? sample bad_index))))
- (_.cover [/.index_out_of_bounds]
- (let [fails! (is (All (_ a) (-> (Try a) Bit))
- (function (_ situation)
- (case situation
- {try.#Success member}
- false
-
- {try.#Failure error}
- (exception.match? /.index_out_of_bounds error))))]
- (and (fails! (/.item bad_index sample))
- (fails! (/.has bad_index non_member sample))
- (fails! (/.revised bad_index ++ sample)))))
+ (_.coverage [/.item]
+ (case (/.item good_index sample)
+ {try.#Success member}
+ (/.member? n.equivalence sample member)
+
+ {try.#Failure error}
+ false))
+ (_.coverage [/.has]
+ (<| (try.else false)
+ (do try.monad
+ [sample (/.has good_index non_member sample)
+ actual (/.item good_index sample)]
+ (in (same? non_member actual)))))
+ (_.coverage [/.revised]
+ (<| (try.else false)
+ (do try.monad
+ [sample (/.has good_index non_member sample)
+ sample (/.revised good_index ++ sample)
+ actual (/.item good_index sample)]
+ (in (n.= (++ non_member) actual)))))
+ (_.coverage [/.within_bounds?]
+ (and (/.within_bounds? sample good_index)
+ (not (/.within_bounds? sample bad_index))))
+ (_.coverage [/.index_out_of_bounds]
+ (let [fails! (is (All (_ a) (-> (Try a) Bit))
+ (function (_ situation)
+ (case situation
+ {try.#Success member}
+ false
+
+ {try.#Failure error}
+ (exception.match? /.index_out_of_bounds error))))]
+ (and (fails! (/.item bad_index sample))
+ (fails! (/.has bad_index non_member sample))
+ (fails! (/.revised bad_index ++ sample)))))
))
)))
@@ -152,66 +152,66 @@
[value/0 random.nat
value/1 random.nat
value/2 random.nat]
- (_.cover [/.sequence]
- (/#= (/.of_list (list value/0 value/1 value/2))
- (/.sequence value/0 value/1 value/2))))
- (_.cover [/.member?]
- (and (list.every? (/.member? n.equivalence sample)
- (/.list sample))
- (not (/.member? n.equivalence sample non_member))))
- (_.cover [/.suffix]
- (let [added (/.suffix non_member sample)
+ (_.coverage [/.sequence]
+ (/#= (/.of_list (list value/0 value/1 value/2))
+ (/.sequence value/0 value/1 value/2))))
+ (_.coverage [/.member?]
+ (and (list.every? (/.member? n.equivalence sample)
+ (/.list sample))
+ (not (/.member? n.equivalence sample non_member))))
+ (_.coverage [/.suffix]
+ (let [added (/.suffix non_member sample)
- size_increases!
- (n.= (++ (/.size sample))
- (/.size added))
+ size_increases!
+ (n.= (++ (/.size sample))
+ (/.size added))
- is_a_member!
- (/.member? n.equivalence added non_member)]
- (and size_increases!
- is_a_member!)))
- (_.cover [/.prefix]
- (if (/.empty? sample)
- (/.empty? (/.prefix sample))
- (let [expected_size!
- (n.= (-- (/.size sample))
- (/.size (/.prefix sample)))
+ is_a_member!
+ (/.member? n.equivalence added non_member)]
+ (and size_increases!
+ is_a_member!)))
+ (_.coverage [/.prefix]
+ (if (/.empty? sample)
+ (/.empty? (/.prefix sample))
+ (let [expected_size!
+ (n.= (-- (/.size sample))
+ (/.size (/.prefix sample)))
- symmetry!
- (|> sample
- (/.suffix non_member)
- /.prefix
- (/#= sample))]
- (and expected_size!
- symmetry!))))
- (_.cover [/.only]
- (let [positives (/.only n.even? sample)
- negatives (/.only (bit.complement n.even?) sample)]
- (and (/.every? n.even? positives)
- (not (/.any? n.even? negatives))
+ symmetry!
+ (|> sample
+ (/.suffix non_member)
+ /.prefix
+ (/#= sample))]
+ (and expected_size!
+ symmetry!))))
+ (_.coverage [/.only]
+ (let [positives (/.only n.even? sample)
+ negatives (/.only (bit.complement n.even?) sample)]
+ (and (/.every? n.even? positives)
+ (not (/.any? n.even? negatives))
- (n.= (/.size sample)
- (n.+ (/.size positives)
- (/.size negatives))))))
- (_.cover [/.one]
- (let [(open "/#[0]") /.functor
- choice (is (-> Nat (Maybe Text))
- (function (_ value)
- (if (n.even? value)
- {.#Some (# n.decimal encoded value)}
- {.#None})))]
- (case [(|> sample
- (/.only n.even?)
- (/#each (# n.decimal encoded))
- (/.item 0))
- (/.one choice sample)]
- [{try.#Success expected} {.#Some actual}]
- (text#= expected actual)
+ (n.= (/.size sample)
+ (n.+ (/.size positives)
+ (/.size negatives))))))
+ (_.coverage [/.one]
+ (let [(open "/#[0]") /.functor
+ choice (is (-> Nat (Maybe Text))
+ (function (_ value)
+ (if (n.even? value)
+ {.#Some (# n.decimal encoded value)}
+ {.#None})))]
+ (case [(|> sample
+ (/.only n.even?)
+ (/#each (# n.decimal encoded))
+ (/.item 0))
+ (/.one choice sample)]
+ [{try.#Success expected} {.#Some actual}]
+ (text#= expected actual)
- [{try.#Failure _} {.#None}]
- true
+ [{try.#Failure _} {.#None}]
+ true
- _
- false)))
+ _
+ false)))
))
))))
diff --git a/stdlib/source/test/lux/data/collection/set.lux b/stdlib/source/test/lux/data/collection/set.lux
index c444f5419..e42a3e3a7 100644
--- a/stdlib/source/test/lux/data/collection/set.lux
+++ b/stdlib/source/test/lux/data/collection/set.lux
@@ -49,8 +49,8 @@
non_memberL (random.only (|>> (/.member? setL) not)
random.nat)]
(all _.and
- (_.cover [/.empty]
- (/.empty? (/.empty n.hash)))
+ (_.coverage [/.empty]
+ (/.empty? (/.empty n.hash)))
(do !
[hash (# ! each (function (_ constant)
(is (Hash Nat)
@@ -60,74 +60,74 @@
(def: (hash _)
constant))))
random.nat)]
- (_.cover [/.member_hash]
- (same? hash (/.member_hash (/.empty hash)))))
- (_.cover [/.size]
- (n.= sizeL (/.size setL)))
- (_.cover [/.empty?]
- (bit#= (/.empty? setL)
- (n.= 0 (/.size setL))))
- (_.cover [/.list /.of_list]
- (|> setL /.list (/.of_list n.hash) (#= setL)))
- (_.cover [/.member?]
- (and (list.every? (/.member? setL) (/.list setL))
- (not (/.member? setL non_memberL))))
- (_.cover [/.has]
- (let [before_addition!
- (not (/.member? setL non_memberL))
+ (_.coverage [/.member_hash]
+ (same? hash (/.member_hash (/.empty hash)))))
+ (_.coverage [/.size]
+ (n.= sizeL (/.size setL)))
+ (_.coverage [/.empty?]
+ (bit#= (/.empty? setL)
+ (n.= 0 (/.size setL))))
+ (_.coverage [/.list /.of_list]
+ (|> setL /.list (/.of_list n.hash) (#= setL)))
+ (_.coverage [/.member?]
+ (and (list.every? (/.member? setL) (/.list setL))
+ (not (/.member? setL non_memberL))))
+ (_.coverage [/.has]
+ (let [before_addition!
+ (not (/.member? setL non_memberL))
- after_addition!
- (/.member? (/.has non_memberL setL) non_memberL)
+ after_addition!
+ (/.member? (/.has non_memberL setL) non_memberL)
- size_increase!
- (n.= (++ (/.size setL))
- (/.size (/.has non_memberL setL)))]
- (and before_addition!
- after_addition!)))
- (_.cover [/.lacks]
- (let [symmetry!
- (|> setL
- (/.has non_memberL)
- (/.lacks non_memberL)
- (#= setL))
+ size_increase!
+ (n.= (++ (/.size setL))
+ (/.size (/.has non_memberL setL)))]
+ (and before_addition!
+ after_addition!)))
+ (_.coverage [/.lacks]
+ (let [symmetry!
+ (|> setL
+ (/.has non_memberL)
+ (/.lacks non_memberL)
+ (#= setL))
- idempotency!
- (|> setL
- (/.lacks non_memberL)
- (#= setL))]
- (and symmetry!
- idempotency!)))
- (_.cover [/.union /.sub?]
- (let [setLR (/.union setL setR)
-
- sets_are_subs_of_their_unions!
- (and (/.sub? setLR setL)
- (/.sub? setLR setR))
+ idempotency!
+ (|> setL
+ (/.lacks non_memberL)
+ (#= setL))]
+ (and symmetry!
+ idempotency!)))
+ (_.coverage [/.union /.sub?]
+ (let [setLR (/.union setL setR)
+
+ sets_are_subs_of_their_unions!
+ (and (/.sub? setLR setL)
+ (/.sub? setLR setR))
- union_with_empty_set!
- (|> setL
- (/.union (/.empty n.hash))
- (#= setL))]
- (and sets_are_subs_of_their_unions!
- union_with_empty_set!)))
- (_.cover [/.intersection /.super?]
- (let [setLR (/.intersection setL setR)
-
- sets_are_supers_of_their_intersections!
- (and (/.super? setLR setL)
- (/.super? setLR setR))
+ union_with_empty_set!
+ (|> setL
+ (/.union (/.empty n.hash))
+ (#= setL))]
+ (and sets_are_subs_of_their_unions!
+ union_with_empty_set!)))
+ (_.coverage [/.intersection /.super?]
+ (let [setLR (/.intersection setL setR)
+
+ sets_are_supers_of_their_intersections!
+ (and (/.super? setLR setL)
+ (/.super? setLR setR))
- intersection_with_empty_set!
- (|> setL
- (/.intersection (/.empty n.hash))
- /.empty?)]
- (and sets_are_supers_of_their_intersections!
- intersection_with_empty_set!)))
- (_.cover [/.difference]
- (let [setL+R (/.union setR setL)
- setL_R (/.difference setR setL+R)]
- (and (list.every? (/.member? setL+R) (/.list setR))
- (not (list.any? (/.member? setL_R) (/.list setR))))))
- (_.cover [/.predicate]
- (list.every? (/.predicate setL) (/.list setL)))
+ intersection_with_empty_set!
+ (|> setL
+ (/.intersection (/.empty n.hash))
+ /.empty?)]
+ (and sets_are_supers_of_their_intersections!
+ intersection_with_empty_set!)))
+ (_.coverage [/.difference]
+ (let [setL+R (/.union setR setL)
+ setL_R (/.difference setR setL+R)]
+ (and (list.every? (/.member? setL+R) (/.list setR))
+ (not (list.any? (/.member? setL_R) (/.list setR))))))
+ (_.coverage [/.predicate]
+ (list.every? (/.predicate setL) (/.list setL)))
))))))
diff --git a/stdlib/source/test/lux/data/collection/set/multi.lux b/stdlib/source/test/lux/data/collection/set/multi.lux
index 9ace968fb..93f7ef7e6 100644
--- a/stdlib/source/test/lux/data/collection/set/multi.lux
+++ b/stdlib/source/test/lux/data/collection/set/multi.lux
@@ -58,54 +58,54 @@
another (..random diversity n.hash ..count random.nat)]
(`` (all _.and
(~~ (template [<name> <composition>]
- [(_.cover [<name>]
- (let [|sample| (/.support sample)
- |another| (/.support another)
- sample_only (set.difference |another| |sample|)
- another_only (set.difference |sample| |another|)
- common (set.intersection |sample| |another|)
- composed (<name> sample another)
-
- no_left_changes! (list.every? (function (_ member)
- (n.= (/.multiplicity sample member)
- (/.multiplicity composed member)))
- (set.list sample_only))
- no_right_changes! (list.every? (function (_ member)
- (n.= (/.multiplicity another member)
- (/.multiplicity composed member)))
- (set.list another_only))
- common_changes! (list.every? (function (_ member)
- (n.= (<composition> (/.multiplicity sample member)
- (/.multiplicity another member))
- (/.multiplicity composed member)))
- (set.list common))]
- (and no_left_changes!
- no_right_changes!
- common_changes!)))]
-
- [/.sum n.+]
- [/.union n.max]
- ))
- (_.cover [/.intersection]
+ [(_.coverage [<name>]
(let [|sample| (/.support sample)
|another| (/.support another)
sample_only (set.difference |another| |sample|)
another_only (set.difference |sample| |another|)
common (set.intersection |sample| |another|)
- composed (/.intersection sample another)
+ composed (<name> sample another)
- left_removals! (list.every? (|>> (/.member? composed) not)
- (set.list sample_only))
- right_removals! (list.every? (|>> (/.member? composed) not)
- (set.list another_only))
+ no_left_changes! (list.every? (function (_ member)
+ (n.= (/.multiplicity sample member)
+ (/.multiplicity composed member)))
+ (set.list sample_only))
+ no_right_changes! (list.every? (function (_ member)
+ (n.= (/.multiplicity another member)
+ (/.multiplicity composed member)))
+ (set.list another_only))
common_changes! (list.every? (function (_ member)
- (n.= (n.min (/.multiplicity sample member)
- (/.multiplicity another member))
+ (n.= (<composition> (/.multiplicity sample member)
+ (/.multiplicity another member))
(/.multiplicity composed member)))
(set.list common))]
- (and left_removals!
- right_removals!
- common_changes!)))
+ (and no_left_changes!
+ no_right_changes!
+ common_changes!)))]
+
+ [/.sum n.+]
+ [/.union n.max]
+ ))
+ (_.coverage [/.intersection]
+ (let [|sample| (/.support sample)
+ |another| (/.support another)
+ sample_only (set.difference |another| |sample|)
+ another_only (set.difference |sample| |another|)
+ common (set.intersection |sample| |another|)
+ composed (/.intersection sample another)
+
+ left_removals! (list.every? (|>> (/.member? composed) not)
+ (set.list sample_only))
+ right_removals! (list.every? (|>> (/.member? composed) not)
+ (set.list another_only))
+ common_changes! (list.every? (function (_ member)
+ (n.= (n.min (/.multiplicity sample member)
+ (/.multiplicity another member))
+ (/.multiplicity composed member)))
+ (set.list common))]
+ (and left_removals!
+ right_removals!
+ common_changes!)))
))))
(def: .public test
@@ -121,119 +121,119 @@
partial_removal_count (# ! each (n.% addition_count) random.nat)
another (..random diversity n.hash ..count random.nat)]
(all _.and
- (_.cover [/.list /.of_list]
- (|> sample
- /.list
- (/.of_list n.hash)
- (# /.equivalence = sample)))
- (_.cover [/.size]
- (n.= (list.size (/.list sample))
- (/.size sample)))
- (_.cover [/.empty?]
- (bit#= (/.empty? sample)
- (n.= 0 (/.size sample))))
- (_.cover [/.empty]
- (/.empty? (/.empty n.hash)))
- (_.cover [/.support]
- (list.every? (set.member? (/.support sample))
- (/.list sample)))
- (_.cover [/.member?]
- (let [non_member_is_not_identified!
- (not (/.member? sample non_member))
+ (_.coverage [/.list /.of_list]
+ (|> sample
+ /.list
+ (/.of_list n.hash)
+ (# /.equivalence = sample)))
+ (_.coverage [/.size]
+ (n.= (list.size (/.list sample))
+ (/.size sample)))
+ (_.coverage [/.empty?]
+ (bit#= (/.empty? sample)
+ (n.= 0 (/.size sample))))
+ (_.coverage [/.empty]
+ (/.empty? (/.empty n.hash)))
+ (_.coverage [/.support]
+ (list.every? (set.member? (/.support sample))
+ (/.list sample)))
+ (_.coverage [/.member?]
+ (let [non_member_is_not_identified!
+ (not (/.member? sample non_member))
- all_members_are_identified!
- (list.every? (/.member? sample)
- (/.list sample))]
- (and non_member_is_not_identified!
- all_members_are_identified!)))
- (_.cover [/.multiplicity]
- (let [non_members_have_0_multiplicity!
- (n.= 0 (/.multiplicity sample non_member))
+ all_members_are_identified!
+ (list.every? (/.member? sample)
+ (/.list sample))]
+ (and non_member_is_not_identified!
+ all_members_are_identified!)))
+ (_.coverage [/.multiplicity]
+ (let [non_members_have_0_multiplicity!
+ (n.= 0 (/.multiplicity sample non_member))
- every_member_has_positive_multiplicity!
- (list.every? (|>> (/.multiplicity sample) (n.> 0))
- (/.list sample))]
- (and non_members_have_0_multiplicity!
- every_member_has_positive_multiplicity!)))
- (_.cover [/.has]
- (let [null_scenario!
- (|> sample
- (/.has 0 non_member)
- (# /.equivalence = sample))
+ every_member_has_positive_multiplicity!
+ (list.every? (|>> (/.multiplicity sample) (n.> 0))
+ (/.list sample))]
+ (and non_members_have_0_multiplicity!
+ every_member_has_positive_multiplicity!)))
+ (_.coverage [/.has]
+ (let [null_scenario!
+ (|> sample
+ (/.has 0 non_member)
+ (# /.equivalence = sample))
- normal_scenario!
- (let [sample+ (/.has addition_count non_member sample)]
- (and (not (/.member? sample non_member))
- (/.member? sample+ non_member)
- (n.= addition_count (/.multiplicity sample+ non_member))))]
- (and null_scenario!
- normal_scenario!)))
- (_.cover [/.lacks]
- (let [null_scenario!
- (# /.equivalence =
- (|> sample
- (/.has addition_count non_member))
- (|> sample
- (/.has addition_count non_member)
- (/.lacks 0 non_member)))
+ normal_scenario!
+ (let [sample+ (/.has addition_count non_member sample)]
+ (and (not (/.member? sample non_member))
+ (/.member? sample+ non_member)
+ (n.= addition_count (/.multiplicity sample+ non_member))))]
+ (and null_scenario!
+ normal_scenario!)))
+ (_.coverage [/.lacks]
+ (let [null_scenario!
+ (# /.equivalence =
+ (|> sample
+ (/.has addition_count non_member))
+ (|> sample
+ (/.has addition_count non_member)
+ (/.lacks 0 non_member)))
- partial_scenario!
- (let [sample* (|> sample
- (/.has addition_count non_member)
- (/.lacks partial_removal_count non_member))]
- (and (/.member? sample* non_member)
- (n.= (n.- partial_removal_count
- addition_count)
- (/.multiplicity sample* non_member))))
+ partial_scenario!
+ (let [sample* (|> sample
+ (/.has addition_count non_member)
+ (/.lacks partial_removal_count non_member))]
+ (and (/.member? sample* non_member)
+ (n.= (n.- partial_removal_count
+ addition_count)
+ (/.multiplicity sample* non_member))))
- total_scenario!
- (|> sample
- (/.has addition_count non_member)
- (/.lacks addition_count non_member)
- (# /.equivalence = sample))]
- (and null_scenario!
- partial_scenario!
- total_scenario!)))
- (_.cover [/.of_set]
- (let [unary (|> sample /.support /.of_set)]
- (list.every? (|>> (/.multiplicity unary) (n.= 1))
- (/.list unary))))
- (_.cover [/.sub?]
- (let [unary (|> sample /.support /.of_set)]
- (and (/.sub? sample unary)
- (or (not (/.sub? unary sample))
- (# /.equivalence = sample unary)))))
- (_.cover [/.super?]
- (let [unary (|> sample /.support /.of_set)]
- (and (/.super? unary sample)
- (or (not (/.super? sample unary))
- (# /.equivalence = sample unary)))))
- (_.cover [/.difference]
- (let [|sample| (/.support sample)
- |another| (/.support another)
- sample_only (set.difference |another| |sample|)
- another_only (set.difference |sample| |another|)
- common (set.intersection |sample| |another|)
- composed (/.difference sample another)
+ total_scenario!
+ (|> sample
+ (/.has addition_count non_member)
+ (/.lacks addition_count non_member)
+ (# /.equivalence = sample))]
+ (and null_scenario!
+ partial_scenario!
+ total_scenario!)))
+ (_.coverage [/.of_set]
+ (let [unary (|> sample /.support /.of_set)]
+ (list.every? (|>> (/.multiplicity unary) (n.= 1))
+ (/.list unary))))
+ (_.coverage [/.sub?]
+ (let [unary (|> sample /.support /.of_set)]
+ (and (/.sub? sample unary)
+ (or (not (/.sub? unary sample))
+ (# /.equivalence = sample unary)))))
+ (_.coverage [/.super?]
+ (let [unary (|> sample /.support /.of_set)]
+ (and (/.super? unary sample)
+ (or (not (/.super? sample unary))
+ (# /.equivalence = sample unary)))))
+ (_.coverage [/.difference]
+ (let [|sample| (/.support sample)
+ |another| (/.support another)
+ sample_only (set.difference |another| |sample|)
+ another_only (set.difference |sample| |another|)
+ common (set.intersection |sample| |another|)
+ composed (/.difference sample another)
- ommissions! (list.every? (|>> (/.member? composed) not)
- (set.list sample_only))
- intact! (list.every? (function (_ member)
- (n.= (/.multiplicity another member)
- (/.multiplicity composed member)))
- (set.list another_only))
- subtractions! (list.every? (function (_ member)
- (let [sample_multiplicity (/.multiplicity sample member)
- another_multiplicity (/.multiplicity another member)]
- (n.= (if (n.> another_multiplicity sample_multiplicity)
- 0
- (n.- sample_multiplicity
- another_multiplicity))
- (/.multiplicity composed member))))
- (set.list common))]
- (and ommissions!
- intact!
- subtractions!)))
+ ommissions! (list.every? (|>> (/.member? composed) not)
+ (set.list sample_only))
+ intact! (list.every? (function (_ member)
+ (n.= (/.multiplicity another member)
+ (/.multiplicity composed member)))
+ (set.list another_only))
+ subtractions! (list.every? (function (_ member)
+ (let [sample_multiplicity (/.multiplicity sample member)
+ another_multiplicity (/.multiplicity another member)]
+ (n.= (if (n.> another_multiplicity sample_multiplicity)
+ 0
+ (n.- sample_multiplicity
+ another_multiplicity))
+ (/.multiplicity composed member))))
+ (set.list common))]
+ (and ommissions!
+ intact!
+ subtractions!)))
..signature
..composition
diff --git a/stdlib/source/test/lux/data/collection/set/ordered.lux b/stdlib/source/test/lux/data/collection/set/ordered.lux
index 67f7bb483..429df3d21 100644
--- a/stdlib/source/test/lux/data/collection/set/ordered.lux
+++ b/stdlib/source/test/lux/data/collection/set/ordered.lux
@@ -56,122 +56,122 @@
(_.for [/.equivalence]
($equivalence.spec /.equivalence (..random sizeL n.order random.nat)))
- (_.cover [/.size]
- (n.= sizeL (/.size setL)))
- (_.cover [/.empty?]
- (bit#= (n.= 0 (/.size setL))
- (/.empty? setL)))
- (_.cover [/.empty]
- (/.empty? (/.empty n.order)))
- (_.cover [/.list]
- (# (list.equivalence n.equivalence) =
- (/.list (/.of_list n.order listL))
- (list.sorted (# n.order <) listL)))
- (_.cover [/.of_list]
- (|> setL
- /.list (/.of_list n.order)
- (/#= setL)))
+ (_.coverage [/.size]
+ (n.= sizeL (/.size setL)))
+ (_.coverage [/.empty?]
+ (bit#= (n.= 0 (/.size setL))
+ (/.empty? setL)))
+ (_.coverage [/.empty]
+ (/.empty? (/.empty n.order)))
+ (_.coverage [/.list]
+ (# (list.equivalence n.equivalence) =
+ (/.list (/.of_list n.order listL))
+ (list.sorted (# n.order <) listL)))
+ (_.coverage [/.of_list]
+ (|> setL
+ /.list (/.of_list n.order)
+ (/#= setL)))
(~~ (template [<coverage> <comparison>]
- [(_.cover [<coverage>]
- (case (<coverage> setL)
- {.#Some value}
- (|> setL /.list (list.every? (<comparison> value)))
+ [(_.coverage [<coverage>]
+ (case (<coverage> setL)
+ {.#Some value}
+ (|> setL /.list (list.every? (<comparison> value)))
- {.#None}
- (/.empty? setL)))]
+ {.#None}
+ (/.empty? setL)))]
[/.min n.>=]
[/.max n.<=]
))
- (_.cover [/.member?]
- (let [members_are_identified!
- (list.every? (/.member? setL) (/.list setL))
-
- non_members_are_not_identified!
- (not (/.member? setL non_memberL))]
- (and members_are_identified!
- non_members_are_not_identified!)))
- (_.cover [/.has]
- (let [setL+ (/.has non_memberL setL)]
- (and (not (/.member? setL non_memberL))
- (/.member? setL+ non_memberL)
- (n.= (++ (/.size setL))
- (/.size setL+)))))
- (_.cover [/.lacks]
- (|> setL
- (/.has non_memberL)
- (/.lacks non_memberL)
- (# /.equivalence = setL)))
- (_.cover [/.sub?]
+ (_.coverage [/.member?]
+ (let [members_are_identified!
+ (list.every? (/.member? setL) (/.list setL))
+
+ non_members_are_not_identified!
+ (not (/.member? setL non_memberL))]
+ (and members_are_identified!
+ non_members_are_not_identified!)))
+ (_.coverage [/.has]
+ (let [setL+ (/.has non_memberL setL)]
+ (and (not (/.member? setL non_memberL))
+ (/.member? setL+ non_memberL)
+ (n.= (++ (/.size setL))
+ (/.size setL+)))))
+ (_.coverage [/.lacks]
+ (|> setL
+ (/.has non_memberL)
+ (/.lacks non_memberL)
+ (# /.equivalence = setL)))
+ (_.coverage [/.sub?]
+ (let [self!
+ (/.sub? setL setL)
+
+ empty!
+ (/.sub? setL empty)]
+ (and self!
+ empty!)))
+ (_.coverage [/.super?]
+ (let [self!
+ (/.super? setL setL)
+
+ empty!
+ (/.super? empty setL)
+
+ symmetry!
+ (bit#= (/.super? setL setR)
+ (/.sub? setR setL))]
+ (and self!
+ empty!
+ symmetry!)))
+ (~~ (template [<coverage> <relation> <empty?>]
+ [(_.coverage [<coverage>]
(let [self!
- (/.sub? setL setL)
+ (# /.equivalence =
+ setL
+ (<coverage> setL setL))
- empty!
- (/.sub? setL empty)]
- (and self!
- empty!)))
- (_.cover [/.super?]
- (let [self!
- (/.super? setL setL)
+ super!
+ (and (<relation> (<coverage> setL setR) setL)
+ (<relation> (<coverage> setL setR) setR))
empty!
- (/.super? empty setL)
+ (# /.equivalence =
+ (if <empty?> empty setL)
+ (<coverage> setL empty))
- symmetry!
- (bit#= (/.super? setL setR)
- (/.sub? setR setL))]
+ idempotence!
+ (# /.equivalence =
+ (<coverage> setL (<coverage> setL setR))
+ (<coverage> setR (<coverage> setL setR)))]
(and self!
+ super!
empty!
- symmetry!)))
- (~~ (template [<coverage> <relation> <empty?>]
- [(_.cover [<coverage>]
- (let [self!
- (# /.equivalence =
- setL
- (<coverage> setL setL))
-
- super!
- (and (<relation> (<coverage> setL setR) setL)
- (<relation> (<coverage> setL setR) setR))
-
- empty!
- (# /.equivalence =
- (if <empty?> empty setL)
- (<coverage> setL empty))
-
- idempotence!
- (# /.equivalence =
- (<coverage> setL (<coverage> setL setR))
- (<coverage> setR (<coverage> setL setR)))]
- (and self!
- super!
- empty!
- idempotence!)))]
+ idempotence!)))]
[/.union /.sub? false]
[/.intersection /.super? true]
))
- (_.cover [/.difference]
- (let [self!
- (|> setL
- (/.difference setL)
- (# /.equivalence = empty))
-
- empty!
- (|> setL
- (/.difference empty)
- (# /.equivalence = setL))
-
- difference!
- (not (list.any? (/.member? (/.difference setL setR))
- (/.list setL)))
-
- idempotence!
- (# /.equivalence =
- (/.difference setL setR)
- (/.difference setL (/.difference setL setR)))]
- (and self!
- empty!
- difference!
- idempotence!)))
+ (_.coverage [/.difference]
+ (let [self!
+ (|> setL
+ (/.difference setL)
+ (# /.equivalence = empty))
+
+ empty!
+ (|> setL
+ (/.difference empty)
+ (# /.equivalence = setL))
+
+ difference!
+ (not (list.any? (/.member? (/.difference setL setR))
+ (/.list setL)))
+
+ idempotence!
+ (# /.equivalence =
+ (/.difference setL setR)
+ (/.difference setL (/.difference setL setR)))]
+ (and self!
+ empty!
+ difference!
+ idempotence!)))
)))))
diff --git a/stdlib/source/test/lux/data/collection/stack.lux b/stdlib/source/test/lux/data/collection/stack.lux
index f23767283..62844c59d 100644
--- a/stdlib/source/test/lux/data/collection/stack.lux
+++ b/stdlib/source/test/lux/data/collection/stack.lux
@@ -36,35 +36,35 @@
(_.for [/.functor]
($functor.spec ..injection /.equivalence /.functor))
- (_.cover [/.size]
- (n.= size (/.size sample)))
- (_.cover [/.empty?]
- (bit#= (n.= 0 (/.size sample))
- (/.empty? sample)))
- (_.cover [/.empty]
- (/.empty? /.empty))
- (_.cover [/.value]
- (case (/.value sample)
- {.#None}
- (/.empty? sample)
-
- {.#Some _}
- (not (/.empty? sample))))
- (_.cover [/.next]
- (case (/.next sample)
- {.#None}
- (/.empty? sample)
-
- {.#Some [top remaining]}
- (# (/.equivalence n.equivalence) =
- sample
- (/.top top remaining))))
- (_.cover [/.top]
- (case (/.next (/.top expected_top sample))
- {.#Some [actual_top actual_sample]}
- (and (same? expected_top actual_top)
- (same? sample actual_sample))
-
- {.#None}
- false))
+ (_.coverage [/.size]
+ (n.= size (/.size sample)))
+ (_.coverage [/.empty?]
+ (bit#= (n.= 0 (/.size sample))
+ (/.empty? sample)))
+ (_.coverage [/.empty]
+ (/.empty? /.empty))
+ (_.coverage [/.value]
+ (case (/.value sample)
+ {.#None}
+ (/.empty? sample)
+
+ {.#Some _}
+ (not (/.empty? sample))))
+ (_.coverage [/.next]
+ (case (/.next sample)
+ {.#None}
+ (/.empty? sample)
+
+ {.#Some [top remaining]}
+ (# (/.equivalence n.equivalence) =
+ sample
+ (/.top top remaining))))
+ (_.coverage [/.top]
+ (case (/.next (/.top expected_top sample))
+ {.#Some [actual_top actual_sample]}
+ (and (same? expected_top actual_top)
+ (same? sample actual_sample))
+
+ {.#None}
+ false))
))))
diff --git a/stdlib/source/test/lux/data/collection/stream.lux b/stdlib/source/test/lux/data/collection/stream.lux
index f6ddd13d3..f06af6f9c 100644
--- a/stdlib/source/test/lux/data/collection/stream.lux
+++ b/stdlib/source/test/lux/data/collection/stream.lux
@@ -56,68 +56,68 @@
(_.for [/.comonad]
($comonad.spec /.repeated ..equivalence /.comonad))
- (_.cover [/.item]
- (n.= (n.+ offset index)
- (/.item index (..iterations ++ offset))))
- (_.cover [/.repeated]
- (n.= repeated
- (/.item index (/.repeated repeated))))
- (_.cover [/.first]
- (list#= (enum.range n.enum offset (-- (n.+ size offset)))
- (/.first size (..iterations ++ offset))))
- (_.cover [/.after]
- (list#= (enum.range n.enum offset (-- (n.+ size offset)))
- (/.first size (/.after offset (..iterations ++ 0)))))
- (_.cover [/.split_at]
- (let [[drops takes] (/.split_at size (..iterations ++ 0))]
- (and (list#= (enum.range n.enum 0 (-- size))
- drops)
- (list#= (enum.range n.enum size (-- (n.* 2 size)))
- (/.first size takes)))))
- (_.cover [/.while]
- (list#= (enum.range n.enum 0 (-- size))
- (/.while (n.< size) (..iterations ++ 0))))
- (_.cover [/.until]
- (list#= (enum.range n.enum offset (-- (n.+ size offset)))
- (/.while (n.< (n.+ size offset))
- (/.until (n.< offset) (..iterations ++ 0)))))
- (_.cover [/.split_when]
- (let [[drops takes] (/.split_when (n.= size) (..iterations ++ 0))]
- (and (list#= (enum.range n.enum 0 (-- size))
- drops)
- (list#= (enum.range n.enum size (-- (n.* 2 size)))
- (/.while (n.< (n.* 2 size)) takes)))))
- (_.cover [/.head]
- (n.= offset
- (/.head (..iterations ++ offset))))
- (_.cover [/.tail]
- (list#= (enum.range n.enum (++ offset) (n.+ size offset))
- (/.first size (/.tail (..iterations ++ offset)))))
- (_.cover [/.only]
- (list#= (list#each (n.* 2) (enum.range n.enum 0 (-- size)))
- (/.first size (/.only n.even? (..iterations ++ 0)))))
- (_.cover [/.partition]
- (let [[evens odds] (/.partition n.even? (..iterations ++ 0))]
- (and (n.= (n.* 2 offset)
- (/.item offset evens))
- (n.= (++ (n.* 2 offset))
- (/.item offset odds)))))
- (_.cover [/.iterations]
- (let [(open "/#[0]") /.functor
- (open "list#[0]") (list.equivalence text.equivalence)]
- (list#= (/.first size
- (/#each %.nat (..iterations ++ offset)))
- (/.first size
- (/.iterations (function (_ n) [(++ n) (%.nat n)])
- offset)))))
- (_.cover [/.cycle]
- (let [cycle (partial_list cycle_start cycle_next)]
- (list#= (list.together (list.repeated size cycle))
- (/.first (n.* size (list.size cycle))
- (/.cycle [cycle_start cycle_next])))))
- (_.cover [/.pattern]
- (let [(/.pattern first second third next) (..iterations ++ offset)]
- (and (n.= offset first)
- (n.= (n.+ 1 offset) second)
- (n.= (n.+ 2 offset) third))))
+ (_.coverage [/.item]
+ (n.= (n.+ offset index)
+ (/.item index (..iterations ++ offset))))
+ (_.coverage [/.repeated]
+ (n.= repeated
+ (/.item index (/.repeated repeated))))
+ (_.coverage [/.first]
+ (list#= (enum.range n.enum offset (-- (n.+ size offset)))
+ (/.first size (..iterations ++ offset))))
+ (_.coverage [/.after]
+ (list#= (enum.range n.enum offset (-- (n.+ size offset)))
+ (/.first size (/.after offset (..iterations ++ 0)))))
+ (_.coverage [/.split_at]
+ (let [[drops takes] (/.split_at size (..iterations ++ 0))]
+ (and (list#= (enum.range n.enum 0 (-- size))
+ drops)
+ (list#= (enum.range n.enum size (-- (n.* 2 size)))
+ (/.first size takes)))))
+ (_.coverage [/.while]
+ (list#= (enum.range n.enum 0 (-- size))
+ (/.while (n.< size) (..iterations ++ 0))))
+ (_.coverage [/.until]
+ (list#= (enum.range n.enum offset (-- (n.+ size offset)))
+ (/.while (n.< (n.+ size offset))
+ (/.until (n.< offset) (..iterations ++ 0)))))
+ (_.coverage [/.split_when]
+ (let [[drops takes] (/.split_when (n.= size) (..iterations ++ 0))]
+ (and (list#= (enum.range n.enum 0 (-- size))
+ drops)
+ (list#= (enum.range n.enum size (-- (n.* 2 size)))
+ (/.while (n.< (n.* 2 size)) takes)))))
+ (_.coverage [/.head]
+ (n.= offset
+ (/.head (..iterations ++ offset))))
+ (_.coverage [/.tail]
+ (list#= (enum.range n.enum (++ offset) (n.+ size offset))
+ (/.first size (/.tail (..iterations ++ offset)))))
+ (_.coverage [/.only]
+ (list#= (list#each (n.* 2) (enum.range n.enum 0 (-- size)))
+ (/.first size (/.only n.even? (..iterations ++ 0)))))
+ (_.coverage [/.partition]
+ (let [[evens odds] (/.partition n.even? (..iterations ++ 0))]
+ (and (n.= (n.* 2 offset)
+ (/.item offset evens))
+ (n.= (++ (n.* 2 offset))
+ (/.item offset odds)))))
+ (_.coverage [/.iterations]
+ (let [(open "/#[0]") /.functor
+ (open "list#[0]") (list.equivalence text.equivalence)]
+ (list#= (/.first size
+ (/#each %.nat (..iterations ++ offset)))
+ (/.first size
+ (/.iterations (function (_ n) [(++ n) (%.nat n)])
+ offset)))))
+ (_.coverage [/.cycle]
+ (let [cycle (partial_list cycle_start cycle_next)]
+ (list#= (list.together (list.repeated size cycle))
+ (/.first (n.* size (list.size cycle))
+ (/.cycle [cycle_start cycle_next])))))
+ (_.coverage [/.pattern]
+ (let [(/.pattern first second third next) (..iterations ++ offset)]
+ (and (n.= offset first)
+ (n.= (n.+ 1 offset) second)
+ (n.= (n.+ 2 offset) third))))
))))
diff --git a/stdlib/source/test/lux/data/collection/tree.lux b/stdlib/source/test/lux/data/collection/tree.lux
index b5dbfa7c4..0adcb50ba 100644
--- a/stdlib/source/test/lux/data/collection/tree.lux
+++ b/stdlib/source/test/lux/data/collection/tree.lux
@@ -47,23 +47,23 @@
(do random.monad
[[size sample] (..tree random.nat)]
- (_.cover [/.flat]
- (n.= size
- (list.size (/.flat sample)))))
+ (_.coverage [/.flat]
+ (n.= size
+ (list.size (/.flat sample)))))
(do random.monad
[expected random.nat]
- (_.cover [/.leaf]
- (# (list.equivalence n.equivalence) =
- (list expected)
- (/.flat (/.leaf expected)))))
+ (_.coverage [/.leaf]
+ (# (list.equivalence n.equivalence) =
+ (list expected)
+ (/.flat (/.leaf expected)))))
(do [! random.monad]
[value random.nat
num_children (# ! each (n.% 3) random.nat)
children (random.list num_children random.nat)]
- (_.cover [/.branch]
- (# (list.equivalence n.equivalence) =
- (partial_list value children)
- (/.flat (/.branch value (list#each /.leaf children))))))
+ (_.coverage [/.branch]
+ (# (list.equivalence n.equivalence) =
+ (partial_list value children)
+ (/.flat (/.branch value (list#each /.leaf children))))))
(do random.monad
[expected/0 random.nat
expected/1 random.nat
@@ -71,21 +71,21 @@
expected/3 random.nat
expected/4 random.nat
expected/5 random.nat]
- (_.cover [/.tree]
- (and (# (list.equivalence n.equivalence) =
- (list expected/0)
- (/.flat (/.tree expected/0)))
- (# (list.equivalence n.equivalence) =
- (list expected/0 expected/1 expected/2)
- (/.flat (/.tree expected/0
- {expected/1 {}
- expected/2 {}})))
- (# (list.equivalence n.equivalence) =
- (list expected/0 expected/1 expected/2
- expected/3 expected/4 expected/5)
- (/.flat (/.tree expected/0
- {expected/1 {}
- expected/2 {expected/3 {}
- expected/4 {expected/5 {}}}})))
- )))
+ (_.coverage [/.tree]
+ (and (# (list.equivalence n.equivalence) =
+ (list expected/0)
+ (/.flat (/.tree expected/0)))
+ (# (list.equivalence n.equivalence) =
+ (list expected/0 expected/1 expected/2)
+ (/.flat (/.tree expected/0
+ {expected/1 {}
+ expected/2 {}})))
+ (# (list.equivalence n.equivalence) =
+ (list expected/0 expected/1 expected/2
+ expected/3 expected/4 expected/5)
+ (/.flat (/.tree expected/0
+ {expected/1 {}
+ expected/2 {expected/3 {}
+ expected/4 {expected/5 {}}}})))
+ )))
)))
diff --git a/stdlib/source/test/lux/data/collection/tree/finger.lux b/stdlib/source/test/lux/data/collection/tree/finger.lux
index 0a193f702..3fc005e70 100644
--- a/stdlib/source/test/lux/data/collection/tree/finger.lux
+++ b/stdlib/source/test/lux/data/collection/tree/finger.lux
@@ -39,45 +39,45 @@
expected_left random.nat
expected_right random.nat]
(all _.and
- (_.cover [/.Builder /.builder]
- (exec (/.builder text.monoid)
- true))
- (_.cover [/.tag]
- (and (text#= tag_left
- (/.tag (# ..builder leaf tag_left expected_left)))
- (text#= (text#composite tag_left tag_right)
- (/.tag (# ..builder branch
- (# ..builder leaf tag_left expected_left)
- (# ..builder leaf tag_right expected_right))))))
- (_.cover [/.root]
- (and (case (/.root (# ..builder leaf tag_left expected_left))
- {.#Left actual}
- (n.= expected_left actual)
-
- {.#Right _}
- false)
- (case (/.root (# ..builder branch
- (# ..builder leaf tag_left expected_left)
- (# ..builder leaf tag_right expected_right)))
- {.#Left _}
- false
-
- {.#Right [left right]}
- (case [(/.root left)
- (/.root right)]
- [{.#Left actual_left} {.#Left actual_right}]
- (and (n.= expected_left actual_left)
- (n.= expected_right actual_right))
-
- _
- false))))
- (_.cover [/.value]
- (and (n.= expected_left
- (/.value (# ..builder leaf tag_left expected_left)))
- (n.= expected_left
- (/.value (# ..builder branch
- (# ..builder leaf tag_left expected_left)
- (# ..builder leaf tag_right expected_right))))))
+ (_.coverage [/.Builder /.builder]
+ (exec (/.builder text.monoid)
+ true))
+ (_.coverage [/.tag]
+ (and (text#= tag_left
+ (/.tag (# ..builder leaf tag_left expected_left)))
+ (text#= (text#composite tag_left tag_right)
+ (/.tag (# ..builder branch
+ (# ..builder leaf tag_left expected_left)
+ (# ..builder leaf tag_right expected_right))))))
+ (_.coverage [/.root]
+ (and (case (/.root (# ..builder leaf tag_left expected_left))
+ {.#Left actual}
+ (n.= expected_left actual)
+
+ {.#Right _}
+ false)
+ (case (/.root (# ..builder branch
+ (# ..builder leaf tag_left expected_left)
+ (# ..builder leaf tag_right expected_right)))
+ {.#Left _}
+ false
+
+ {.#Right [left right]}
+ (case [(/.root left)
+ (/.root right)]
+ [{.#Left actual_left} {.#Left actual_right}]
+ (and (n.= expected_left actual_left)
+ (n.= expected_right actual_right))
+
+ _
+ false))))
+ (_.coverage [/.value]
+ (and (n.= expected_left
+ (/.value (# ..builder leaf tag_left expected_left)))
+ (n.= expected_left
+ (/.value (# ..builder branch
+ (# ..builder leaf tag_left expected_left)
+ (# ..builder leaf tag_right expected_right))))))
(do random.monad
[.let [tags_equivalence (list.equivalence text.equivalence)
values_equivalence (list.equivalence n.equivalence)]
@@ -85,68 +85,68 @@
tags/T (random.list 5 (random.alpha_numeric 1))
values/H random.nat
values/T (random.list 5 random.nat)]
- (_.cover [/.tags /.values]
- (let [tree (list#mix (function (_ [tag value] tree)
- (# builder branch tree (# builder leaf tag value)))
- (# builder leaf tags/H values/H)
- (list.zipped_2 tags/T values/T))]
- (and (# tags_equivalence = (partial_list tags/H tags/T) (/.tags tree))
- (# values_equivalence = (partial_list values/H values/T) (/.values tree))))))
- (_.cover [/.one]
- (let [can_find_correct_one!
- (|> (# ..builder leaf tag_left expected_left)
- (/.one (text.contains? tag_left))
- (maybe#each (n.= expected_left))
- (maybe.else false))
+ (_.coverage [/.tags /.values]
+ (let [tree (list#mix (function (_ [tag value] tree)
+ (# builder branch tree (# builder leaf tag value)))
+ (# builder leaf tags/H values/H)
+ (list.zipped_2 tags/T values/T))]
+ (and (# tags_equivalence = (partial_list tags/H tags/T) (/.tags tree))
+ (# values_equivalence = (partial_list values/H values/T) (/.values tree))))))
+ (_.coverage [/.one]
+ (let [can_find_correct_one!
+ (|> (# ..builder leaf tag_left expected_left)
+ (/.one (text.contains? tag_left))
+ (maybe#each (n.= expected_left))
+ (maybe.else false))
- cannot_find_incorrect_one!
- (|> (# ..builder leaf tag_right expected_right)
- (/.one (text.contains? tag_left))
- (maybe#each (n.= expected_left))
- (maybe.else false)
- not)
+ cannot_find_incorrect_one!
+ (|> (# ..builder leaf tag_right expected_right)
+ (/.one (text.contains? tag_left))
+ (maybe#each (n.= expected_left))
+ (maybe.else false)
+ not)
- can_find_left!
- (|> (# ..builder branch
- (# ..builder leaf tag_left expected_left)
- (# ..builder leaf tag_right expected_right))
- (/.one (text.contains? tag_left))
- (maybe#each (n.= expected_left))
- (maybe.else false))
+ can_find_left!
+ (|> (# ..builder branch
+ (# ..builder leaf tag_left expected_left)
+ (# ..builder leaf tag_right expected_right))
+ (/.one (text.contains? tag_left))
+ (maybe#each (n.= expected_left))
+ (maybe.else false))
- can_find_right!
- (|> (# ..builder branch
- (# ..builder leaf tag_left expected_left)
- (# ..builder leaf tag_right expected_right))
- (/.one (text.contains? tag_right))
- (maybe#each (n.= expected_right))
- (maybe.else false))]
- (and can_find_correct_one!
- cannot_find_incorrect_one!
- can_find_left!
- can_find_right!)))
- (_.cover [/.exists?]
- (let [can_find_correct_one!
- (/.exists? (text.contains? tag_left)
- (# ..builder leaf tag_left expected_left))
+ can_find_right!
+ (|> (# ..builder branch
+ (# ..builder leaf tag_left expected_left)
+ (# ..builder leaf tag_right expected_right))
+ (/.one (text.contains? tag_right))
+ (maybe#each (n.= expected_right))
+ (maybe.else false))]
+ (and can_find_correct_one!
+ cannot_find_incorrect_one!
+ can_find_left!
+ can_find_right!)))
+ (_.coverage [/.exists?]
+ (let [can_find_correct_one!
+ (/.exists? (text.contains? tag_left)
+ (# ..builder leaf tag_left expected_left))
- cannot_find_incorrect_one!
- (not (/.exists? (text.contains? tag_left)
- (# ..builder leaf tag_right expected_right)))
+ cannot_find_incorrect_one!
+ (not (/.exists? (text.contains? tag_left)
+ (# ..builder leaf tag_right expected_right)))
- can_find_left!
- (/.exists? (text.contains? tag_left)
- (# ..builder branch
- (# ..builder leaf tag_left expected_left)
- (# ..builder leaf tag_right expected_right)))
+ can_find_left!
+ (/.exists? (text.contains? tag_left)
+ (# ..builder branch
+ (# ..builder leaf tag_left expected_left)
+ (# ..builder leaf tag_right expected_right)))
- can_find_right!
- (/.exists? (text.contains? tag_right)
- (# ..builder branch
- (# ..builder leaf tag_left expected_left)
- (# ..builder leaf tag_right expected_right)))]
- (and can_find_correct_one!
- cannot_find_incorrect_one!
- can_find_left!
- can_find_right!)))
+ can_find_right!
+ (/.exists? (text.contains? tag_right)
+ (# ..builder branch
+ (# ..builder leaf tag_left expected_left)
+ (# ..builder leaf tag_right expected_right)))]
+ (and can_find_correct_one!
+ cannot_find_incorrect_one!
+ can_find_left!
+ can_find_right!)))
))))
diff --git a/stdlib/source/test/lux/data/collection/tree/zipper.lux b/stdlib/source/test/lux/data/collection/tree/zipper.lux
index 3a74a5030..b6b9a965f 100644
--- a/stdlib/source/test/lux/data/collection/tree/zipper.lux
+++ b/stdlib/source/test/lux/data/collection/tree/zipper.lux
@@ -31,124 +31,124 @@
[expected random.nat
dummy (random.only (|>> (n.= expected) not) random.nat)]
(all _.and
- (_.cover [/.down]
- (|> (tree.branch dummy (list (tree.leaf expected)))
- /.zipper
- (pipe.do maybe.monad
- [/.down]
- [/.value (n.= expected) in])
- (maybe.else false)))
- (_.cover [/.up]
- (|> (tree.branch expected (list (tree.leaf dummy)))
- /.zipper
- (pipe.do maybe.monad
- [/.down]
- [/.up]
- [/.value (n.= expected) in])
- (maybe.else false)))
- (_.cover [/.right]
- (|> (tree.branch dummy (list (tree.leaf dummy) (tree.leaf expected)))
- /.zipper
- (pipe.do maybe.monad
- [/.down]
- [/.right]
- [/.value (n.= expected) in])
- (maybe.else false)))
- (_.cover [/.rightmost]
- (|> (tree.branch dummy
- (list (tree.leaf dummy)
- (tree.leaf dummy)
- (tree.leaf dummy)
- (tree.leaf expected)))
- /.zipper
- (pipe.do maybe.monad
- [/.down]
- [/.rightmost]
- [/.value (n.= expected) in])
- (maybe.else false)))
- (_.cover [/.left]
- (|> (tree.branch dummy (list (tree.leaf expected) (tree.leaf dummy)))
- /.zipper
- (pipe.do maybe.monad
- [/.down]
- [/.right]
- [/.left]
- [/.value (n.= expected) in])
- (maybe.else false)))
- (_.cover [/.leftmost]
- (|> (tree.branch dummy
- (list (tree.leaf expected)
- (tree.leaf dummy)
- (tree.leaf dummy)
- (tree.leaf dummy)))
- /.zipper
- (pipe.do maybe.monad
- [/.down]
- [/.rightmost]
- [/.leftmost]
- [/.value (n.= expected) in])
- (maybe.else false)))
- (_.cover [/.next]
- (and (|> (tree.branch dummy
- (list (tree.leaf expected)
- (tree.leaf dummy)))
- /.zipper
- (pipe.do maybe.monad
- [/.next]
- [/.value (n.= expected) in])
- (maybe.else false))
- (|> (tree.branch dummy
- (list (tree.leaf dummy)
- (tree.leaf expected)))
- /.zipper
- (pipe.do maybe.monad
- [/.next]
- [/.next]
- [/.value (n.= expected) in])
- (maybe.else false))))
- (_.cover [/.end]
- (|> (tree.branch dummy
- (list (tree.leaf dummy)
- (tree.leaf dummy)
- (tree.leaf dummy)
- (tree.leaf expected)))
- /.zipper
- (pipe.do maybe.monad
- [/.end]
- [/.value (n.= expected) in])
- (maybe.else false)))
- (_.cover [/.start]
- (|> (tree.branch expected
- (list (tree.leaf dummy)
- (tree.leaf dummy)
- (tree.leaf dummy)
- (tree.leaf dummy)))
- /.zipper
- (pipe.do maybe.monad
- [/.end]
- [/.start]
- [/.value (n.= expected) in])
- (maybe.else false)))
- (_.cover [/.previous]
- (and (|> (tree.branch expected
- (list (tree.leaf dummy)
- (tree.leaf dummy)))
- /.zipper
- (pipe.do maybe.monad
- [/.next]
- [/.previous]
- [/.value (n.= expected) in])
- (maybe.else false))
- (|> (tree.branch dummy
- (list (tree.leaf expected)
- (tree.leaf dummy)))
- /.zipper
- (pipe.do maybe.monad
- [/.next]
- [/.next]
- [/.previous]
- [/.value (n.= expected) in])
- (maybe.else false))))
+ (_.coverage [/.down]
+ (|> (tree.branch dummy (list (tree.leaf expected)))
+ /.zipper
+ (pipe.do maybe.monad
+ [/.down]
+ [/.value (n.= expected) in])
+ (maybe.else false)))
+ (_.coverage [/.up]
+ (|> (tree.branch expected (list (tree.leaf dummy)))
+ /.zipper
+ (pipe.do maybe.monad
+ [/.down]
+ [/.up]
+ [/.value (n.= expected) in])
+ (maybe.else false)))
+ (_.coverage [/.right]
+ (|> (tree.branch dummy (list (tree.leaf dummy) (tree.leaf expected)))
+ /.zipper
+ (pipe.do maybe.monad
+ [/.down]
+ [/.right]
+ [/.value (n.= expected) in])
+ (maybe.else false)))
+ (_.coverage [/.rightmost]
+ (|> (tree.branch dummy
+ (list (tree.leaf dummy)
+ (tree.leaf dummy)
+ (tree.leaf dummy)
+ (tree.leaf expected)))
+ /.zipper
+ (pipe.do maybe.monad
+ [/.down]
+ [/.rightmost]
+ [/.value (n.= expected) in])
+ (maybe.else false)))
+ (_.coverage [/.left]
+ (|> (tree.branch dummy (list (tree.leaf expected) (tree.leaf dummy)))
+ /.zipper
+ (pipe.do maybe.monad
+ [/.down]
+ [/.right]
+ [/.left]
+ [/.value (n.= expected) in])
+ (maybe.else false)))
+ (_.coverage [/.leftmost]
+ (|> (tree.branch dummy
+ (list (tree.leaf expected)
+ (tree.leaf dummy)
+ (tree.leaf dummy)
+ (tree.leaf dummy)))
+ /.zipper
+ (pipe.do maybe.monad
+ [/.down]
+ [/.rightmost]
+ [/.leftmost]
+ [/.value (n.= expected) in])
+ (maybe.else false)))
+ (_.coverage [/.next]
+ (and (|> (tree.branch dummy
+ (list (tree.leaf expected)
+ (tree.leaf dummy)))
+ /.zipper
+ (pipe.do maybe.monad
+ [/.next]
+ [/.value (n.= expected) in])
+ (maybe.else false))
+ (|> (tree.branch dummy
+ (list (tree.leaf dummy)
+ (tree.leaf expected)))
+ /.zipper
+ (pipe.do maybe.monad
+ [/.next]
+ [/.next]
+ [/.value (n.= expected) in])
+ (maybe.else false))))
+ (_.coverage [/.end]
+ (|> (tree.branch dummy
+ (list (tree.leaf dummy)
+ (tree.leaf dummy)
+ (tree.leaf dummy)
+ (tree.leaf expected)))
+ /.zipper
+ (pipe.do maybe.monad
+ [/.end]
+ [/.value (n.= expected) in])
+ (maybe.else false)))
+ (_.coverage [/.start]
+ (|> (tree.branch expected
+ (list (tree.leaf dummy)
+ (tree.leaf dummy)
+ (tree.leaf dummy)
+ (tree.leaf dummy)))
+ /.zipper
+ (pipe.do maybe.monad
+ [/.end]
+ [/.start]
+ [/.value (n.= expected) in])
+ (maybe.else false)))
+ (_.coverage [/.previous]
+ (and (|> (tree.branch expected
+ (list (tree.leaf dummy)
+ (tree.leaf dummy)))
+ /.zipper
+ (pipe.do maybe.monad
+ [/.next]
+ [/.previous]
+ [/.value (n.= expected) in])
+ (maybe.else false))
+ (|> (tree.branch dummy
+ (list (tree.leaf expected)
+ (tree.leaf dummy)))
+ /.zipper
+ (pipe.do maybe.monad
+ [/.next]
+ [/.next]
+ [/.previous]
+ [/.value (n.= expected) in])
+ (maybe.else false))))
)))
(def: .public test
@@ -169,93 +169,93 @@
(_.for [/.comonad]
($comonad.spec (|>> tree.leaf /.zipper) /.equivalence /.comonad))
- (_.cover [/.zipper /.tree]
- (|> sample /.zipper /.tree (tree#= sample)))
- (_.cover [/.start?]
- (|> sample /.zipper /.start?))
- (_.cover [/.leaf?]
- (/.leaf? (/.zipper (tree.leaf expected))))
- (_.cover [/.branch?]
- (and (/.branch? (/.zipper (tree.branch expected (list (tree.leaf expected)))))
- (not (/.branch? (/.zipper (tree.branch expected (list)))))))
- (_.cover [/.value]
- (and (n.= expected (/.value (/.zipper (tree.leaf expected))))
- (n.= expected (/.value (/.zipper (tree.branch expected (list (tree.leaf expected))))))))
- (_.cover [/.set]
- (|> (/.zipper (tree.leaf dummy))
- (/.set expected)
- /.value
- (n.= expected)))
- (_.cover [/.update]
- (|> (/.zipper (tree.leaf expected))
- (/.update ++)
- /.value
- (n.= (++ expected))))
+ (_.coverage [/.zipper /.tree]
+ (|> sample /.zipper /.tree (tree#= sample)))
+ (_.coverage [/.start?]
+ (|> sample /.zipper /.start?))
+ (_.coverage [/.leaf?]
+ (/.leaf? (/.zipper (tree.leaf expected))))
+ (_.coverage [/.branch?]
+ (and (/.branch? (/.zipper (tree.branch expected (list (tree.leaf expected)))))
+ (not (/.branch? (/.zipper (tree.branch expected (list)))))))
+ (_.coverage [/.value]
+ (and (n.= expected (/.value (/.zipper (tree.leaf expected))))
+ (n.= expected (/.value (/.zipper (tree.branch expected (list (tree.leaf expected))))))))
+ (_.coverage [/.set]
+ (|> (/.zipper (tree.leaf dummy))
+ (/.set expected)
+ /.value
+ (n.= expected)))
+ (_.coverage [/.update]
+ (|> (/.zipper (tree.leaf expected))
+ (/.update ++)
+ /.value
+ (n.= (++ expected))))
..move
- (_.cover [/.end?]
- (or (/.end? (/.zipper sample))
- (|> sample
- /.zipper
- /.end
- (maybe#each /.end?)
- (maybe.else false))))
- (_.cover [/.interpose]
- (let [cursor (|> (tree.branch dummy (list (tree.leaf dummy)))
- /.zipper
- (/.interpose expected))]
- (and (n.= dummy (/.value cursor))
- (|> cursor
- (pipe.do maybe.monad
- [/.down]
- [/.value (n.= expected) in])
- (maybe.else false))
- (|> cursor
- (pipe.do maybe.monad
- [/.down]
- [/.down]
- [/.value (n.= dummy) in])
- (maybe.else false)))))
- (_.cover [/.adopt]
- (let [cursor (|> (tree.branch dummy (list (tree.leaf dummy)))
- /.zipper
- (/.adopt expected))]
- (and (n.= dummy (/.value cursor))
- (|> cursor
- (pipe.do maybe.monad
- [/.down]
- [/.value (n.= expected) in])
- (maybe.else false))
- (|> cursor
- (pipe.do maybe.monad
- [/.down]
- [/.right]
- [/.value (n.= dummy) in])
- (maybe.else false)))))
- (_.cover [/.insert_left]
- (|> (tree.branch dummy (list (tree.leaf dummy)))
- /.zipper
+ (_.coverage [/.end?]
+ (or (/.end? (/.zipper sample))
+ (|> sample
+ /.zipper
+ /.end
+ (maybe#each /.end?)
+ (maybe.else false))))
+ (_.coverage [/.interpose]
+ (let [cursor (|> (tree.branch dummy (list (tree.leaf dummy)))
+ /.zipper
+ (/.interpose expected))]
+ (and (n.= dummy (/.value cursor))
+ (|> cursor
(pipe.do maybe.monad
[/.down]
- [(/.insert_left expected)]
- [/.left]
[/.value (n.= expected) in])
- (maybe.else false)))
- (_.cover [/.insert_right]
- (|> (tree.branch dummy (list (tree.leaf dummy)))
- /.zipper
+ (maybe.else false))
+ (|> cursor
(pipe.do maybe.monad
[/.down]
- [(/.insert_right expected)]
- [/.right]
- [/.value (n.= expected) in])
- (maybe.else false)))
- (_.cover [/.remove]
- (|> (tree.branch dummy (list (tree.leaf dummy)))
- /.zipper
+ [/.down]
+ [/.value (n.= dummy) in])
+ (maybe.else false)))))
+ (_.coverage [/.adopt]
+ (let [cursor (|> (tree.branch dummy (list (tree.leaf dummy)))
+ /.zipper
+ (/.adopt expected))]
+ (and (n.= dummy (/.value cursor))
+ (|> cursor
(pipe.do maybe.monad
[/.down]
- [(/.insert_left expected)]
- [/.remove]
[/.value (n.= expected) in])
- (maybe.else false)))
+ (maybe.else false))
+ (|> cursor
+ (pipe.do maybe.monad
+ [/.down]
+ [/.right]
+ [/.value (n.= dummy) in])
+ (maybe.else false)))))
+ (_.coverage [/.insert_left]
+ (|> (tree.branch dummy (list (tree.leaf dummy)))
+ /.zipper
+ (pipe.do maybe.monad
+ [/.down]
+ [(/.insert_left expected)]
+ [/.left]
+ [/.value (n.= expected) in])
+ (maybe.else false)))
+ (_.coverage [/.insert_right]
+ (|> (tree.branch dummy (list (tree.leaf dummy)))
+ /.zipper
+ (pipe.do maybe.monad
+ [/.down]
+ [(/.insert_right expected)]
+ [/.right]
+ [/.value (n.= expected) in])
+ (maybe.else false)))
+ (_.coverage [/.remove]
+ (|> (tree.branch dummy (list (tree.leaf dummy)))
+ /.zipper
+ (pipe.do maybe.monad
+ [/.down]
+ [(/.insert_left expected)]
+ [/.remove]
+ [/.value (n.= expected) in])
+ (maybe.else false)))
))))
diff --git a/stdlib/source/test/lux/data/color.lux b/stdlib/source/test/lux/data/color.lux
index 14c22b77c..de615faaf 100644
--- a/stdlib/source/test/lux/data/color.lux
+++ b/stdlib/source/test/lux/data/color.lux
@@ -69,21 +69,21 @@
(def: (encoding expected)
(-> /.Color Test)
(all _.and
- (_.cover [/.RGB /.rgb /.of_rgb]
- (|> expected /.rgb /.of_rgb
- (# /.equivalence = expected)))
- (_.cover [/.HSL /.hsl /.of_hsl]
- (|> expected /.hsl /.of_hsl
- (distance/3 expected)
- (f.<= ..rgb_error_margin)))
- (_.cover [/.HSB /.hsb /.of_hsb]
- (|> expected /.hsb /.of_hsb
- (distance/3 expected)
- (f.<= ..rgb_error_margin)))
- (_.cover [/.CMYK /.cmyk /.of_cmyk]
- (|> expected /.cmyk /.of_cmyk
- (distance/3 expected)
- (f.<= ..rgb_error_margin)))
+ (_.coverage [/.RGB /.rgb /.of_rgb]
+ (|> expected /.rgb /.of_rgb
+ (# /.equivalence = expected)))
+ (_.coverage [/.HSL /.hsl /.of_hsl]
+ (|> expected /.hsl /.of_hsl
+ (distance/3 expected)
+ (f.<= ..rgb_error_margin)))
+ (_.coverage [/.HSB /.hsb /.of_hsb]
+ (|> expected /.hsb /.of_hsb
+ (distance/3 expected)
+ (f.<= ..rgb_error_margin)))
+ (_.coverage [/.CMYK /.cmyk /.of_cmyk]
+ (|> expected /.cmyk /.of_cmyk
+ (distance/3 expected)
+ (f.<= ..rgb_error_margin)))
))
(def: transformation
@@ -99,30 +99,30 @@
(f.<= +0.75 saturation)))))))
ratio (|> random.safe_frac (random.only (f.>= +0.5)))]
(all _.and
- (_.cover [/.darker /.brighter]
- (and (f.<= (distance/3 colorful /.black)
- (distance/3 (/.darker ratio colorful) /.black))
- (f.<= (distance/3 colorful /.white)
- (distance/3 (/.brighter ratio colorful) /.white))))
- (_.cover [/.interpolated]
- (and (f.<= (distance/3 colorful /.black)
- (distance/3 (/.interpolated ratio /.black colorful) /.black))
- (f.<= (distance/3 colorful /.white)
- (distance/3 (/.interpolated ratio /.white colorful) /.white))))
- (_.cover [/.saturated]
- (f.> (saturation mediocre)
- (saturation (/.saturated ratio mediocre))))
- (_.cover [/.un_saturated]
- (f.< (saturation mediocre)
- (saturation (/.un_saturated ratio mediocre))))
- (_.cover [/.gray_scale]
- (let [gray'ed (/.gray_scale mediocre)]
- (and (f.= +0.0
- (saturation gray'ed))
- (|> (luminance gray'ed)
- (f.- (luminance mediocre))
- f.abs
- (f.<= ..rgb_error_margin)))))
+ (_.coverage [/.darker /.brighter]
+ (and (f.<= (distance/3 colorful /.black)
+ (distance/3 (/.darker ratio colorful) /.black))
+ (f.<= (distance/3 colorful /.white)
+ (distance/3 (/.brighter ratio colorful) /.white))))
+ (_.coverage [/.interpolated]
+ (and (f.<= (distance/3 colorful /.black)
+ (distance/3 (/.interpolated ratio /.black colorful) /.black))
+ (f.<= (distance/3 colorful /.white)
+ (distance/3 (/.interpolated ratio /.white colorful) /.white))))
+ (_.coverage [/.saturated]
+ (f.> (saturation mediocre)
+ (saturation (/.saturated ratio mediocre))))
+ (_.coverage [/.un_saturated]
+ (f.< (saturation mediocre)
+ (saturation (/.un_saturated ratio mediocre))))
+ (_.coverage [/.gray_scale]
+ (let [gray'ed (/.gray_scale mediocre)]
+ (and (f.= +0.0
+ (saturation gray'ed))
+ (|> (luminance gray'ed)
+ (f.- (luminance mediocre))
+ f.abs
+ (f.<= ..rgb_error_margin)))))
)))
(def: palette
@@ -141,34 +141,34 @@
random.safe_frac)]
(`` (all _.and
(~~ (template [<brightness> <palette>]
- [(_.cover [<palette>]
- (let [eB <brightness>
- expected (/.of_hsb [eH eS eB])
- palette (<palette> spread variations expected)]
- (and (n.= variations (list.size palette))
- (not (list.any? (# /.equivalence = expected) palette)))))]
+ [(_.coverage [<palette>]
+ (let [eB <brightness>
+ expected (/.of_hsb [eH eS eB])
+ palette (<palette> spread variations expected)]
+ (and (n.= variations (list.size palette))
+ (not (list.any? (# /.equivalence = expected) palette)))))]
[+1.0 /.analogous]
[+0.5 /.monochromatic]
))
(~~ (template [<palette>]
- [(_.cover [<palette>]
- (let [expected (/.of_hsb [eH eS +0.5])
- [c0 c1 c2] (<palette> expected)]
- (and (# /.equivalence = expected c0)
- (not (# /.equivalence = expected c1))
- (not (# /.equivalence = expected c2)))))]
+ [(_.coverage [<palette>]
+ (let [expected (/.of_hsb [eH eS +0.5])
+ [c0 c1 c2] (<palette> expected)]
+ (and (# /.equivalence = expected c0)
+ (not (# /.equivalence = expected c1))
+ (not (# /.equivalence = expected c2)))))]
[/.triad]
[/.clash]
[/.split_complement]))
(~~ (template [<palette>]
- [(_.cover [<palette>]
- (let [expected (/.of_hsb [eH eS +0.5])
- [c0 c1 c2 c3] (<palette> expected)]
- (and (# /.equivalence = expected c0)
- (not (# /.equivalence = expected c1))
- (not (# /.equivalence = expected c2))
- (not (# /.equivalence = expected c3)))))]
+ [(_.coverage [<palette>]
+ (let [expected (/.of_hsb [eH eS +0.5])
+ [c0 c1 c2 c3] (<palette> expected)]
+ (and (# /.equivalence = expected c0)
+ (not (# /.equivalence = expected c1))
+ (not (# /.equivalence = expected c2))
+ (not (# /.equivalence = expected c3)))))]
[/.square]
[/.tetradic]))
@@ -191,22 +191,22 @@
($monoid.spec /.equivalence /.addition ..random))
(..encoding expected)
- (_.cover [/.complement]
- (let [~expected (/.complement expected)
- (open "/#[0]") /.equivalence]
- (and (not (/#= expected ~expected))
- (/#= expected (/.complement ~expected)))))
- (_.cover [/.black /.white]
- (and (# /.equivalence = /.white (/.complement /.black))
- (# /.equivalence = /.black (/.complement /.white))))
+ (_.coverage [/.complement]
+ (let [~expected (/.complement expected)
+ (open "/#[0]") /.equivalence]
+ (and (not (/#= expected ~expected))
+ (/#= expected (/.complement ~expected)))))
+ (_.coverage [/.black /.white]
+ (and (# /.equivalence = /.white (/.complement /.black))
+ (# /.equivalence = /.black (/.complement /.white))))
..transformation
..palette
(_.for [/.Alpha /.Pigment]
(all _.and
- (_.cover [/.transparent /.opaque]
- (and (r.= /.opaque (-- /.transparent))
- (r.= /.transparent (++ /.opaque))))
- (_.cover [/.translucent]
- (r.= /.transparent (r.+ /.translucent /.translucent)))
+ (_.coverage [/.transparent /.opaque]
+ (and (r.= /.opaque (-- /.transparent))
+ (r.= /.transparent (++ /.opaque))))
+ (_.coverage [/.translucent]
+ (r.= /.transparent (r.+ /.translucent /.translucent)))
))
))))
diff --git a/stdlib/source/test/lux/data/color/named.lux b/stdlib/source/test/lux/data/color/named.lux
index ce4f22fc3..70663ba7c 100644
--- a/stdlib/source/test/lux/data/color/named.lux
+++ b/stdlib/source/test/lux/data/color/named.lux
@@ -219,8 +219,8 @@
(template [<definition> <by_letter>]
[(def: <definition>
Test
- (_.cover <by_letter>
- ..verdict))]
+ (_.coverage <by_letter>
+ ..verdict))]
<colors>)
@@ -232,9 +232,9 @@
[<definition>]
<colors>))
- (_.cover [/.aqua]
- (# //.equivalence = /.cyan /.aqua))
- (_.cover [/.fuchsia]
- (# //.equivalence = /.magenta /.fuchsia))
+ (_.coverage [/.aqua]
+ (# //.equivalence = /.cyan /.aqua))
+ (_.coverage [/.fuchsia]
+ (# //.equivalence = /.magenta /.fuchsia))
))))
)
diff --git a/stdlib/source/test/lux/data/format/json.lux b/stdlib/source/test/lux/data/format/json.lux
index 84f31a550..63bbcab87 100644
--- a/stdlib/source/test/lux/data/format/json.lux
+++ b/stdlib/source/test/lux/data/format/json.lux
@@ -73,20 +73,20 @@
(do random.monad
[sample ..random]
- (_.cover [/.Null /.null?]
- (# bit.equivalence =
- (/.null? sample)
- (case sample
- {/.#Null} true
- _ false))))
+ (_.coverage [/.Null /.null?]
+ (# bit.equivalence =
+ (/.null? sample)
+ (case sample
+ {/.#Null} true
+ _ false))))
(do random.monad
[expected ..random]
- (_.cover [/.format]
- (|> expected
- /.format
- (# /.codec decoded)
- (try#each (#= expected))
- (try.else false))))
+ (_.coverage [/.format]
+ (|> expected
+ /.format
+ (# /.codec decoded)
+ (try#each (#= expected))
+ (try.else false))))
(do random.monad
[keys (random.set text.hash 3 (random.alphabetic 1))
values (random.set frac.hash 3 random.safe_frac)
@@ -94,55 +94,55 @@
(list#each (|>> {/.#Number}) (set.list values)))
object (/.object expected)]]
(all _.and
- (_.cover [/.object /.fields]
- (case (/.fields object)
- {try.#Success actual}
- (# (list.equivalence text.equivalence) =
- (list#each product.left expected)
- actual)
-
- {try.#Failure error}
- false))
- (_.cover [/.field]
- (list.every? (function (_ [key expected])
- (|> (/.field key object)
- (try#each (#= expected))
- (try.else false)))
- expected))
+ (_.coverage [/.object /.fields]
+ (case (/.fields object)
+ {try.#Success actual}
+ (# (list.equivalence text.equivalence) =
+ (list#each product.left expected)
+ actual)
+
+ {try.#Failure error}
+ false))
+ (_.coverage [/.field]
+ (list.every? (function (_ [key expected])
+ (|> (/.field key object)
+ (try#each (#= expected))
+ (try.else false)))
+ expected))
))
(do random.monad
[key (random.alphabetic 1)
unknown (random.only (|>> (# text.equivalence = key) not)
(random.alphabetic 1))
expected random.safe_frac]
- (_.cover [/.has]
- (<| (try.else false)
- (do try.monad
- [object (/.has key {/.#Number expected} (/.object (list)))
- .let [can_find_known_key!
- (|> object
- (/.field key)
- (try#each (#= {/.#Number expected}))
- (try.else false))
+ (_.coverage [/.has]
+ (<| (try.else false)
+ (do try.monad
+ [object (/.has key {/.#Number expected} (/.object (list)))
+ .let [can_find_known_key!
+ (|> object
+ (/.field key)
+ (try#each (#= {/.#Number expected}))
+ (try.else false))
- cannot_find_unknown_key!
- (case (/.field unknown object)
- {try.#Success _}
- false
+ cannot_find_unknown_key!
+ (case (/.field unknown object)
+ {try.#Success _}
+ false
- {try.#Failure error}
- true)]]
- (in (and can_find_known_key!
- cannot_find_unknown_key!))))))
+ {try.#Failure error}
+ true)]]
+ (in (and can_find_known_key!
+ cannot_find_unknown_key!))))))
(~~ (template [<type> <field> <tag> <random> <equivalence>]
[(do random.monad
[key (random.alphabetic 1)
value <random>]
- (_.cover [<type> <field>]
- (|> (/.object (list [key {<tag> value}]))
- (<field> key)
- (try#each (# <equivalence> = value))
- (try.else false))))]
+ (_.coverage [<type> <field>]
+ (|> (/.object (list [key {<tag> value}]))
+ (<field> key)
+ (try#each (# <equivalence> = value))
+ (try.else false))))]
[/.Boolean /.boolean_field /.#Boolean random.bit bit.equivalence]
[/.Number /.number_field /.#Number random.safe_frac frac.equivalence]
@@ -164,36 +164,36 @@
<key4> (string)
<key5> (string)
<key6> (string)]
- (_.cover [/.json]
- (and (#= {/.#Null} (/.json ()))
- (~~ (template [<tag> <value>]
- [(#= {<tag> <value>} (/.json <value>))]
-
- [/.#Boolean <boolean>]
- [/.#Number <number>]
- [/.#String <string>]
- ))
- (#= {/.#Array <array_sequence>} (/.json [() <boolean> <number> <string>]))
- (let [object (/.json {<key0> ()
- <key1> <boolean>
- <key2> <number>
- <key3> <string>
- <key4> [() <boolean> <number> <string>]
- <key5> {<key6> <number>}})]
- (<| (try.else false)
- (do try.monad
- [value0 (/.field <key0> object)
- value1 (/.field <key1> object)
- value2 (/.field <key2> object)
- value3 (/.field <key3> object)
- value4 (/.field <key4> object)
- value5 (/.field <key5> object)
- value6 (/.field <key6> value5)]
- (in (and (#= {/.#Null} value0)
- (#= {/.#Boolean <boolean>} value1)
- (#= {/.#Number <number>} value2)
- (#= {/.#String <string>} value3)
- (#= {/.#Array <array_sequence>} value4)
- (#= {/.#Number <number>} value6))))))
- )))
+ (_.coverage [/.json]
+ (and (#= {/.#Null} (/.json ()))
+ (~~ (template [<tag> <value>]
+ [(#= {<tag> <value>} (/.json <value>))]
+
+ [/.#Boolean <boolean>]
+ [/.#Number <number>]
+ [/.#String <string>]
+ ))
+ (#= {/.#Array <array_sequence>} (/.json [() <boolean> <number> <string>]))
+ (let [object (/.json {<key0> ()
+ <key1> <boolean>
+ <key2> <number>
+ <key3> <string>
+ <key4> [() <boolean> <number> <string>]
+ <key5> {<key6> <number>}})]
+ (<| (try.else false)
+ (do try.monad
+ [value0 (/.field <key0> object)
+ value1 (/.field <key1> object)
+ value2 (/.field <key2> object)
+ value3 (/.field <key3> object)
+ value4 (/.field <key4> object)
+ value5 (/.field <key5> object)
+ value6 (/.field <key6> value5)]
+ (in (and (#= {/.#Null} value0)
+ (#= {/.#Boolean <boolean>} value1)
+ (#= {/.#Number <number>} value2)
+ (#= {/.#String <string>} value3)
+ (#= {/.#Array <array_sequence>} value4)
+ (#= {/.#Number <number>} value6))))))
+ )))
))))
diff --git a/stdlib/source/test/lux/data/format/tar.lux b/stdlib/source/test/lux/data/format/tar.lux
index a62ce9de4..b4c57411f 100644
--- a/stdlib/source/test/lux/data/format/tar.lux
+++ b/stdlib/source/test/lux/data/format/tar.lux
@@ -45,30 +45,30 @@
not_ascii (random.text (random.char (unicode.set [unicode/block.katakana (list)]))
/.path_size)]
(`` (all _.and
- (_.cover [/.path /.from_path]
- (case (/.path expected)
- {try.#Success actual}
- (text#= expected
- (/.from_path actual))
-
- {try.#Failure error}
- false))
- (_.cover [/.no_path]
- (text#= "" (/.from_path /.no_path)))
- (_.cover [/.path_size /.path_is_too_long]
- (case (/.path invalid)
- {try.#Success _}
- false
-
- {try.#Failure error}
- (exception.match? /.path_is_too_long error)))
- (_.cover [/.not_ascii]
- (case (/.path not_ascii)
- {try.#Success actual}
- false
-
- {try.#Failure error}
- (exception.match? /.not_ascii error)))
+ (_.coverage [/.path /.from_path]
+ (case (/.path expected)
+ {try.#Success actual}
+ (text#= expected
+ (/.from_path actual))
+
+ {try.#Failure error}
+ false))
+ (_.coverage [/.no_path]
+ (text#= "" (/.from_path /.no_path)))
+ (_.coverage [/.path_size /.path_is_too_long]
+ (case (/.path invalid)
+ {try.#Success _}
+ false
+
+ {try.#Failure error}
+ (exception.match? /.path_is_too_long error)))
+ (_.coverage [/.not_ascii]
+ (case (/.path not_ascii)
+ {try.#Success actual}
+ false
+
+ {try.#Failure error}
+ (exception.match? /.not_ascii error)))
)))))
(def: name
@@ -80,28 +80,28 @@
not_ascii (random.text (random.char (unicode.set [unicode/block.katakana (list)]))
/.name_size)]
(`` (all _.and
- (_.cover [/.name /.from_name]
- (case (/.name expected)
- {try.#Success actual}
- (text#= expected
- (/.from_name actual))
-
- {try.#Failure error}
- false))
- (_.cover [/.name_size /.name_is_too_long]
- (case (/.name invalid)
- {try.#Success _}
- false
-
- {try.#Failure error}
- (exception.match? /.name_is_too_long error)))
- (_.cover [/.not_ascii]
- (case (/.name not_ascii)
- {try.#Success actual}
- false
-
- {try.#Failure error}
- (exception.match? /.not_ascii error)))
+ (_.coverage [/.name /.from_name]
+ (case (/.name expected)
+ {try.#Success actual}
+ (text#= expected
+ (/.from_name actual))
+
+ {try.#Failure error}
+ false))
+ (_.coverage [/.name_size /.name_is_too_long]
+ (case (/.name invalid)
+ {try.#Success _}
+ false
+
+ {try.#Failure error}
+ (exception.match? /.name_is_too_long error)))
+ (_.coverage [/.not_ascii]
+ (case (/.name not_ascii)
+ {try.#Success actual}
+ false
+
+ {try.#Failure error}
+ (exception.match? /.not_ascii error)))
)))))
(def: small
@@ -111,21 +111,21 @@
[expected (|> random.nat (# ! each (n.% /.small_limit)))
invalid (|> random.nat (# ! each (n.max /.small_limit)))]
(`` (all _.and
- (_.cover [/.small /.from_small]
- (case (/.small expected)
- {try.#Success actual}
- (n.= expected
- (/.from_small actual))
-
- {try.#Failure error}
- false))
- (_.cover [/.small_limit /.not_a_small_number]
- (case (/.small invalid)
- {try.#Success actual}
- false
-
- {try.#Failure error}
- (exception.match? /.not_a_small_number error)))
+ (_.coverage [/.small /.from_small]
+ (case (/.small expected)
+ {try.#Success actual}
+ (n.= expected
+ (/.from_small actual))
+
+ {try.#Failure error}
+ false))
+ (_.coverage [/.small_limit /.not_a_small_number]
+ (case (/.small invalid)
+ {try.#Success actual}
+ false
+
+ {try.#Failure error}
+ (exception.match? /.not_a_small_number error)))
)))))
(def: big
@@ -135,21 +135,21 @@
[expected (|> random.nat (# ! each (n.% /.big_limit)))
invalid (|> random.nat (# ! each (n.max /.big_limit)))]
(`` (all _.and
- (_.cover [/.big /.from_big]
- (case (/.big expected)
- {try.#Success actual}
- (n.= expected
- (/.from_big actual))
-
- {try.#Failure error}
- false))
- (_.cover [/.big_limit /.not_a_big_number]
- (case (/.big invalid)
- {try.#Success actual}
- false
-
- {try.#Failure error}
- (exception.match? /.not_a_big_number error)))
+ (_.coverage [/.big /.from_big]
+ (case (/.big expected)
+ {try.#Success actual}
+ (n.= expected
+ (/.from_big actual))
+
+ {try.#Failure error}
+ false))
+ (_.coverage [/.big_limit /.not_a_big_number]
+ (case (/.big invalid)
+ {try.#Success actual}
+ false
+
+ {try.#Failure error}
+ (exception.match? /.not_a_big_number error)))
)))))
(def: chunk_size 32)
@@ -168,20 +168,20 @@
(# utf8.codec encoded))]]
(`` (all _.and
(~~ (template [<type> <tag>]
- [(_.cover [<type>]
- (|> (do try.monad
- [expected_path (/.path expected_path)
- tar (|> (sequence.sequence {<tag> expected_path})
- (format.result /.writer)
- (<b>.result /.parser))]
- (in (case (sequence.list tar)
- (pattern (list {<tag> actual_path}))
- (text#= (/.from_path expected_path)
- (/.from_path actual_path))
-
- _
- false)))
- (try.else false)))]
+ [(_.coverage [<type>]
+ (|> (do try.monad
+ [expected_path (/.path expected_path)
+ tar (|> (sequence.sequence {<tag> expected_path})
+ (format.result /.writer)
+ (<b>.result /.parser))]
+ (in (case (sequence.list tar)
+ (pattern (list {<tag> actual_path}))
+ (text#= (/.from_path expected_path)
+ (/.from_path actual_path))
+
+ _
+ false)))
+ (try.else false)))]
[/.Symbolic_Link /.#Symbolic_Link]
[/.Directory /.#Directory]
@@ -189,34 +189,34 @@
(_.for [/.File /.Content /.content /.data]
(all _.and
(~~ (template [<type> <tag>]
- [(_.cover [<type>]
- (|> (do try.monad
- [expected_path (/.path expected_path)
- expected_content (/.content content)
- tar (|> (sequence.sequence {<tag> [expected_path
- expected_moment
- /.none
- [/.#user [/.#name /.anonymous
- /.#id /.no_id]
- /.#group [/.#name /.anonymous
- /.#id /.no_id]]
- expected_content]})
- (format.result /.writer)
- (<b>.result /.parser))]
- (in (case (sequence.list tar)
- (pattern (list {<tag> [actual_path actual_moment actual_mode actual_ownership actual_content]}))
- (let [seconds (is (-> Instant Int)
- (|>> instant.relative (duration.ticks duration.second)))]
- (and (text#= (/.from_path expected_path)
- (/.from_path actual_path))
- (i.= (seconds expected_moment)
- (seconds actual_moment))
- (binary#= (/.data expected_content)
- (/.data actual_content))))
-
- _
- false)))
- (try.else false)))]
+ [(_.coverage [<type>]
+ (|> (do try.monad
+ [expected_path (/.path expected_path)
+ expected_content (/.content content)
+ tar (|> (sequence.sequence {<tag> [expected_path
+ expected_moment
+ /.none
+ [/.#user [/.#name /.anonymous
+ /.#id /.no_id]
+ /.#group [/.#name /.anonymous
+ /.#id /.no_id]]
+ expected_content]})
+ (format.result /.writer)
+ (<b>.result /.parser))]
+ (in (case (sequence.list tar)
+ (pattern (list {<tag> [actual_path actual_moment actual_mode actual_ownership actual_content]}))
+ (let [seconds (is (-> Instant Int)
+ (|>> instant.relative (duration.ticks duration.second)))]
+ (and (text#= (/.from_path expected_path)
+ (/.from_path actual_path))
+ (i.= (seconds expected_moment)
+ (seconds actual_moment))
+ (binary#= (/.data expected_content)
+ (/.data actual_content))))
+
+ _
+ false)))
+ (try.else false)))]
[/.Normal /.#Normal]
[/.Contiguous /.#Contiguous]
@@ -247,13 +247,36 @@
modes (random.list 4 ..random_mode)
.let [expected_mode (list#mix /.and /.none modes)]]
(`` (all _.and
- (_.cover [/.and]
+ (_.coverage [/.and]
+ (|> (do try.monad
+ [path (/.path path)
+ content (/.content (binary.empty 0))
+ tar (|> (sequence.sequence {/.#Normal [path
+ (instant.of_millis +0)
+ expected_mode
+ [/.#user [/.#name /.anonymous
+ /.#id /.no_id]
+ /.#group [/.#name /.anonymous
+ /.#id /.no_id]]
+ content]})
+ (format.result /.writer)
+ (<b>.result /.parser))]
+ (in (case (sequence.list tar)
+ (pattern (list {/.#Normal [_ _ actual_mode _ _]}))
+ (n.= (/.mode expected_mode)
+ (/.mode actual_mode))
+
+ _
+ false)))
+ (try.else false)))
+ (~~ (template [<expected_mode>]
+ [(_.coverage [<expected_mode>]
(|> (do try.monad
[path (/.path path)
content (/.content (binary.empty 0))
tar (|> (sequence.sequence {/.#Normal [path
(instant.of_millis +0)
- expected_mode
+ <expected_mode>
[/.#user [/.#name /.anonymous
/.#id /.no_id]
/.#group [/.#name /.anonymous
@@ -263,35 +286,12 @@
(<b>.result /.parser))]
(in (case (sequence.list tar)
(pattern (list {/.#Normal [_ _ actual_mode _ _]}))
- (n.= (/.mode expected_mode)
+ (n.= (/.mode <expected_mode>)
(/.mode actual_mode))
_
false)))
- (try.else false)))
- (~~ (template [<expected_mode>]
- [(_.cover [<expected_mode>]
- (|> (do try.monad
- [path (/.path path)
- content (/.content (binary.empty 0))
- tar (|> (sequence.sequence {/.#Normal [path
- (instant.of_millis +0)
- <expected_mode>
- [/.#user [/.#name /.anonymous
- /.#id /.no_id]
- /.#group [/.#name /.anonymous
- /.#id /.no_id]]
- content]})
- (format.result /.writer)
- (<b>.result /.parser))]
- (in (case (sequence.list tar)
- (pattern (list {/.#Normal [_ _ actual_mode _ _]}))
- (n.= (/.mode <expected_mode>)
- (/.mode actual_mode))
-
- _
- false)))
- (try.else false)))]
+ (try.else false)))]
[/.none]
@@ -322,73 +322,73 @@
/.name_size)]
(_.for [/.Ownership /.Owner /.ID]
(all _.and
- (_.cover [/.name_size /.name_is_too_long]
- (case (/.name invalid)
- {try.#Success _}
- false
-
- {try.#Failure error}
- (exception.match? /.name_is_too_long error)))
- (_.cover [/.not_ascii]
- (case (/.name not_ascii)
- {try.#Success actual}
- false
-
- {try.#Failure error}
- (exception.match? /.not_ascii error)))
- (_.cover [/.Name /.name /.from_name]
- (|> (do try.monad
- [path (/.path path)
- content (/.content (binary.empty 0))
- expected (/.name expected)
- tar (|> (sequence.sequence {/.#Normal [path
- (instant.of_millis +0)
- /.none
- [/.#user [/.#name expected
- /.#id /.no_id]
- /.#group [/.#name /.anonymous
- /.#id /.no_id]]
- content]})
- (format.result /.writer)
- (<b>.result /.parser))]
- (in (case (sequence.list tar)
- (pattern (list {/.#Normal [_ _ _ actual_ownership _]}))
- (and (text#= (/.from_name expected)
- (/.from_name (the [/.#user /.#name] actual_ownership)))
- (text#= (/.from_name /.anonymous)
- (/.from_name (the [/.#group /.#name] actual_ownership))))
-
- _
- false)))
- (try.else false)))
- (_.cover [/.anonymous /.no_id]
- (|> (do try.monad
- [path (/.path path)
- content (/.content (binary.empty 0))
- tar (|> (sequence.sequence {/.#Normal [path
- (instant.of_millis +0)
- /.none
- [/.#user [/.#name /.anonymous
- /.#id /.no_id]
- /.#group [/.#name /.anonymous
- /.#id /.no_id]]
- content]})
- (format.result /.writer)
- (<b>.result /.parser))]
- (in (case (sequence.list tar)
- (pattern (list {/.#Normal [_ _ _ actual_ownership _]}))
- (and (text#= (/.from_name /.anonymous)
- (/.from_name (the [/.#user /.#name] actual_ownership)))
- (n.= (/.from_small /.no_id)
- (/.from_small (the [/.#user /.#id] actual_ownership)))
- (text#= (/.from_name /.anonymous)
- (/.from_name (the [/.#group /.#name] actual_ownership)))
- (n.= (/.from_small /.no_id)
- (/.from_small (the [/.#group /.#id] actual_ownership))))
-
- _
- false)))
- (try.else false)))
+ (_.coverage [/.name_size /.name_is_too_long]
+ (case (/.name invalid)
+ {try.#Success _}
+ false
+
+ {try.#Failure error}
+ (exception.match? /.name_is_too_long error)))
+ (_.coverage [/.not_ascii]
+ (case (/.name not_ascii)
+ {try.#Success actual}
+ false
+
+ {try.#Failure error}
+ (exception.match? /.not_ascii error)))
+ (_.coverage [/.Name /.name /.from_name]
+ (|> (do try.monad
+ [path (/.path path)
+ content (/.content (binary.empty 0))
+ expected (/.name expected)
+ tar (|> (sequence.sequence {/.#Normal [path
+ (instant.of_millis +0)
+ /.none
+ [/.#user [/.#name expected
+ /.#id /.no_id]
+ /.#group [/.#name /.anonymous
+ /.#id /.no_id]]
+ content]})
+ (format.result /.writer)
+ (<b>.result /.parser))]
+ (in (case (sequence.list tar)
+ (pattern (list {/.#Normal [_ _ _ actual_ownership _]}))
+ (and (text#= (/.from_name expected)
+ (/.from_name (the [/.#user /.#name] actual_ownership)))
+ (text#= (/.from_name /.anonymous)
+ (/.from_name (the [/.#group /.#name] actual_ownership))))
+
+ _
+ false)))
+ (try.else false)))
+ (_.coverage [/.anonymous /.no_id]
+ (|> (do try.monad
+ [path (/.path path)
+ content (/.content (binary.empty 0))
+ tar (|> (sequence.sequence {/.#Normal [path
+ (instant.of_millis +0)
+ /.none
+ [/.#user [/.#name /.anonymous
+ /.#id /.no_id]
+ /.#group [/.#name /.anonymous
+ /.#id /.no_id]]
+ content]})
+ (format.result /.writer)
+ (<b>.result /.parser))]
+ (in (case (sequence.list tar)
+ (pattern (list {/.#Normal [_ _ _ actual_ownership _]}))
+ (and (text#= (/.from_name /.anonymous)
+ (/.from_name (the [/.#user /.#name] actual_ownership)))
+ (n.= (/.from_small /.no_id)
+ (/.from_small (the [/.#user /.#id] actual_ownership)))
+ (text#= (/.from_name /.anonymous)
+ (/.from_name (the [/.#group /.#name] actual_ownership)))
+ (n.= (/.from_small /.no_id)
+ (/.from_small (the [/.#group /.#id] actual_ownership))))
+
+ _
+ false)))
+ (try.else false)))
))))
(def: .public test
@@ -398,20 +398,20 @@
(do random.monad
[_ (in [])]
(all _.and
- (_.cover [/.writer /.parser]
- (|> sequence.empty
- (format.result /.writer)
- (<b>.result /.parser)
- (# try.monad each sequence.empty?)
- (try.else false)))
- (_.cover [/.invalid_end_of_archive]
- (let [dump (format.result /.writer sequence.empty)]
- (case (<b>.result /.parser (binary#composite dump dump))
- {try.#Success _}
- false
-
- {try.#Failure error}
- (exception.match? /.invalid_end_of_archive error))))
+ (_.coverage [/.writer /.parser]
+ (|> sequence.empty
+ (format.result /.writer)
+ (<b>.result /.parser)
+ (# try.monad each sequence.empty?)
+ (try.else false)))
+ (_.coverage [/.invalid_end_of_archive]
+ (let [dump (format.result /.writer sequence.empty)]
+ (case (<b>.result /.parser (binary#composite dump dump))
+ {try.#Success _}
+ false
+
+ {try.#Failure error}
+ (exception.match? /.invalid_end_of_archive error))))
..path
..name
diff --git a/stdlib/source/test/lux/data/format/xml.lux b/stdlib/source/test/lux/data/format/xml.lux
index b4c0e7276..0e45f5d72 100644
--- a/stdlib/source/test/lux/data/format/xml.lux
+++ b/stdlib/source/test/lux/data/format/xml.lux
@@ -82,16 +82,16 @@
[(^.let symbol [namespace name]) ..symbol]
(`` (all _.and
(~~ (template [<type> <format>]
- [(_.cover [<type> <format>]
- (and (text#= name (<format> ["" name]))
- (let [symbol (<format> symbol)]
- (and (text.starts_with? namespace symbol)
- (text.ends_with? name symbol)))))]
+ [(_.coverage [<type> <format>]
+ (and (text#= name (<format> ["" name]))
+ (let [symbol (<format> symbol)]
+ (and (text.starts_with? namespace symbol)
+ (text.ends_with? name symbol)))))]
[/.Tag /.tag]
[/.Attribute /.attribute]
))
- (_.cover [/.Attrs /.attributes]
- (dictionary.empty? /.attributes))
+ (_.coverage [/.Attrs /.attributes]
+ (dictionary.empty? /.attributes))
)))
)))
diff --git a/stdlib/source/test/lux/data/product.lux b/stdlib/source/test/lux/data/product.lux
index a33f53a1d..9f7465057 100644
--- a/stdlib/source/test/lux/data/product.lux
+++ b/stdlib/source/test/lux/data/product.lux
@@ -30,17 +30,17 @@
(do random.monad
[left random.int
right random.nat]
- (_.cover [/.hash]
- (let [hash (/.hash i.hash n.hash)]
- (n.= (n.+ (# i.hash hash left)
- (# n.hash hash right))
- (# hash hash [left right])))))
+ (_.coverage [/.hash]
+ (let [hash (/.hash i.hash n.hash)]
+ (n.= (n.+ (# i.hash hash left)
+ (# n.hash hash right))
+ (# hash hash [left right])))))
- (<| (_.cover [/.left])
+ (<| (_.coverage [/.left])
(n.= expected (/.left [expected dummy])))
- (<| (_.cover [/.right])
+ (<| (_.coverage [/.right])
(n.= expected (/.right [dummy expected])))
- (<| (_.cover [/.forked])
+ (<| (_.coverage [/.forked])
(let [[left right] ((/.forked (n.+ shift) (n.- shift)) expected)]
(and (n.= (n.+ shift expected)
left)
@@ -50,19 +50,19 @@
[left random.nat
right random.nat]
(all _.and
- (<| (_.cover [/.swapped])
+ (<| (_.coverage [/.swapped])
(let [pair [left right]]
(and (n.= (/.left pair)
(/.right (/.swapped pair)))
(n.= (/.right pair)
(/.left (/.swapped pair))))))
- (<| (_.cover [/.uncurried])
+ (<| (_.coverage [/.uncurried])
(n.= (n.+ left right)
((/.uncurried n.+) [left right])))
- (<| (_.cover [/.curried])
+ (<| (_.coverage [/.curried])
(n.= (n.+ left right)
((/.curried (/.uncurried n.+)) left right)))
- (<| (_.cover [/.then])
+ (<| (_.coverage [/.then])
(let [[left' right'] (/.then (n.+ shift) (n.- shift) [left right])]
(and (n.= (n.+ shift left) left')
(n.= (n.- shift right) right'))))))
diff --git a/stdlib/source/test/lux/data/sum.lux b/stdlib/source/test/lux/data/sum.lux
index ec9e7d67d..f1b132062 100644
--- a/stdlib/source/test/lux/data/sum.lux
+++ b/stdlib/source/test/lux/data/sum.lux
@@ -36,71 +36,71 @@
($hash.spec (/.hash n.hash n.hash)
(random.or random.nat random.nat)))
- (_.cover [/.left]
- (|> (/.left expected)
- (is (Or Nat Nat))
- (pipe.case
- {0 #0 actual} (n.= expected actual)
- _ false)))
- (_.cover [/.right]
- (|> (/.right expected)
- (is (Or Nat Nat))
- (pipe.case
- {0 #1 actual} (n.= expected actual)
- _ false)))
- (_.cover [/.either]
- (and (|> (/.left expected)
- (is (Or Nat Nat))
- (/.either (n.+ shift) (n.- shift))
- (n.= (n.+ shift expected)))
- (|> (/.right expected)
- (is (Or Nat Nat))
- (/.either (n.+ shift) (n.- shift))
- (n.= (n.- shift expected)))))
- (_.cover [/.then]
- (and (|> (/.left expected)
- (is (Or Nat Nat))
- (/.then (n.+ shift) (n.- shift))
- (pipe.case {0 #0 actual} (n.= (n.+ shift expected) actual) _ false))
- (|> (/.right expected)
- (is (Or Nat Nat))
- (/.then (n.+ shift) (n.- shift))
- (pipe.case {0 #1 actual} (n.= (n.- shift expected) actual) _ false))))
+ (_.coverage [/.left]
+ (|> (/.left expected)
+ (is (Or Nat Nat))
+ (pipe.case
+ {0 #0 actual} (n.= expected actual)
+ _ false)))
+ (_.coverage [/.right]
+ (|> (/.right expected)
+ (is (Or Nat Nat))
+ (pipe.case
+ {0 #1 actual} (n.= expected actual)
+ _ false)))
+ (_.coverage [/.either]
+ (and (|> (/.left expected)
+ (is (Or Nat Nat))
+ (/.either (n.+ shift) (n.- shift))
+ (n.= (n.+ shift expected)))
+ (|> (/.right expected)
+ (is (Or Nat Nat))
+ (/.either (n.+ shift) (n.- shift))
+ (n.= (n.- shift expected)))))
+ (_.coverage [/.then]
+ (and (|> (/.left expected)
+ (is (Or Nat Nat))
+ (/.then (n.+ shift) (n.- shift))
+ (pipe.case {0 #0 actual} (n.= (n.+ shift expected) actual) _ false))
+ (|> (/.right expected)
+ (is (Or Nat Nat))
+ (/.then (n.+ shift) (n.- shift))
+ (pipe.case {0 #1 actual} (n.= (n.- shift expected) actual) _ false))))
(do !
[size (# ! each (n.% 5) random.nat)
expected (random.list size random.nat)]
(all _.and
- (_.cover [/.lefts]
- (let [actual (is (List (Or Nat Nat))
- (list#each /.left expected))]
- (and (# (list.equivalence n.equivalence) =
- expected
- (/.lefts actual))
- (# (list.equivalence n.equivalence) =
- (list)
- (/.rights actual)))))
- (_.cover [/.rights]
- (let [actual (is (List (Or Nat Nat))
- (list#each /.right expected))]
- (and (# (list.equivalence n.equivalence) =
- expected
- (/.rights actual))
- (# (list.equivalence n.equivalence) =
- (list)
- (/.lefts actual)))))
- (_.cover [/.partition]
- (let [[lefts rights] (|> expected
- (list#each (function (_ value)
- (if (n.even? value)
- (/.left value)
- (/.right value))))
- (is (List (Or Nat Nat)))
- /.partition)]
- (and (# (list.equivalence n.equivalence) =
- (list.only n.even? expected)
- lefts)
- (# (list.equivalence n.equivalence) =
- (list.only (|>> n.even? not) expected)
- rights))))
+ (_.coverage [/.lefts]
+ (let [actual (is (List (Or Nat Nat))
+ (list#each /.left expected))]
+ (and (# (list.equivalence n.equivalence) =
+ expected
+ (/.lefts actual))
+ (# (list.equivalence n.equivalence) =
+ (list)
+ (/.rights actual)))))
+ (_.coverage [/.rights]
+ (let [actual (is (List (Or Nat Nat))
+ (list#each /.right expected))]
+ (and (# (list.equivalence n.equivalence) =
+ expected
+ (/.rights actual))
+ (# (list.equivalence n.equivalence) =
+ (list)
+ (/.lefts actual)))))
+ (_.coverage [/.partition]
+ (let [[lefts rights] (|> expected
+ (list#each (function (_ value)
+ (if (n.even? value)
+ (/.left value)
+ (/.right value))))
+ (is (List (Or Nat Nat)))
+ /.partition)]
+ (and (# (list.equivalence n.equivalence) =
+ (list.only n.even? expected)
+ lefts)
+ (# (list.equivalence n.equivalence) =
+ (list.only (|>> n.even? not) expected)
+ rights))))
))
))))
diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux
index a4ecc3e09..76e6f4ccb 100644
--- a/stdlib/source/test/lux/data/text.lux
+++ b/stdlib/source/test/lux/data/text.lux
@@ -42,11 +42,11 @@
[size (# ! each (n.% 10) random.nat)
sample (random.unicode size)]
(all _.and
- (_.cover [/.size]
- (n.= size (/.size sample)))
- (_.cover [/.empty?]
- (or (/.empty? sample)
- (not (n.= 0 size)))))))
+ (_.coverage [/.size]
+ (n.= size (/.size sample)))
+ (_.coverage [/.empty?]
+ (or (/.empty? sample)
+ (not (n.= 0 size)))))))
(def: affix
Test
@@ -60,21 +60,21 @@
fake_index (-- 0)]]
(`` (all _.and
(~~ (template [<affix> <predicate>]
- [(_.cover [<affix> <predicate>]
- (<predicate> outer (<affix> outer inner)))]
+ [(_.coverage [<affix> <predicate>]
+ (<predicate> outer (<affix> outer inner)))]
[/.prefix /.starts_with?]
[/.suffix /.ends_with?]
[/.enclosed' /.enclosed_by?]
))
- (_.cover [/.enclosed]
- (let [value (/.enclosed [left right] inner)]
- (and (/.starts_with? left value)
- (/.ends_with? right value))))
- (_.cover [/.format]
- (let [sample (/.format inner)]
- (and (/.enclosed_by? /.double_quote sample)
- (/.contains? inner sample))))
+ (_.coverage [/.enclosed]
+ (let [value (/.enclosed [left right] inner)]
+ (and (/.starts_with? left value)
+ (/.ends_with? right value))))
+ (_.coverage [/.format]
+ (let [sample (/.format inner)]
+ (and (/.enclosed_by? /.double_quote sample)
+ (/.contains? inner sample))))
))))
(def: index
@@ -85,43 +85,43 @@
(random.unicode 1))
.let [fake_index (-- 0)]]
(all _.and
- (_.cover [/.contains?]
- (let [full (# /.monoid composite inner outer)]
- (and (/.contains? inner full)
- (/.contains? outer full))))
- (_.cover [/.index]
- (and (|> (/.index inner (# /.monoid composite inner outer))
- (maybe.else fake_index)
- (n.= 0))
- (|> (/.index outer (# /.monoid composite inner outer))
- (maybe.else fake_index)
- (n.= 1))))
- (_.cover [/.index_since]
- (let [full (# /.monoid composite inner outer)]
- (and (|> (/.index_since 0 inner full)
- (maybe.else fake_index)
- (n.= 0))
- (|> (/.index_since 1 inner full)
- (maybe.else fake_index)
- (n.= fake_index))
-
- (|> (/.index_since 0 outer full)
- (maybe.else fake_index)
- (n.= 1))
- (|> (/.index_since 1 outer full)
- (maybe.else fake_index)
- (n.= 1))
- (|> (/.index_since 2 outer full)
- (maybe.else fake_index)
- (n.= fake_index)))))
- (_.cover [/.last_index]
- (let [full (all (# /.monoid composite) outer inner outer)]
- (and (|> (/.last_index inner full)
- (maybe.else fake_index)
- (n.= 1))
- (|> (/.last_index outer full)
- (maybe.else fake_index)
- (n.= 2)))))
+ (_.coverage [/.contains?]
+ (let [full (# /.monoid composite inner outer)]
+ (and (/.contains? inner full)
+ (/.contains? outer full))))
+ (_.coverage [/.index]
+ (and (|> (/.index inner (# /.monoid composite inner outer))
+ (maybe.else fake_index)
+ (n.= 0))
+ (|> (/.index outer (# /.monoid composite inner outer))
+ (maybe.else fake_index)
+ (n.= 1))))
+ (_.coverage [/.index_since]
+ (let [full (# /.monoid composite inner outer)]
+ (and (|> (/.index_since 0 inner full)
+ (maybe.else fake_index)
+ (n.= 0))
+ (|> (/.index_since 1 inner full)
+ (maybe.else fake_index)
+ (n.= fake_index))
+
+ (|> (/.index_since 0 outer full)
+ (maybe.else fake_index)
+ (n.= 1))
+ (|> (/.index_since 1 outer full)
+ (maybe.else fake_index)
+ (n.= 1))
+ (|> (/.index_since 2 outer full)
+ (maybe.else fake_index)
+ (n.= fake_index)))))
+ (_.coverage [/.last_index]
+ (let [full (all (# /.monoid composite) outer inner outer)]
+ (and (|> (/.last_index inner full)
+ (maybe.else fake_index)
+ (n.= 1))
+ (|> (/.last_index outer full)
+ (maybe.else fake_index)
+ (n.= 2)))))
)))
(def: char
@@ -130,8 +130,8 @@
(_.for [/.Char /.of_char]
(`` (all _.and
(~~ (template [<short> <long>]
- [(_.cover [<short> <long>]
- (# /.equivalence = <short> <long>))]
+ [(_.coverage [<short> <long>]
+ (# /.equivalence = <short> <long>))]
[/.\0 /.null]
[/.\a /.alarm]
@@ -142,37 +142,37 @@
[/.\f /.form_feed]
[/.\r /.carriage_return]
[/.\'' /.double_quote]))
- (_.cover [/.line_feed]
- (# /.equivalence = /.new_line /.line_feed))
+ (_.coverage [/.line_feed]
+ (# /.equivalence = /.new_line /.line_feed))
)))
(do [! random.monad]
[size (# ! each (|>> (n.% 10) ++) random.nat)
characters (random.set /.hash size (random.alphabetic 1))
.let [sample (|> characters set.list /.together)]
expected (# ! each (n.% size) random.nat)]
- (_.cover [/.char]
- (case (/.char expected sample)
- {.#Some char}
- (case (/.index (/.of_char char) sample)
- {.#Some actual}
- (n.= expected actual)
+ (_.coverage [/.char]
+ (case (/.char expected sample)
+ {.#Some char}
+ (case (/.index (/.of_char char) sample)
+ {.#Some actual}
+ (n.= expected actual)
- _
- false)
-
- {.#None}
- false)))
- (_.cover [/.space /.space?]
- (`` (and (~~ (template [<char>]
- [(/.space? (`` (.char (~~ (static <char>)))))]
-
- [/.tab]
- [/.vertical_tab]
- [/.space]
- [/.new_line]
- [/.carriage_return]
- [/.form_feed]
- )))))
+ _
+ false)
+
+ {.#None}
+ false)))
+ (_.coverage [/.space /.space?]
+ (`` (and (~~ (template [<char>]
+ [(/.space? (`` (.char (~~ (static <char>)))))]
+
+ [/.tab]
+ [/.vertical_tab]
+ [/.space]
+ [/.new_line]
+ [/.carriage_return]
+ [/.form_feed]
+ )))))
))
(def: manipulation
@@ -192,70 +192,70 @@
lower (random.lower_case 1)
upper (random.upper_case 1)]
(all _.and
- (_.cover [/.together]
- (n.= (set.size characters)
- (/.size (/.together (set.list characters)))))
- (_.cover [/.interposed /.all_split_by]
- (and (|> (set.list characters)
- (/.interposed separator)
- (/.all_split_by separator)
- (set.of_list /.hash)
- (# set.equivalence = characters))
- (# /.equivalence =
- (/.together (set.list characters))
- (/.interposed "" (set.list characters)))))
- (_.cover [/.replaced_once]
- (# /.equivalence =
- (# /.monoid composite post static)
- (/.replaced_once pre post (# /.monoid composite pre static))))
- (_.cover [/.split_by]
- (case (/.split_by static (all (# /.monoid composite) pre static post))
- {.#Some [left right]}
- (and (# /.equivalence = pre left)
- (# /.equivalence = post right))
-
- {.#None}
- false))
- (_.cover [/.lower_cased]
- (let [effectiveness!
- (|> upper
- /.lower_cased
- (# /.equivalence = upper)
- not)
+ (_.coverage [/.together]
+ (n.= (set.size characters)
+ (/.size (/.together (set.list characters)))))
+ (_.coverage [/.interposed /.all_split_by]
+ (and (|> (set.list characters)
+ (/.interposed separator)
+ (/.all_split_by separator)
+ (set.of_list /.hash)
+ (# set.equivalence = characters))
+ (# /.equivalence =
+ (/.together (set.list characters))
+ (/.interposed "" (set.list characters)))))
+ (_.coverage [/.replaced_once]
+ (# /.equivalence =
+ (# /.monoid composite post static)
+ (/.replaced_once pre post (# /.monoid composite pre static))))
+ (_.coverage [/.split_by]
+ (case (/.split_by static (all (# /.monoid composite) pre static post))
+ {.#Some [left right]}
+ (and (# /.equivalence = pre left)
+ (# /.equivalence = post right))
+
+ {.#None}
+ false))
+ (_.coverage [/.lower_cased]
+ (let [effectiveness!
+ (|> upper
+ /.lower_cased
+ (# /.equivalence = upper)
+ not)
- idempotence!
- (|> lower
- /.lower_cased
- (# /.equivalence = lower))
-
- inverse!
- (|> lower
- /.upper_cased
- /.lower_cased
- (# /.equivalence = lower))]
- (and effectiveness!
- idempotence!
- inverse!)))
- (_.cover [/.upper_cased]
- (let [effectiveness!
- (|> lower
- /.upper_cased
- (# /.equivalence = lower)
- not)
+ idempotence!
+ (|> lower
+ /.lower_cased
+ (# /.equivalence = lower))
+
+ inverse!
+ (|> lower
+ /.upper_cased
+ /.lower_cased
+ (# /.equivalence = lower))]
+ (and effectiveness!
+ idempotence!
+ inverse!)))
+ (_.coverage [/.upper_cased]
+ (let [effectiveness!
+ (|> lower
+ /.upper_cased
+ (# /.equivalence = lower)
+ not)
- idempotence!
- (|> upper
- /.upper_cased
- (# /.equivalence = upper))
-
- inverse!
- (|> upper
- /.lower_cased
- /.upper_cased
- (# /.equivalence = upper))]
- (and effectiveness!
- idempotence!
- inverse!)))
+ idempotence!
+ (|> upper
+ /.upper_cased
+ (# /.equivalence = upper))
+
+ inverse!
+ (|> upper
+ /.lower_cased
+ /.upper_cased
+ (# /.equivalence = upper))]
+ (and effectiveness!
+ idempotence!
+ inverse!)))
)))
(def: .public test
@@ -287,30 +287,30 @@
.let [sample (/.together (list sampleL sampleR))
(open "/#[0]") /.equivalence]]
(all _.and
- (_.cover [/.split_at]
- (|> (/.split_at sizeL sample)
- (pipe.case
- {.#Right [_l _r]}
- (and (/#= sampleL _l)
- (/#= sampleR _r)
- (/#= sample (/.together (list _l _r))))
+ (_.coverage [/.split_at]
+ (|> (/.split_at sizeL sample)
+ (pipe.case
+ {.#Right [_l _r]}
+ (and (/#= sampleL _l)
+ (/#= sampleR _r)
+ (/#= sample (/.together (list _l _r))))
- _
- #0)))
- (_.cover [/.clip /.clip_since]
- (|> [(/.clip 0 sizeL sample)
- (/.clip sizeL (n.- sizeL (/.size sample)) sample)
- (/.clip_since sizeL sample)
- (/.clip_since 0 sample)]
- (pipe.case
- [{.#Right _l} {.#Right _r} {.#Right _r'} {.#Right _f}]
- (and (/#= sampleL _l)
- (/#= sampleR _r)
- (/#= _r _r')
- (/#= sample _f))
+ _
+ #0)))
+ (_.coverage [/.clip /.clip_since]
+ (|> [(/.clip 0 sizeL sample)
+ (/.clip sizeL (n.- sizeL (/.size sample)) sample)
+ (/.clip_since sizeL sample)
+ (/.clip_since 0 sample)]
+ (pipe.case
+ [{.#Right _l} {.#Right _r} {.#Right _r'} {.#Right _f}]
+ (and (/#= sampleL _l)
+ (/#= sampleR _r)
+ (/#= _r _r')
+ (/#= sample _f))
- _
- #0)))
+ _
+ #0)))
))
(do [! random.monad]
[sizeP bounded_size
@@ -327,9 +327,9 @@
.let [sample1 (/.together (list.interposed sep1 parts))
sample2 (/.together (list.interposed sep2 parts))
(open "/#[0]") /.equivalence]]
- (_.cover [/.replaced]
- (/#= sample2
- (/.replaced sep1 sep2 sample1))))
+ (_.coverage [/.replaced]
+ (/#= sample2
+ (/.replaced sep1 sep2 sample1))))
/buffer.test
/encoding.test
diff --git a/stdlib/source/test/lux/data/text/buffer.lux b/stdlib/source/test/lux/data/text/buffer.lux
index fe1506d88..aefc51bf1 100644
--- a/stdlib/source/test/lux/data/text/buffer.lux
+++ b/stdlib/source/test/lux/data/text/buffer.lux
@@ -29,16 +29,16 @@
mid ..part
right ..part]
(all _.and
- (_.cover [/.empty]
- (n.= 0(/.size /.empty)))
- (_.cover [/.size /.then]
- (n.= (text.size left)
- (/.size (/.then left /.empty))))
- (_.cover [/.text]
- (text#= (format left mid right)
- (|> /.empty
- (/.then left)
- (/.then mid)
- (/.then right)
- /.text)))
+ (_.coverage [/.empty]
+ (n.= 0(/.size /.empty)))
+ (_.coverage [/.size /.then]
+ (n.= (text.size left)
+ (/.size (/.then left /.empty))))
+ (_.coverage [/.text]
+ (text#= (format left mid right)
+ (|> /.empty
+ (/.then left)
+ (/.then mid)
+ (/.then right)
+ /.text)))
))))
diff --git a/stdlib/source/test/lux/data/text/encoding.lux b/stdlib/source/test/lux/data/text/encoding.lux
index eaa9b6aba..b0a70422c 100644
--- a/stdlib/source/test/lux/data/text/encoding.lux
+++ b/stdlib/source/test/lux/data/text/encoding.lux
@@ -205,8 +205,8 @@
(template [<definition> <by_letter>]
[(def: <definition>
Test
- (`` (_.cover [/.name (~~ (template.spliced <by_letter>))]
- ..verdict)))]
+ (`` (_.coverage [/.name (~~ (template.spliced <by_letter>))]
+ ..verdict)))]
<encodings>)
diff --git a/stdlib/source/test/lux/data/text/escape.lux b/stdlib/source/test/lux/data/text/escape.lux
index c7fb6d2fc..937fbf4c5 100644
--- a/stdlib/source/test/lux/data/text/escape.lux
+++ b/stdlib/source/test/lux/data/text/escape.lux
@@ -85,54 +85,54 @@
(all _.and
(do random.monad
[ascii ..ascii_range]
- (_.cover [/.escapable?]
- (`` (if (or (~~ (template [<char>]
- [(n.= (debug.private <char>) ascii)]
-
- [/.\0] [/.\a] [/.\b] [/.\t]
- [/.\n] [/.\v] [/.\f] [/.\r]
- [/.\''] [/.\\])))
- (/.escapable? ascii)
- (bit#= (/.escapable? ascii)
- (or (n.< (debug.private /.ascii_bottom) ascii)
- (n.> (debug.private /.ascii_top) ascii)))))))
+ (_.coverage [/.escapable?]
+ (`` (if (or (~~ (template [<char>]
+ [(n.= (debug.private <char>) ascii)]
+
+ [/.\0] [/.\a] [/.\b] [/.\t]
+ [/.\n] [/.\v] [/.\f] [/.\r]
+ [/.\''] [/.\\])))
+ (/.escapable? ascii)
+ (bit#= (/.escapable? ascii)
+ (or (n.< (debug.private /.ascii_bottom) ascii)
+ (n.> (debug.private /.ascii_top) ascii)))))))
(do random.monad
[left (random.char unicode.character)
right (random.char unicode.character)]
- (_.cover [/.escaped /.un_escaped]
- (let [expected (format (text.of_char left) (text.of_char right))]
- (if (or (/.escapable? left)
- (/.escapable? right))
- (let [escaped (/.escaped expected)]
- (case (/.un_escaped escaped)
- {try.#Success un_escaped}
- (and (not (text#= escaped expected))
- (text#= un_escaped expected))
-
- {try.#Failure error}
- false))
- (text#= expected (/.escaped expected))))))
+ (_.coverage [/.escaped /.un_escaped]
+ (let [expected (format (text.of_char left) (text.of_char right))]
+ (if (or (/.escapable? left)
+ (/.escapable? right))
+ (let [escaped (/.escaped expected)]
+ (case (/.un_escaped escaped)
+ {try.#Success un_escaped}
+ (and (not (text#= escaped expected))
+ (text#= un_escaped expected))
+
+ {try.#Failure error}
+ false))
+ (text#= expected (/.escaped expected))))))
(do [! random.monad]
[dummy (|> (random.char unicode.character)
(# ! each text.of_char))]
- (_.cover [/.dangling_escape]
- (case (/.un_escaped (format (/.escaped dummy) "\"))
- {try.#Success _}
- false
+ (_.coverage [/.dangling_escape]
+ (case (/.un_escaped (format (/.escaped dummy) "\"))
+ {try.#Success _}
+ false
- {try.#Failure error}
- (exception.match? /.dangling_escape error))))
+ {try.#Failure error}
+ (exception.match? /.dangling_escape error))))
(do [! random.monad]
[dummy (|> (random.char unicode.character)
(random.only (|>> (set.member? ..valid_sigils) not))
(# ! each text.of_char))]
- (_.cover [/.invalid_escape]
- (case (/.un_escaped (format "\" dummy))
- {try.#Success _}
- false
+ (_.coverage [/.invalid_escape]
+ (case (/.un_escaped (format "\" dummy))
+ {try.#Success _}
+ false
- {try.#Failure error}
- (exception.match? /.invalid_escape error))))
+ {try.#Failure error}
+ (exception.match? /.invalid_escape error))))
(do [! random.monad]
[too_short (|> (random.char unicode.character)
(# ! each (n.% (hex "1000"))))
@@ -141,17 +141,17 @@
(case (# n.hex decoded code)
{try.#Failure error} true
{try.#Success _} false))))]
- (_.cover [/.invalid_unicode_escape]
- (template.let [(!invalid <code>)
- [(case (/.un_escaped (format "\u" <code>))
- {try.#Success _}
- false
+ (_.coverage [/.invalid_unicode_escape]
+ (template.let [(!invalid <code>)
+ [(case (/.un_escaped (format "\u" <code>))
+ {try.#Success _}
+ false
- {try.#Failure error}
- (exception.match? /.invalid_unicode_escape error))]]
- (and (!invalid (# n.hex encoded too_short))
- (!invalid code)))))
- (_.cover [/.literal]
- (with_expansions [<example> (..static_sample)]
- (text#= <example> (`` (/.literal (~~ (..static_escaped <example>)))))))
+ {try.#Failure error}
+ (exception.match? /.invalid_unicode_escape error))]]
+ (and (!invalid (# n.hex encoded too_short))
+ (!invalid code)))))
+ (_.coverage [/.literal]
+ (with_expansions [<example> (..static_sample)]
+ (text#= <example> (`` (/.literal (~~ (..static_escaped <example>)))))))
)))
diff --git a/stdlib/source/test/lux/data/text/format.lux b/stdlib/source/test/lux/data/text/format.lux
index 5ac493e4e..97a9005f8 100644
--- a/stdlib/source/test/lux/data/text/format.lux
+++ b/stdlib/source/test/lux/data/text/format.lux
@@ -76,9 +76,9 @@
(~~ (template [<format> <codec> <random>]
[(do random.monad
[sample <random>]
- (_.cover [<format>]
- (text#= (# <codec> encoded sample)
- (<format> sample))))]
+ (_.coverage [<format>]
+ (text#= (# <codec> encoded sample)
+ (<format> sample))))]
[/.bit bit.codec random.bit]
[/.nat nat.decimal random.nat]
@@ -135,16 +135,16 @@
[left (random.unicode 5)
mid (random.unicode 5)
right (random.unicode 5)]
- (_.cover [/.format]
- (text#= (/.format left mid right)
- (all "lux text concat" left mid right))))
+ (_.coverage [/.format]
+ (text#= (/.format left mid right)
+ (all "lux text concat" left mid right))))
..codec
(~~ (template [<format> <alias> <random>]
[(do random.monad
[sample <random>]
- (_.cover [<format>]
- (text#= (<alias> sample)
- (<format> sample))))]
+ (_.coverage [<format>]
+ (text#= (<alias> sample)
+ (<format> sample))))]
[/.text text.format (random.unicode 5)]
[/.code code.format $///code.random]
@@ -157,30 +157,30 @@
))
(do random.monad
[members (random.list 5 random.nat)]
- (_.cover [/.list]
- (text#= (/.list /.nat members)
- (|> members
- (list#each /.nat)
- (text.interposed " ")
- list
- (/.list (|>>))))))
+ (_.coverage [/.list]
+ (text#= (/.list /.nat members)
+ (|> members
+ (list#each /.nat)
+ (text.interposed " ")
+ list
+ (/.list (|>>))))))
(do random.monad
[sample (random.maybe random.nat)]
- (_.cover [/.maybe]
- (case sample
- {.#None}
- true
-
- {.#Some value}
- (text.contains? (/.nat value)
- (/.maybe /.nat sample)))))
+ (_.coverage [/.maybe]
+ (case sample
+ {.#None}
+ true
+
+ {.#Some value}
+ (text.contains? (/.nat value)
+ (/.maybe /.nat sample)))))
(do [! random.monad]
[modulus (random.one (|>> modulus.modulus
try.maybe)
random.int)
sample (# ! each (modular.modular modulus)
random.int)]
- (_.cover [/.mod]
- (text#= (# (modular.codec modulus) encoded sample)
- (/.mod sample))))
+ (_.coverage [/.mod]
+ (text#= (# (modular.codec modulus) encoded sample)
+ (/.mod sample))))
))))
diff --git a/stdlib/source/test/lux/data/text/regex.lux b/stdlib/source/test/lux/data/text/regex.lux
index a9f5d8cc4..7488c1b83 100644
--- a/stdlib/source/test/lux/data/text/regex.lux
+++ b/stdlib/source/test/lux/data/text/regex.lux
@@ -70,210 +70,210 @@
(def: basics
Test
- (_.test "Can parse character literals."
- (and (should_pass (/.regex "a") "a")
- (should_fail (/.regex "a") ".")
- (should_pass (/.regex "\.") ".")
- (should_fail (/.regex "\.") "a"))))
+ (_.property "Can parse character literals."
+ (and (should_pass (/.regex "a") "a")
+ (should_fail (/.regex "a") ".")
+ (should_pass (/.regex "\.") ".")
+ (should_fail (/.regex "\.") "a"))))
(def: system_character_classes
Test
(all _.and
- (_.test "Can parse anything."
- (should_pass (/.regex ".") "a"))
+ (_.property "Can parse anything."
+ (should_pass (/.regex ".") "a"))
- (_.test "Can parse digits."
- (and (should_pass (/.regex "\d") "0")
- (should_fail (/.regex "\d") "m")))
+ (_.property "Can parse digits."
+ (and (should_pass (/.regex "\d") "0")
+ (should_fail (/.regex "\d") "m")))
- (_.test "Can parse non digits."
- (and (should_pass (/.regex "\D") "m")
- (should_fail (/.regex "\D") "0")))
+ (_.property "Can parse non digits."
+ (and (should_pass (/.regex "\D") "m")
+ (should_fail (/.regex "\D") "0")))
- (_.test "Can parse white-space."
- (and (should_pass (/.regex "\s") " ")
- (should_fail (/.regex "\s") "m")))
+ (_.property "Can parse white-space."
+ (and (should_pass (/.regex "\s") " ")
+ (should_fail (/.regex "\s") "m")))
- (_.test "Can parse non white-space."
- (and (should_pass (/.regex "\S") "m")
- (should_fail (/.regex "\S") " ")))
+ (_.property "Can parse non white-space."
+ (and (should_pass (/.regex "\S") "m")
+ (should_fail (/.regex "\S") " ")))
- (_.test "Can parse word characters."
- (and (should_pass (/.regex "\w") "_")
- (should_fail (/.regex "\w") "^")))
+ (_.property "Can parse word characters."
+ (and (should_pass (/.regex "\w") "_")
+ (should_fail (/.regex "\w") "^")))
- (_.test "Can parse non word characters."
- (and (should_pass (/.regex "\W") ".")
- (should_fail (/.regex "\W") "a")))
+ (_.property "Can parse non word characters."
+ (and (should_pass (/.regex "\W") ".")
+ (should_fail (/.regex "\W") "a")))
))
(def: special_system_character_classes
Test
(all _.and
- (_.test "Lower-case."
- (and (should_pass (/.regex "\p{Lower}") "m")
- (should_fail (/.regex "\p{Lower}") "M")))
- (_.test "Upper-case."
- (and (should_pass (/.regex "\p{Upper}") "M")
- (should_fail (/.regex "\p{Upper}") "m")))
- (_.test "Alphabetic."
- (and (should_pass (/.regex "\p{Alpha}") "M")
- (should_fail (/.regex "\p{Alpha}") "0")))
- (_.test "Numeric digits."
- (and (should_pass (/.regex "\p{Digit}") "1")
- (should_fail (/.regex "\p{Digit}") "n")))
- (_.test "Alphanumeric."
- (and (should_pass (/.regex "\p{Alnum}") "1")
- (should_fail (/.regex "\p{Alnum}") ".")))
- (_.test "Whitespace."
- (and (should_pass (/.regex "\p{Space}") " ")
- (should_fail (/.regex "\p{Space}") ".")))
- (_.test "Hexadecimal."
- (and (should_pass (/.regex "\p{HexDigit}") "a")
- (should_fail (/.regex "\p{HexDigit}") ".")))
- (_.test "Octal."
- (and (should_pass (/.regex "\p{OctDigit}") "6")
- (should_fail (/.regex "\p{OctDigit}") ".")))
- (_.test "Blank."
- (and (should_pass (/.regex "\p{Blank}") text.tab)
- (should_fail (/.regex "\p{Blank}") ".")))
- (_.test "ASCII."
- (and (should_pass (/.regex "\p{ASCII}") text.tab)
- (should_fail (/.regex "\p{ASCII}") (text.of_char (hex "1234")))))
- (_.test "Control characters."
- (and (should_pass (/.regex "\p{Contrl}") (text.of_char (hex "12")))
- (should_fail (/.regex "\p{Contrl}") "a")))
- (_.test "Punctuation."
- (and (should_pass (/.regex "\p{Punct}") "@")
- (should_fail (/.regex "\p{Punct}") "a")))
- (_.test "Graph."
- (and (should_pass (/.regex "\p{Graph}") "@")
- (should_fail (/.regex "\p{Graph}") " ")))
- (_.test "Print."
- (and (should_pass (/.regex "\p{Print}") (text.of_char (hex "20")))
- (should_fail (/.regex "\p{Print}") (text.of_char (hex "1234")))))
+ (_.property "Lower-case."
+ (and (should_pass (/.regex "\p{Lower}") "m")
+ (should_fail (/.regex "\p{Lower}") "M")))
+ (_.property "Upper-case."
+ (and (should_pass (/.regex "\p{Upper}") "M")
+ (should_fail (/.regex "\p{Upper}") "m")))
+ (_.property "Alphabetic."
+ (and (should_pass (/.regex "\p{Alpha}") "M")
+ (should_fail (/.regex "\p{Alpha}") "0")))
+ (_.property "Numeric digits."
+ (and (should_pass (/.regex "\p{Digit}") "1")
+ (should_fail (/.regex "\p{Digit}") "n")))
+ (_.property "Alphanumeric."
+ (and (should_pass (/.regex "\p{Alnum}") "1")
+ (should_fail (/.regex "\p{Alnum}") ".")))
+ (_.property "Whitespace."
+ (and (should_pass (/.regex "\p{Space}") " ")
+ (should_fail (/.regex "\p{Space}") ".")))
+ (_.property "Hexadecimal."
+ (and (should_pass (/.regex "\p{HexDigit}") "a")
+ (should_fail (/.regex "\p{HexDigit}") ".")))
+ (_.property "Octal."
+ (and (should_pass (/.regex "\p{OctDigit}") "6")
+ (should_fail (/.regex "\p{OctDigit}") ".")))
+ (_.property "Blank."
+ (and (should_pass (/.regex "\p{Blank}") text.tab)
+ (should_fail (/.regex "\p{Blank}") ".")))
+ (_.property "ASCII."
+ (and (should_pass (/.regex "\p{ASCII}") text.tab)
+ (should_fail (/.regex "\p{ASCII}") (text.of_char (hex "1234")))))
+ (_.property "Control characters."
+ (and (should_pass (/.regex "\p{Contrl}") (text.of_char (hex "12")))
+ (should_fail (/.regex "\p{Contrl}") "a")))
+ (_.property "Punctuation."
+ (and (should_pass (/.regex "\p{Punct}") "@")
+ (should_fail (/.regex "\p{Punct}") "a")))
+ (_.property "Graph."
+ (and (should_pass (/.regex "\p{Graph}") "@")
+ (should_fail (/.regex "\p{Graph}") " ")))
+ (_.property "Print."
+ (and (should_pass (/.regex "\p{Print}") (text.of_char (hex "20")))
+ (should_fail (/.regex "\p{Print}") (text.of_char (hex "1234")))))
))
(def: custom_character_classes
Test
(all _.and
- (_.test "Can parse using custom character classes."
- (and (should_pass (/.regex "[abc]") "a")
- (should_fail (/.regex "[abc]") "m")))
- (_.test "Can parse using character ranges."
- (and (should_pass (/.regex "[a-z]") "a")
- (should_pass (/.regex "[a-z]") "m")
- (should_pass (/.regex "[a-z]") "z")))
- (_.test "Can combine character ranges."
- (and (should_pass (/.regex "[a-zA-Z]") "a")
- (should_pass (/.regex "[a-zA-Z]") "m")
- (should_pass (/.regex "[a-zA-Z]") "z")
- (should_pass (/.regex "[a-zA-Z]") "A")
- (should_pass (/.regex "[a-zA-Z]") "M")
- (should_pass (/.regex "[a-zA-Z]") "Z")))
- (_.test "Can negate custom character classes."
- (and (should_fail (/.regex "[^abc]") "a")
- (should_pass (/.regex "[^abc]") "m")))
- (_.test "Can negate character ranges.."
- (and (should_fail (/.regex "[^a-z]") "a")
- (should_pass (/.regex "[^a-z]") "0")))
- (_.test "Can parse negate combinations of character ranges."
- (and (should_fail (/.regex "[^a-zA-Z]") "a")
- (should_pass (/.regex "[^a-zA-Z]") "0")))
- (_.test "Can make custom character classes more specific."
- (and (let [RE (/.regex "[a-z&&[def]]")]
- (and (should_fail RE "a")
- (should_pass RE "d")))
- (let [RE (/.regex "[a-z&&[^bc]]")]
- (and (should_pass RE "a")
- (should_fail RE "b")))
- (let [RE (/.regex "[a-z&&[^m-p]]")]
- (and (should_pass RE "a")
- (should_fail RE "m")
- (should_fail RE "p")))))
+ (_.property "Can parse using custom character classes."
+ (and (should_pass (/.regex "[abc]") "a")
+ (should_fail (/.regex "[abc]") "m")))
+ (_.property "Can parse using character ranges."
+ (and (should_pass (/.regex "[a-z]") "a")
+ (should_pass (/.regex "[a-z]") "m")
+ (should_pass (/.regex "[a-z]") "z")))
+ (_.property "Can combine character ranges."
+ (and (should_pass (/.regex "[a-zA-Z]") "a")
+ (should_pass (/.regex "[a-zA-Z]") "m")
+ (should_pass (/.regex "[a-zA-Z]") "z")
+ (should_pass (/.regex "[a-zA-Z]") "A")
+ (should_pass (/.regex "[a-zA-Z]") "M")
+ (should_pass (/.regex "[a-zA-Z]") "Z")))
+ (_.property "Can negate custom character classes."
+ (and (should_fail (/.regex "[^abc]") "a")
+ (should_pass (/.regex "[^abc]") "m")))
+ (_.property "Can negate character ranges.."
+ (and (should_fail (/.regex "[^a-z]") "a")
+ (should_pass (/.regex "[^a-z]") "0")))
+ (_.property "Can parse negate combinations of character ranges."
+ (and (should_fail (/.regex "[^a-zA-Z]") "a")
+ (should_pass (/.regex "[^a-zA-Z]") "0")))
+ (_.property "Can make custom character classes more specific."
+ (and (let [RE (/.regex "[a-z&&[def]]")]
+ (and (should_fail RE "a")
+ (should_pass RE "d")))
+ (let [RE (/.regex "[a-z&&[^bc]]")]
+ (and (should_pass RE "a")
+ (should_fail RE "b")))
+ (let [RE (/.regex "[a-z&&[^m-p]]")]
+ (and (should_pass RE "a")
+ (should_fail RE "m")
+ (should_fail RE "p")))))
))
(def: references
Test
(let [number (/.regex "\d+")]
- (_.test "Can build complex regexs by combining simpler ones."
- (should_check ["809-345-6789" "809" "345" "6789"]
- (/.regex "(\@<number>)-(\@<number>)-(\@<number>)")
- "809-345-6789"))))
+ (_.property "Can build complex regexs by combining simpler ones."
+ (should_check ["809-345-6789" "809" "345" "6789"]
+ (/.regex "(\@<number>)-(\@<number>)-(\@<number>)")
+ "809-345-6789"))))
(def: fuzzy_quantifiers
Test
(all _.and
- (_.test "Can sequentially combine patterns."
- (text_should_pass "aa" (/.regex "aa") "aa"))
+ (_.property "Can sequentially combine patterns."
+ (text_should_pass "aa" (/.regex "aa") "aa"))
- (_.test "Can match patterns optionally."
- (and (text_should_pass "a" (/.regex "a?") "a")
- (text_should_pass "" (/.regex "a?") "")))
+ (_.property "Can match patterns optionally."
+ (and (text_should_pass "a" (/.regex "a?") "a")
+ (text_should_pass "" (/.regex "a?") "")))
- (_.test "Can match a pattern 0 or more times."
- (and (text_should_pass "aaa" (/.regex "a*") "aaa")
- (text_should_pass "" (/.regex "a*") "")))
+ (_.property "Can match a pattern 0 or more times."
+ (and (text_should_pass "aaa" (/.regex "a*") "aaa")
+ (text_should_pass "" (/.regex "a*") "")))
- (_.test "Can match a pattern 1 or more times."
- (and (text_should_pass "aaa" (/.regex "a+") "aaa")
- (text_should_pass "a" (/.regex "a+") "a")
- (should_fail (/.regex "a+") "")))
+ (_.property "Can match a pattern 1 or more times."
+ (and (text_should_pass "aaa" (/.regex "a+") "aaa")
+ (text_should_pass "a" (/.regex "a+") "a")
+ (should_fail (/.regex "a+") "")))
))
(def: crisp_quantifiers
Test
(all _.and
- (_.test "Can match a pattern N times."
- (and (text_should_pass "aa" (/.regex "a{2}") "aa")
- (text_should_pass "a" (/.regex "a{1}") "a")
- (should_fail (/.regex "a{3}") "aa")))
-
- (_.test "Can match a pattern at-least N times."
- (and (text_should_pass "aa" (/.regex "a{1,}") "aa")
- (text_should_pass "aa" (/.regex "a{2,}") "aa")
- (should_fail (/.regex "a{3,}") "aa")))
-
- (_.test "Can match a pattern at-most N times."
- (and (text_should_pass "aa" (/.regex "a{,2}") "aa")
- (text_should_pass "aa" (/.regex "a{,3}") "aa")))
-
- (_.test "Can match a pattern between N and M times."
- (and (text_should_pass "a" (/.regex "a{1,2}") "a")
- (text_should_pass "aa" (/.regex "a{1,2}") "aa")))
+ (_.property "Can match a pattern N times."
+ (and (text_should_pass "aa" (/.regex "a{2}") "aa")
+ (text_should_pass "a" (/.regex "a{1}") "a")
+ (should_fail (/.regex "a{3}") "aa")))
+
+ (_.property "Can match a pattern at-least N times."
+ (and (text_should_pass "aa" (/.regex "a{1,}") "aa")
+ (text_should_pass "aa" (/.regex "a{2,}") "aa")
+ (should_fail (/.regex "a{3,}") "aa")))
+
+ (_.property "Can match a pattern at-most N times."
+ (and (text_should_pass "aa" (/.regex "a{,2}") "aa")
+ (text_should_pass "aa" (/.regex "a{,3}") "aa")))
+
+ (_.property "Can match a pattern between N and M times."
+ (and (text_should_pass "a" (/.regex "a{1,2}") "a")
+ (text_should_pass "aa" (/.regex "a{1,2}") "aa")))
))
(def: groups
Test
(all _.and
- (_.test "Can extract groups of sub-matches specified in a pattern."
- (and (should_check ["abc" "b"] (/.regex "a(.)c") "abc")
- (should_check ["abbbbbc" "bbbbb"] (/.regex "a(b+)c") "abbbbbc")
- (should_check ["809-345-6789" "809" "345" "6789"] (/.regex "(\d{3})-(\d{3})-(\d{4})") "809-345-6789")
- (should_check ["809-345-6789" "809" "6789"] (/.regex "(\d{3})-(?:\d{3})-(\d{4})") "809-345-6789")
- (should_check ["809-809-6789" "809" "6789"] (/.regex "(\d{3})-\0-(\d{4})") "809-809-6789")
- (should_check ["809-809-6789" "809" "6789"] (/.regex "(?<code>\d{3})-\k<code>-(\d{4})") "809-809-6789")
- (should_check ["809-809-6789-6789" "809" "6789"] (/.regex "(?<code>\d{3})-\k<code>-(\d{4})-\0") "809-809-6789-6789")))
-
- (_.test "Can specify groups within groups."
- (should_check ["809-345-6789" "809" ["345-6789" "345" "6789"]] (/.regex "(\d{3})-((\d{3})-(\d{4}))") "809-345-6789"))
+ (_.property "Can extract groups of sub-matches specified in a pattern."
+ (and (should_check ["abc" "b"] (/.regex "a(.)c") "abc")
+ (should_check ["abbbbbc" "bbbbb"] (/.regex "a(b+)c") "abbbbbc")
+ (should_check ["809-345-6789" "809" "345" "6789"] (/.regex "(\d{3})-(\d{3})-(\d{4})") "809-345-6789")
+ (should_check ["809-345-6789" "809" "6789"] (/.regex "(\d{3})-(?:\d{3})-(\d{4})") "809-345-6789")
+ (should_check ["809-809-6789" "809" "6789"] (/.regex "(\d{3})-\0-(\d{4})") "809-809-6789")
+ (should_check ["809-809-6789" "809" "6789"] (/.regex "(?<code>\d{3})-\k<code>-(\d{4})") "809-809-6789")
+ (should_check ["809-809-6789-6789" "809" "6789"] (/.regex "(?<code>\d{3})-\k<code>-(\d{4})-\0") "809-809-6789-6789")))
+
+ (_.property "Can specify groups within groups."
+ (should_check ["809-345-6789" "809" ["345-6789" "345" "6789"]] (/.regex "(\d{3})-((\d{3})-(\d{4}))") "809-345-6789"))
))
(def: alternation
Test
(all _.and
- (_.test "Can specify alternative patterns."
- (and (should_check ["a" {0 #0 []}] (/.regex "a|b") "a")
- (should_check ["b" {0 #1 []}] (/.regex "a|b") "b")
- (should_fail (/.regex "a|b") "c")))
- (_.test "Can have groups within alternations."
- (and (should_check ["abc" {0 #0 ["b" "c"]}] (/.regex "a(.)(.)|b(.)(.)") "abc")
- (should_check ["bcd" {0 #1 ["c" "d"]}] (/.regex "a(.)(.)|b(.)(.)") "bcd")
- (should_fail (/.regex "a(.)(.)|b(.)(.)") "cde")
-
- (should_check ["123-456-7890" {0 #0 ["123" "456-7890" "456" "7890"]}]
- (/.regex "(\d{3})-((\d{3})-(\d{4}))|b(.)d")
- "123-456-7890")))
+ (_.property "Can specify alternative patterns."
+ (and (should_check ["a" {0 #0 []}] (/.regex "a|b") "a")
+ (should_check ["b" {0 #1 []}] (/.regex "a|b") "b")
+ (should_fail (/.regex "a|b") "c")))
+ (_.property "Can have groups within alternations."
+ (and (should_check ["abc" {0 #0 ["b" "c"]}] (/.regex "a(.)(.)|b(.)(.)") "abc")
+ (should_check ["bcd" {0 #1 ["c" "d"]}] (/.regex "a(.)(.)|b(.)(.)") "bcd")
+ (should_fail (/.regex "a(.)(.)|b(.)(.)") "cde")
+
+ (should_check ["123-456-7890" {0 #0 ["123" "456-7890" "456" "7890"]}]
+ (/.regex "(\d{3})-((\d{3})-(\d{4}))|b(.)d")
+ "123-456-7890")))
))
(syntax: (expands? [form <code>.any])
@@ -305,17 +305,17 @@
[sample1 (random.unicode 3)
sample2 (random.unicode 3)
sample3 (random.unicode 4)]
- (_.cover [/.pattern]
- (case (format sample1 "-" sample2 "-" sample3)
- (/.pattern "(.{3})-(.{3})-(.{4})"
- [_ match1 match2 match3])
- (and (text#= sample1 match1)
- (text#= sample2 match2)
- (text#= sample3 match3))
-
- _
- false)))
- (_.cover [/.incorrect_quantification]
- (and (expands? (/.regex "a{1,2}"))
- (not (expands? (/.regex "a{2,1}")))))
+ (_.coverage [/.pattern]
+ (case (format sample1 "-" sample2 "-" sample3)
+ (/.pattern "(.{3})-(.{3})-(.{4})"
+ [_ match1 match2 match3])
+ (and (text#= sample1 match1)
+ (text#= sample2 match2)
+ (text#= sample3 match3))
+
+ _
+ false)))
+ (_.coverage [/.incorrect_quantification]
+ (and (expands? (/.regex "a{1,2}"))
+ (not (expands? (/.regex "a{2,1}")))))
)))
diff --git a/stdlib/source/test/lux/data/text/unicode/block.lux b/stdlib/source/test/lux/data/text/unicode/block.lux
index 4c4a35e69..b7c79e556 100644
--- a/stdlib/source/test/lux/data/text/unicode/block.lux
+++ b/stdlib/source/test/lux/data/text/unicode/block.lux
@@ -156,11 +156,11 @@
(template [<definition> <part>]
[(def: <definition>
Test
- (`` (_.cover [(~~ (template.spliced <part>))]
- (let [all (list.together (list <named>))
- unique (set.of_list /.hash all)]
- (n.= (list.size all)
- (set.size unique))))))]
+ (`` (_.coverage [(~~ (template.spliced <part>))]
+ (let [all (list.together (list <named>))
+ unique (set.of_list /.hash all)]
+ (n.= (list.size all)
+ (set.size unique))))))]
<blocks>
)
@@ -192,19 +192,19 @@
(_.for [/.block]
(all _.and
- (_.cover [/.start]
- (n.= start
- (/.start sample)))
- (_.cover [/.end]
- (n.= end
- (/.end sample)))
- (_.cover [/.size]
- (n.= (++ additional)
- (/.size sample)))
- (_.cover [/.within?]
- (and (/.within? sample inside)
- (not (/.within? sample (-- (/.start sample))))
- (not (/.within? sample (++ (/.end sample))))))
+ (_.coverage [/.start]
+ (n.= start
+ (/.start sample)))
+ (_.coverage [/.end]
+ (n.= end
+ (/.end sample)))
+ (_.coverage [/.size]
+ (n.= (++ additional)
+ (/.size sample)))
+ (_.coverage [/.within?]
+ (and (/.within? sample inside)
+ (not (/.within? sample (-- (/.start sample))))
+ (not (/.within? sample (++ (/.end sample))))))
(~~ (template [<definition> <part>]
[<definition>]
diff --git a/stdlib/source/test/lux/data/text/unicode/set.lux b/stdlib/source/test/lux/data/text/unicode/set.lux
index 11c1faa88..66b35626a 100644
--- a/stdlib/source/test/lux/data/text/unicode/set.lux
+++ b/stdlib/source/test/lux/data/text/unicode/set.lux
@@ -48,40 +48,40 @@
(_.for [/.equivalence]
($equivalence.spec /.equivalence ..random))
- (_.cover [/.set]
- (and (n.= (block.start left)
- (/.start (/.set [left (list)])))
- (n.= (block.end left)
- (/.end (/.set [left (list)])))))
- (_.cover [/.start]
- (n.= (n.min (block.start left)
+ (_.coverage [/.set]
+ (and (n.= (block.start left)
+ (/.start (/.set [left (list)])))
+ (n.= (block.end left)
+ (/.end (/.set [left (list)])))))
+ (_.coverage [/.start]
+ (n.= (n.min (block.start left)
+ (block.start right))
+ (/.start (/.set [left (list right)]))))
+ (_.coverage [/.end]
+ (n.= (n.max (block.end left)
+ (block.end right))
+ (/.end (/.set [left (list right)]))))
+ (_.coverage [/.member?]
+ (bit#= (block.within? block inside)
+ (/.member? (/.set [block (list)]) inside)))
+ (_.coverage [/.composite]
+ (let [composed (/.composite (/.set [left (list)])
+ (/.set [right (list)]))]
+ (and (n.= (n.min (block.start left)
(block.start right))
- (/.start (/.set [left (list right)]))))
- (_.cover [/.end]
+ (/.start composed))
(n.= (n.max (block.end left)
(block.end right))
- (/.end (/.set [left (list right)]))))
- (_.cover [/.member?]
- (bit#= (block.within? block inside)
- (/.member? (/.set [block (list)]) inside)))
- (_.cover [/.composite]
- (let [composed (/.composite (/.set [left (list)])
- (/.set [right (list)]))]
- (and (n.= (n.min (block.start left)
- (block.start right))
- (/.start composed))
- (n.= (n.max (block.end left)
- (block.end right))
- (/.end composed)))))
+ (/.end composed)))))
(~~ (template [<set>]
[(do random.monad
[char (random.char <set>)
.let [start (/.start <set>)
end (/.end <set>)]]
- (_.cover [<set>]
- (and (/.member? <set> char)
- (not (/.member? <set> (-- start)))
- (not (/.member? <set> (++ end))))))]
+ (_.coverage [<set>]
+ (and (/.member? <set> char)
+ (not (/.member? <set> (-- start)))
+ (not (/.member? <set> (++ end))))))]
[/.ascii]
[/.alphabetic]