diff --git a/include/etl/crc1.h b/include/etl/crc1.h index 2eaf923e..305f894e 100644 --- a/include/etl/crc1.h +++ b/include/etl/crc1.h @@ -47,14 +47,14 @@ namespace etl enum { - Odd_Parity = 1, - Even_Parity = 0 + odd_parity = 1, + even_parity = 0 }; //********************************* value_type initial() const { - return Even_Parity; + return even_parity; } //********************************* @@ -76,8 +76,8 @@ namespace etl enum { - Odd_Parity = crc1_policy::Odd_Parity, - Even_Parity = crc1_policy::Even_Parity + odd_parity = crc1_policy::odd_parity, + even_parity = crc1_policy::even_parity }; //************************************************************************* diff --git a/test/test_crc1.cpp b/test/test_crc1.cpp index 3b87c904..fe62b17e 100644 --- a/test/test_crc1.cpp +++ b/test/test_crc1.cpp @@ -37,6 +37,8 @@ SOFTWARE. namespace { + //*************************************************************************** + // Calculate parity the simple way. //*************************************************************************** template int calculate_parity(TIterator b, TIterator e) @@ -49,7 +51,7 @@ namespace ++b; } - return ((count &= 1) == 0) ? etl::crc1::Even_Parity : etl::crc1::Odd_Parity; + return ((count &= 1) == 0) ? etl::crc1::even_parity : etl::crc1::odd_parity; } SUITE(test_crc1) @@ -123,6 +125,16 @@ namespace uint8_t crc3 = etl::crc1(data3.rbegin(), data3.rend()); CHECK_EQUAL(int(crc1), int(crc3)); } + + //************************************************************************* + TEST(test_crc1_constants) + { + std::vector data_odd{ etl::b00000001, etl::b00000111, etl::b01010001, etl::b10000100 }; + std::vector data_even{ etl::b00000001, etl::b01000111, etl::b01010001, etl::b10000100 }; + + CHECK_EQUAL(etl::crc1::odd_parity, etl::crc1(data_odd.begin(), data_odd.end())); + CHECK_EQUAL(etl::crc1::even_parity, etl::crc1(data_even.begin(), data_even.end())); + } }; }