File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,29 @@ func TestMd5Hex(t *testing.T) {
2525 assert .Equal (t , md5Digest , actual )
2626}
2727
28+ func TestHash (t * testing.T ) {
29+ result := Hash ([]byte (text ))
30+ assert .NotEqual (t , uint64 (0 ), result )
31+ }
32+
33+ func TestHash_Deterministic (t * testing.T ) {
34+ data := []byte ("consistent-hash-test" )
35+ first := Hash (data )
36+ second := Hash (data )
37+ assert .Equal (t , first , second )
38+ }
39+
40+ func TestHash_Empty (t * testing.T ) {
41+ // Hash should not panic on empty input.
42+ result := Hash ([]byte {})
43+ _ = result
44+ }
45+
46+ func TestMd5Hex_Empty (t * testing.T ) {
47+ result := Md5Hex ([]byte {})
48+ assert .Equal (t , 32 , len (result ))
49+ }
50+
2851func BenchmarkHashFnv (b * testing.B ) {
2952 for i := 0 ; i < b .N ; i ++ {
3053 h := fnv .New32 ()
You can’t perform that action at this time.
0 commit comments