summaryrefslogtreecommitdiff
path: root/tests/modules
diff options
context:
space:
mode:
authorruki <[email protected]>2025-10-06 22:52:07 +0800
committerGitHub <[email protected]>2025-10-06 22:52:07 +0800
commit8bcc3569cba28654540fdca7a3954b814fae6ac6 (patch)
tree25d1efdc2d44d485782936e0e8023fc69e7436ac /tests/modules
parent273d9366486b7407f8d901e5304584d2ae7084d5 (diff)
parent69caeb34da2be2d03a86752b144c75881fcabf8f (diff)
Merge pull request #6896 from xmake-io/hash
add hash test
Diffstat (limited to 'tests/modules')
-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..06722fd9d
--- /dev/null
+++ b/tests/modules/hash/test.lua
@@ -0,0 +1,27 @@
+function test_rand32(t)
+ local set = {}
+ for i = 1, 1000 do
+ local r = hash.rand32()
+ t:require(set[r] == nil)
+ set[r] = r
+ end
+end
+
+function test_rand64(t)
+ local set = {}
+ for i = 1, 100000 do
+ local r = hash.rand64()
+ t:require(set[r] == nil)
+ set[r] = r
+ end
+end
+
+function test_rand128(t)
+ local set = {}
+ for i = 1, 100000 do
+ local r = hash.rand128()
+ t:require(set[r] == nil)
+ set[r] = r
+ end
+end
+