aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/meta/compiler/reference/variable.lux
blob: b25c0e755bbf1c6f145b7f695b0ce2063ad04fb5 (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)]
    ["[0]" equivalence
     ["[1]T" \\test]]
    [\\specification
     ["$[0]" hash]]]
   [data
    ["[0]" text (.use "[1]#[0]" equivalence)]]
   [math
    ["[0]" random (.only Random)]]
   [test
    ["_" property (.only Test)]]]]
 [\\library
  ["[0]" /]])

(def .public random
  (Random /.Variable)
  (all random.or
       random.nat
       random.nat
       ))

(def .public test
  Test
  (<| (_.covering /._)
      (_.for [/.Variable
              /.#Local /.#Foreign])
      (do [! random.monad]
        [register random.nat]
        (all _.and
             (_.for [/.equivalence]
                    (equivalenceT.spec /.equivalence ..random))
             (_.for [/.hash]
                    ($hash.spec /.hash ..random))
             
             (_.coverage [/.self]
               (when (/.self)
                 (/.self) true
                 _ false))
             (_.coverage [/.self?]
               (/.self? (/.self)))
             (_.for [/.Register]
                    (_.coverage [/.format]
                      (not (text#= (/.format {/.#Local register})
                                   (/.format {/.#Foreign register})))))
             ))))