github.com/la5nta/wl2k-go@v0.11.8/transport/ardop/crc16_test.go (about) 1 // Copyright 2015 Martin Hebnes Pedersen (LA5NTA). All rights reserved. 2 // Use of this source code is governed by the MIT-license that can be 3 // found in the LICENSE file. 4 5 package ardop 6 7 import "testing" 8 9 func TestCRC16Sum(t *testing.T) { 10 tests := map[string]uint16{ 11 "RDY\r": 55805, 12 "voluptatem accusantium": 24749, 13 "hagavik": 44843, 14 15 "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor": 50066, 16 } 17 18 for data, expected := range tests { 19 got := crc16Sum([]byte(data)) 20 if got != expected { 21 t.Errorf("'%s' crc16 checksum failed.", data) 22 } 23 } 24 }