aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/time/day.lux
blob: 84d404a21a74e26e606cf6b47cac35eb4e76a6d1 (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
(.module:
  [lux #*
   data/text/format
   ["_" test (#+ Test)]
   [control
    {[0 #test]
     [/
      ["$." equivalence]
      ["$." order]
      ["$." enum]]}]
   [math
    ["r" random (#+ Random) ("#@." monad)]]]
  {1
   ["." / (#+ Day)]})

(def: #export day
  (Random Day)
  (r.either (r.either (r.either (r@wrap #/.Sunday)
                                (r@wrap #/.Monday))
                      (r.either (r@wrap #/.Tuesday)
                                (r@wrap #/.Wednesday)))
            (r.either (r.either (r@wrap #/.Thursday)
                                (r@wrap #/.Friday))
                      (r@wrap #/.Saturday))))

(def: #export test
  Test
  (<| (_.context (%name (name-of /._)))
      ($_ _.and
          ($equivalence.spec /.equivalence ..day)
          ($order.spec /.order ..day)
          ($enum.spec /.enum ..day)
          )))