Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create crc16_test.go #755

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)

Check failure on line 18 in checksum/crc16_test.go

View workflow job for this annotation

GitHub Actions / Code style and tests

undefined: CRC16Hex (typecheck)

Check failure on line 18 in checksum/crc16_test.go

View workflow job for this annotation

GitHub Actions / Code style and tests

undefined: CRC16Hex) (typecheck)

Check failure on line 18 in checksum/crc16_test.go

View workflow job for this annotation

GitHub Actions / upload_coverage_report

undefined: CRC16Hex
if got != tt.expected {
t.Errorf("CRC16Hex(%q) = %q; want %q", tt.input, got, tt.expected)
}
})
}
}
Loading