aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/abstract/hash.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/lux/abstract/hash.lux')
-rw-r--r--stdlib/source/test/lux/abstract/hash.lux20
1 files changed, 19 insertions, 1 deletions
diff --git a/stdlib/source/test/lux/abstract/hash.lux b/stdlib/source/test/lux/abstract/hash.lux
index fb6bf8925..51c8ec7f3 100644
--- a/stdlib/source/test/lux/abstract/hash.lux
+++ b/stdlib/source/test/lux/abstract/hash.lux
@@ -3,13 +3,15 @@
[lux (.except)
[abstract
[monad (.only do)]
+ ["[0]" equivalence
+ ["[1]T" \\test]]
[functor
["[0]" contravariant
["[1]T" \\test]]]]
[data
["[0]" bit (.use "[1]#[0]" equivalence)]]
[math
- ["[0]" random]
+ ["[0]" random (.only Random)]
[number
["[0]" nat]]]
[test
@@ -19,6 +21,22 @@
[//
[equivalence (.only Equivalence)]]]])
+(def .public (spec (open "/#[0]") random)
+ (All (_ of)
+ (-> (/.Hash of) (Random of)
+ Test))
+ (do random.monad
+ [parameter random
+ subject random]
+ (all _.and
+ (_.for [/.equivalence]
+ (equivalenceT.spec /#equivalence random))
+ (_.coverage [/.Hash /.hash]
+ (if (/#= parameter subject)
+ (nat.= (/#hash parameter) (/#hash subject))
+ true))
+ )))
+
(def .public test
Test
(do random.monad