test: add hash/maphash demo test case

Add test case in _demo/go/maphash to verify hash/maphash functionality
with the new runtime.rand and runtime.memhash support.

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
Co-authored-by: xgopilot <noreply@goplus.org>
This commit is contained in:
xgopilot
2025-10-14 07:11:17 +00:00
parent cf6cc937ef
commit 441b4b15a8

View File

@@ -0,0 +1,26 @@
package main
import (
"fmt"
"hash/maphash"
)
func main() {
var h maphash.Hash
h.WriteString("hello")
fmt.Printf("0x%x\n", h.Sum64())
h.Reset()
h.WriteString("world")
fmt.Printf("0x%x\n", h.Sum64())
h.Reset()
h.WriteString("test")
v1 := h.Sum64()
h.Reset()
h.WriteString("test")
v2 := h.Sum64()
fmt.Printf("0x%x == 0x%x\n", v1, v2)
}