summaryrefslogtreecommitdiff
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
parent273d9366486b7407f8d901e5304584d2ae7084d5 (diff)
add hash test
-rw-r--r--tests/modules/hash/test.lua27
-rw-r--r--xmake/rules/c++/modules/support.lua1
2 files changed, 28 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
+
diff --git a/xmake/rules/c++/modules/support.lua b/xmake/rules/c++/modules/support.lua
index cee0f1ab8..2bf44bf51 100644
--- a/xmake/rules/c++/modules/support.lua
+++ b/xmake/rules/c++/modules/support.lua
@@ -273,6 +273,7 @@ function load_moduleinfo(target, sourcefile)
if os.isfile(dependfile) then
local data = io.load(dependfile)
if data then
+ print(dependfile, data)
moduleinfo = json.decode(data.moduleinfo)
moduleinfo.sourcefile = sourcefile
end