aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/data/format/binary.lux
blob: 4210d256316864fd72246218130fe5f43d94b515 (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
(.using
 [library
  [lux (.except)
   ["_" test (.only Test)]
   [abstract
    [equivalence (.only Equivalence)]
    [monad (.only do)]
    [\\specification
     ["$[0]" monoid]]]
   [data
    ["[0]" binary ("[1]#[0]" equivalence)]]
   [math
    ["[0]" random (.only Random)]]]]
 [\\library
  ["[0]" /]])

(implementation: equivalence
  (Equivalence /.Specification)

  (def: (= reference subject)
    (binary#= (/.instance reference)
              (/.instance subject))))

(def: random
  (Random /.Specification)
  (# random.monad each /.nat random.nat))

(def: .public test
  Test
  (<| (_.covering /._)
      (_.for [/.Mutation /.Specification /.Writer])
      (all _.and
           (_.for [/.monoid]
                  ($monoid.spec ..equivalence /.monoid ..random))
           )))