aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/meta/compiler/meta/archive/unit.lux
blob: e77f7489b45326d49a2d8d9fac6d1fb85d3f1a44 (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
50
51
... This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
... If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

(.require
 [library
  [lux (.except)
   [abstract
    [monad (.only do)]
    ["[0]" equivalence
     ["[1]T" \\test]]
    ["[0]" hash
     ["[1]T" \\test]]]
   [data
    ["[0]" bit (.use "[1]#[0]" equivalence)]
    ["[0]" text (.use "[1]#[0]" equivalence)]
    [collection
     ["[0]" set]]]
   [math
    ["[0]" random (.only Random)]]
   [test
    ["_" property (.only Test)]]]]
 [\\library
  ["[0]" /]])

(def .public random
  (Random /.ID)
  (all random.and
       random.nat
       random.nat
       ))

(def .public test
  Test
  (<| (_.covering /._)
      (do random.monad
        [left ..random
         right ..random])
      (_.for [/.ID
              /.#module /.#artifact])
      (all _.and
           (_.for [/.equivalence]
                  (equivalenceT.spec /.equivalence ..random))
           (_.for [/.hash]
                  (hashT.spec /.hash ..random))
           
           (_.coverage [/.none]
             (set.empty? /.none))
           (_.coverage [/.format]
             (bit#= (of /.equivalence = left right)
                    (text#= (/.format left) (/.format right))))
           )))