awtk/tests/crc_test.cc

12 lines
290 B
C++
Raw Normal View History

2023-02-19 17:50:13 +08:00
#include "tkc/crc.h"
#include "gtest/gtest.h"
TEST(crc, crc32_file) {
2023-11-28 17:47:26 +08:00
ASSERT_EQ(tk_crc32_file("tests/testdata/test.png", 1024), 2727069354);
2023-02-19 17:50:13 +08:00
}
2023-10-02 07:17:29 +08:00
TEST(crc, crc32_modbus) {
uint8_t data[] = {0x11, 0x05, 0x01, 0x30, 0xff, 0x00};
2023-10-04 18:22:34 +08:00
ASSERT_EQ(tk_crc16_modbus(data, sizeof(data)), 0x598f);
2023-10-02 07:17:29 +08:00
}