forked from sigurn/crc16
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcrc16_test.go
112 lines (84 loc) · 2.11 KB
/
crc16_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
package crc16
import (
"testing"
)
var testData = []byte("123456789")
func testSelectedCRC(params Params, t *testing.T) {
table := MakeTable(params)
if table == nil {
t.Errorf("Failed to create %q computer", params.Name)
}
crc := Checksum(testData, table)
if crc != table.params.Check {
t.Errorf("Invalid %q sample calculation, expected: %X, actual: %X", table.params.Name, table.params.Check, crc)
}
}
func TestCRC16_ARC(t *testing.T) {
testSelectedCRC(CRC16_ARC, t)
}
func TestCRC16_AUG_CCIT(t *testing.T) {
testSelectedCRC(CRC16_AUG_CCITT, t)
}
func TestCRC16_BUYPASS(t *testing.T) {
testSelectedCRC(CRC16_BUYPASS, t)
}
func TestCRC16_CCITT_FALSE(t *testing.T) {
testSelectedCRC(CRC16_CCITT_FALSE, t)
}
func TestCRC16_CDMA2000(t *testing.T) {
testSelectedCRC(CRC16_CDMA2000, t)
}
func TestCRC16_DDS_110(t *testing.T) {
testSelectedCRC(CRC16_DDS_110, t)
}
func TestCRC16_DECT_R(t *testing.T) {
testSelectedCRC(CRC16_DECT_R, t)
}
func TestCRC16_DECT_X(t *testing.T) {
testSelectedCRC(CRC16_DECT_X, t)
}
func TestCRC16_DNP(t *testing.T) {
testSelectedCRC(CRC16_DNP, t)
}
func TestCRC16_EN_13757(t *testing.T) {
testSelectedCRC(CRC16_EN_13757, t)
}
func TestCRC16_GENIBUS(t *testing.T) {
testSelectedCRC(CRC16_GENIBUS, t)
}
func TestCRC16_MAXIM(t *testing.T) {
testSelectedCRC(CRC16_MAXIM, t)
}
func TestCRC16_MCRF4XX(t *testing.T) {
testSelectedCRC(CRC16_MCRF4XX, t)
}
func TestCRC16_RIELLO(t *testing.T) {
testSelectedCRC(CRC16_RIELLO, t)
}
func TestCRC16_T10_DIF(t *testing.T) {
testSelectedCRC(CRC16_T10_DIF, t)
}
func TestCRC16_TELEDISK(t *testing.T) {
testSelectedCRC(CRC16_TELEDISK, t)
}
func TestCRC16_TMS37157(t *testing.T) {
testSelectedCRC(CRC16_TMS37157, t)
}
func TestCRC16_USB(t *testing.T) {
testSelectedCRC(CRC16_USB, t)
}
func TestCRC16_CRC_A(t *testing.T) {
testSelectedCRC(CRC16_CRC_A, t)
}
func TestCRC16_KERMIT(t *testing.T) {
testSelectedCRC(CRC16_KERMIT, t)
}
func TestCRC16_MODBUS(t *testing.T) {
testSelectedCRC(CRC16_MODBUS, t)
}
func TestCRC16_X_25(t *testing.T) {
testSelectedCRC(CRC16_X_25, t)
}
func TestCRC16_XMODEM(t *testing.T) {
testSelectedCRC(CRC16_XMODEM, t)
}