summaryrefslogtreecommitdiff
path: root/tests/modules/hash/test.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2025-10-07 00:23:16 +0800
committerruki <[email protected]>2025-10-06 20:49:26 +0800
commitf51cf155e87c6302ebf2368f689d358626142ac9 (patch)
tree46ab545f25f843cab1fbc8c71008d2b2fde9c8a1 /tests/modules/hash/test.lua
parent273d9366486b7407f8d901e5304584d2ae7084d5 (diff)
add hash test
Diffstat (limited to 'tests/modules/hash/test.lua')
-rw-r--r--tests/modules/hash/test.lua27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/modules/hash/test.lua b/tests/modules/hash/test.lua
new file mode 100644
index 000000000..0d40265d2
--- /dev/null
+++ b/tests/modules/hash/test.lua
@@ -0,0 +1,27 @@
+function test_rand32(t)
+ local set = {}
+ for i = 1, 1000000 do
+ local r = hash.rand32()
+ t:require(set[r] == nil)
+ set[r] = true
+ end
+end
+
+function test_rand64(t)
+ local set = {}
+ for i = 1, 1000000 do
+ local r = hash.rand64()
+ t:require(set[r] == nil)
+ set[r] = true
+ end
+end
+
+function test_rand128(t)
+ local set = {}
+ for i = 1, 1000000 do
+ local r = hash.rand128()
+ t:require(set[r] == nil)
+ set[r] = true
+ end
+end
+