test_crc16Fast.cpp 486 B

123456789101112131415161718192021
  1. #include "test/framework/catch.hpp"
  2. #include <string.h>
  3. #define SHELLMATTA_TRANSPORT
  4. #undef SHELLMATTA_YMODEM_CRC_NO_LOOKUP
  5. #include "test_crc_data.h"
  6. #include "src/shellmatta_crc.c"
  7. TEST_CASE( "shellmatta_crc crc16Fast" ) {
  8. uint32_t crc = crc16Fast((char*)"123456789", 9, crc16Table);
  9. REQUIRE(crc == 0x31C3u);
  10. }
  11. TEST_CASE( "shellmatta_crc crc16Fast - more data" ) {
  12. uint32_t crc = crc16Fast((char*)data, sizeof(data), crc16Table);
  13. REQUIRE(crc == data_crc_16);
  14. }