(.require
 [library
  [lux (.except)
   [abstract
    [monad (.only do)]
    [\\specification
     ["$[0]" equivalence]
     ["$[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])
      (do [! random.monad]
        [register random.nat]
        (all _.and
             (_.for [/.equivalence]
                    ($equivalence.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})))))
             ))))
