Skip to content

Commit

Permalink
Partial updates to bit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
John Wellbelove committed Aug 6, 2024
1 parent f7c7952 commit 29b719f
Showing 1 changed file with 52 additions and 6 deletions.
58 changes: 52 additions & 6 deletions test/test_bit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,59 @@ namespace
CHECK_EQUAL(0xDBU, int(value));
}

#if !defined(ETL_FORCE_NO_ADVANCED_CPP)
#if ETL_USING_CPP14 && !defined(ETL_FORCE_NO_ADVANCED_CPP)
//*************************************************************************
TEST(test_rotl_8_constexpr)
{
char temp[etl::rotl(uint8_t(0xAAU), 1)];
constexpr uint8_t value0 = etl::rotl(uint8_t(0x00U), 1);
CHECK_EQUAL(0x00U, int(value0));

constexpr uint8_t value1 = etl::rotl(uint8_t(0x21U), 1);
CHECK_EQUAL(0x42U, int(value1));

constexpr uint8_t value2 = etl::rotl(uint8_t(0x42U), 1);
CHECK_EQUAL(0x84U, int(value2));

constexpr uint8_t value3 = etl::rotl(uint8_t(0x84U), 1);
CHECK_EQUAL(0x09U, int(value3));

constexpr uint8_t value4 = etl::rotl(uint8_t(0x84U), 1);
CHECK_EQUAL(0x09U, int(value4));

constexpr uint8_t value5 = etl::rotl(uint8_t(0xB7U), 2);
CHECK_EQUAL(0xDEU, int(value5));

//value = 0xB7U;
//value = etl::rotl(value, 3);
//CHECK_EQUAL(0xBDU, int(value));

CHECK_EQUAL(etl::rotl(uint8_t(0xAAU), 1), sizeof(temp));
//value = 0xB7U;
//value = etl::rotl(value, 4);
//CHECK_EQUAL(0x7BU, int(value));

//value = 0xB7U;
//value = etl::rotl(value, 5);
//CHECK_EQUAL(0xF6U, int(value));

//value = 0xB7U;
//value = etl::rotl(value, 6);
//CHECK_EQUAL(0xEDU, int(value));

//value = 0xB7U;
//value = etl::rotl(value, 7);
//CHECK_EQUAL(0xDBU, int(value));

//value = 0xB7U;
//value = etl::rotl(value, 8);
//CHECK_EQUAL(0xB7U, int(value));

//value = 0xB7U;
//value = etl::rotl(value, 9);
//CHECK_EQUAL(0x6FU, int(value));

//value = 0xB7U;
//value = etl::rotl(value, -1);
//CHECK_EQUAL(0xDBU, int(value));
}
#endif

Expand Down Expand Up @@ -902,9 +948,9 @@ namespace
//*************************************************************************
TEST(test_countr_one_8_constexpr)
{
char temp[etl::countr_one(uint8_t(0x0F))];
constexpr size_t count = etl::countr_one(uint8_t(0x0F));

CHECK_EQUAL(test_trailing_ones(uint8_t(0x0F)), sizeof(temp));
CHECK_EQUAL(test_trailing_ones(uint8_t(0x0F)), count);
}
#endif

Expand Down Expand Up @@ -954,7 +1000,7 @@ namespace
}
}

#if !defined(ETL_FORCE_NO_ADVANCED_CPP)
#if ETL_USING_CPP14 && !defined(ETL_FORCE_NO_ADVANCED_CPP)
//*************************************************************************
TEST(test_countr_one_32_constexpr)
{
Expand Down

0 comments on commit 29b719f

Please sign in to comment.