package TestUnit import ( "fmt" "hash/crc32" "log" "testing" ) import "goUpload/utils" func TestCRC16CCITT(t *testing.T) { crc16 := utils.NewCRC16CCITT() data := []byte{0x01, 0x02, 0x03, 0x04} result := crc16.GetWCRCin(data) // 输出CRC16结果 log.Printf("CRC16CCITT 结果=%x", result) crc2 := crc32.ChecksumIEEE(data) // 输出校验值 fmt.Printf("Checksum is %x\n", crc2) }