... 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]" text]]
   [math
    ["[0]" random (.only Random)]]
   [test
    ["_" property (.only Test)]]]]
 [\\library
  ["[0]" /]])

(the .public random
  (Random /.Variable)
  (all random.or
       random.natural
       random.natural
       ))

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