MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / TestHash

Function TestHash

hashing/sha1/sha1_test.go:32–42  ·  view source on GitHub ↗

TestHash verifies that the Hash function produces the correct SHA-1 hash values

(t *testing.T)

Source from the content-addressed store, hash-verified

30
31// TestHash verifies that the Hash function produces the correct SHA-1 hash values
32func TestHash(t *testing.T) {
33 for _, tt := range tests {
34 t.Run(tt.input, func(t *testing.T) {
35 result := Hash([]byte(tt.input))
36 resultHex := toHexString(result)
37 if resultHex != tt.expected {
38 t.Errorf("SHA-1(%q) = %s; want %s", tt.input, resultHex, tt.expected)
39 }
40 })
41 }
42}

Callers

nothing calls this directly

Calls 2

HashFunction · 0.70
toHexStringFunction · 0.70

Tested by

no test coverage detected