blob: b84a6f0a324c29d5dbcf9f39a4154a5152edcb21 (
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
|
(.module:
[lux #*
["%" data/text/format (#+ format)]
[abstract/monad (#+ do)]
["r" math/random (#+ Random)]
["_" test (#+ Test)]
[control
["." try]]]
{1
["." / (#+ Dynamic :dynamic :check)]})
(def: #export test
Test
(<| (_.context (%.name (name-of /._)))
(do r.monad
[expected r.nat
#let [value (:dynamic expected)]]
($_ _.and
(_.test "Can check dynamic values."
(case (:check Nat value)
(#try.Success actual)
(n/= expected actual)
(#try.Failure _)
false))
(_.test "Cannot confuse types."
(case (:check Text value)
(#try.Success actual)
false
(#try.Failure _)
true))))))
|