LCOV - code coverage report
Current view: top level - firmware/libfirmware/util/test - test_crc.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 16 16 100.0 %
Date: 2024-04-25 02:23:43 Functions: 8 8 100.0 %

          Line data    Source code
       1             : #include <gtest/gtest.h>
       2             : 
       3             : #include <rusefi/crc.h>
       4             : 
       5           4 : TEST(Util_CRC, crc8) {
       6           1 :         const uint8_t crc8_tab[] = {0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38};
       7             : 
       8           1 :         ASSERT_EQ(0xB, crc8(crc8_tab, 8));
       9             : }
      10             : 
      11           4 : TEST(Util_CRC, crc) {
      12           1 :         const char * A = "A";
      13             : 
      14           1 :         uint32_t c = crc32(A, 1);
      15           1 :         printf("crc32(A)=%x\r\n", c);
      16           1 :         EXPECT_EQ(0xd3d99e8b, c);
      17             : 
      18           1 :         const char * line = "AbcDEFGF";
      19           1 :         c = crc32(line, 8);
      20           1 :         printf("crc32(line)=%x\r\n", c);
      21           1 :         EXPECT_EQ(0x4775a7b1, c);
      22             : 
      23           1 :         c = crc32(line, 1);
      24           1 :         c = crc32inc(line + 1, c, 8 - 1);
      25           1 :         EXPECT_EQ(0x4775a7b1, c);
      26           1 : }

Generated by: LCOV version 1.14