crc_test.go 405 B

12345678910111213141516171819
  1. // Copyright 2014 Quoc-Viet Nguyen. All rights reserved.
  2. // This software may be modified and distributed under the terms
  3. // of the BSD license. See the LICENSE file for details.
  4. package modbus
  5. import (
  6. "testing"
  7. )
  8. func TestCRC(t *testing.T) {
  9. var crc crc
  10. crc.reset()
  11. crc.pushBytes([]byte{0x02, 0x07})
  12. if 0x1241 != crc.value() {
  13. t.Fatalf("crc expected %v, actual %v", 0x1241, crc.value())
  14. }
  15. }