aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/world/net/http/version.lux
blob: f005e944b6a4395859c5e096731353958e74e4b5 (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
(.require
 [library
  [lux (.except)
   [abstract
    [monad (.only do)]
    [\\specification
     ["$[0]" equivalence]
     ["$[0]" hash]]]
   [data
    [collection
     ["[0]" list]
     ["[0]" set]]]
   [math
    ["[0]" random (.only Random) (.use "[1]#[0]" monad)]
    [number
     ["n" nat]]]
   [test
    ["_" property (.only Test)]]]]
 [\\library
  ["[0]" /]])

(def .public random
  (Random /.Version)
  (all random.or
       (random#in /.v0_9)
       (random#in /.v1_0)
       (random#in /.v1_1)
       (random#in /.v2_0)
       ))

(def .public test
  Test
  (<| (_.covering /._)
      (do [! random.monad]
        [])
      (_.for [/.Version])
      (all _.and
           (_.for [/.equivalence]
                  ($equivalence.spec /.equivalence ..random))
           (_.for [/.hash]
                  ($hash.spec /.hash ..random))

           (_.coverage [/.v0_9 /.v1_0 /.v1_1 /.v2_0]
             (let [options (list /.v0_9 /.v1_0 /.v1_1 /.v2_0)
                   uniques (set.empty /.hash options)]
               (n.= (list.size options)
                    (set.size uniques))))
           )))