blob: 88f456bcabf8d20a00e56110fb6c43549d1a5d55 (
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
|
(.module:
[lux #*
["_" test (#+ Test)]
[data
["." name]
["%" text/format (#+ format)]]
[abstract
[monad (#+ do)]
{[0 #spec]
[/
["$." equivalence]]}]
[math
["r" random (#+ Random)]]]
{1
["." /
["/#" // #_
["#." i64 (#+ Mask)]]]})
(def: #export i8
(Random /.I8)
(\ r.functor map /.i8 r.i64))
(def: mask
Mask
(//i64.or //i64.sign
(//i64.mask 7)))
(def: #export test
Test
(<| (_.context (name.module (name-of /._)))
(do {! r.monad}
[expected (\ ! map (|>> (//i64.and ..mask) (: I64)) r.i64)]
($_ _.and
($equivalence.spec /.equivalence ..i8)
(_.test "Can convert between I64 and I8"
(let [actual (|> expected /.i8 /.i64)]
(\ //i64.equivalence = expected actual)))
))))
|