blob: b57489b0f9b085089413b1af12071f17a49250c8 (
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))))))))
|