Skip to content

Commit 33da304

Browse files
Create fletcher32_test.go
1 parent 495cff8 commit 33da304

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

checksum/fletcher32_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package checksum
2+
3+
import "testing"
4+
5+
func TestFletcher32(t *testing.T) {
6+
tests := []struct {
7+
input string
8+
expected string
9+
}{
10+
{"hello", "5E3C5E27"},
11+
{"world", "5E205B9C"},
12+
{"golang", "5E1F73CC"},
13+
{"", "000000FF"},
14+
}
15+
16+
for _, tt := range tests {
17+
t.Run(tt.input, func(t *testing.T) {
18+
got := Fletcher32Hex(tt.input)
19+
if got != tt.expected {
20+
t.Errorf("Fletcher32Hex(%q) = %q; want %q", tt.input, got, tt.expected)
21+
}
22+
})
23+
}
24+
}

0 commit comments

Comments
 (0)