blob: f18d110c22204927689baaba2a56a74bac3905c6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
(.module:
[lux #*
["_" test (#+ Test)]
[control
[monad (#+ do)]]
[data
[text
format]]
[math
["r" random (#+ Random)]]]
{1
["." / (#+ Order)]})
(def: #export (spec (^open ",@.") generator)
(All [a] (-> (Order a) (Random a) Test))
(do r.monad
[left generator
right generator]
(<| (_.context (%name (name-of /.Order)))
($_ _.and
(_.test "Values are either ordered, or they are equal. All options are mutually exclusive."
(if (,@= left right)
(not (or (,@< left right)
(,@> left right)))
(if (,@< left right)
(not (,@> left right))
(,@> left right))))))))
|