File: crc_test.go

package info (click to toggle)
golang-github-goburrow-modbus 0.1.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 204 kB
  • sloc: ansic: 87; makefile: 2
file content (19 lines) | stat: -rw-r--r-- 405 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Copyright 2014 Quoc-Viet Nguyen. All rights reserved.
// This software may be modified and distributed under the terms
// of the BSD license. See the LICENSE file for details.

package modbus

import (
	"testing"
)

func TestCRC(t *testing.T) {
	var crc crc
	crc.reset()
	crc.pushBytes([]byte{0x02, 0x07})

	if 0x1241 != crc.value() {
		t.Fatalf("crc expected %v, actual %v", 0x1241, crc.value())
	}
}