From 33da304f009e37cf195f0e48a4d311002d79f116 Mon Sep 17 00:00:00 2001 From: Priyanshu Singh <123263608+dev-priyanshu15@users.noreply.github.com> Date: Sat, 12 Oct 2024 16:03:22 +0530 Subject: [PATCH] Create fletcher32_test.go --- checksum/fletcher32_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 checksum/fletcher32_test.go diff --git a/checksum/fletcher32_test.go b/checksum/fletcher32_test.go new file mode 100644 index 000000000..b6f54d64d --- /dev/null +++ b/checksum/fletcher32_test.go @@ -0,0 +1,24 @@ +package checksum + +import "testing" + +func TestFletcher32(t *testing.T) { + tests := []struct { + input string + expected string + }{ + {"hello", "5E3C5E27"}, + {"world", "5E205B9C"}, + {"golang", "5E1F73CC"}, + {"", "000000FF"}, + } + + for _, tt := range tests { + t.Run(tt.input, func(t *testing.T) { + got := Fletcher32Hex(tt.input) + if got != tt.expected { + t.Errorf("Fletcher32Hex(%q) = %q; want %q", tt.input, got, tt.expected) + } + }) + } +}