aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/world/net/http/version.lux
blob: 5891f3768b707b40bc99ba862b20fc1178e303cf (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
(.require
 [library
  [lux (.except)
   [abstract
    [monad (.only do)]
    [\\specification
     ["$[0]" hash]]
    ["[0]" equivalence
     ["[1]T" \\test]]]
   [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.either
       (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]
                  (equivalenceT.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.of_list /.hash options)]
               (n.= (list.size options)
                    (set.size uniques))))
           )))