Skip to content

Commit

Permalink
Create crc16_test.go
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-priyanshu15 authored Oct 12, 2024
1 parent 495cff8 commit a4b9255
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions checksum/crc16_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package checksum

import "testing"

func TestCRC16(t *testing.T) {
tests := []struct {
input string
expected string
}{
{"hello", "A001"},
{"world", "B5D0"},
{"golang", "A34C"},
{"", "A001"},
}

for _, tt := range tests {
t.Run(tt.input, func(t *testing.T) {
got := CRC16Hex(tt.input)
if got != tt.expected {
t.Errorf("CRC16Hex(%q) = %q; want %q", tt.input, got, tt.expected)
}
})
}
}

0 comments on commit a4b9255

Please sign in to comment.