blob: e07f584b1acba74ae4e9a0d07aacf2d09eb86006 (
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
(.module:
[lux #*
["%" data/text/format (#+ format)]
["_" test (#+ Test)]
[abstract
[monad (#+ do)]
{[0 #spec]
[/
["$." equivalence]
["$." order]
["$." enum]
["$." interval]
["$." monoid]
["$." codec]]}]
[math
["r" random]]]
{1
["." /
//]})
(def: #export test
Test
(<| (_.context (%.name (name-of /._)))
(`` ($_ _.and
($equivalence.spec /.equivalence r.nat)
($order.spec /.order r.nat)
($enum.spec /.enum r.nat)
($interval.spec /.interval r.nat)
(~~ (template [<monoid>]
[(<| (_.context (%.name (name-of <monoid>)))
($monoid.spec /.equivalence <monoid> r.nat))]
[/.addition] [/.multiplication] [/.minimum] [/.maximum]
))
(~~ (template [<codec>]
[(<| (_.context (%.name (name-of /.binary)))
($codec.spec /.equivalence <codec> r.nat))]
[/.binary] [/.octal] [/.decimal] [/.hex]
))
(_.test "Alternate notations."
(and (/.= (bin "11001001")
(bin "11,00,10,01"))
(/.= (oct "615243")
(oct "615,243"))
(/.= (hex "deadBEEF")
(hex "dead,BEEF"))))
))))
|