Skip to content

Commit

Permalink
test: operator modules assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
drewr95 committed Mar 13, 2024
1 parent 8316556 commit b6ac7f0
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion test/test_type_def.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ namespace
CHECK_EQUAL(i<<=2, uint32_t(t));
}

//*************************************************************************
//*************************************************************************
TEST(test_operator_right_shift_assignment_constexpr)
{
class __type_t__;
Expand All @@ -388,6 +388,23 @@ namespace
CHECK_EQUAL(i>>=2, uint32_t(t));
}

//*************************************************************************
TEST(test_operator_modulus_assignment_constexpr)
{
class __type_t__;
typedef etl::type_def<__type_t__, uint32_t> type_t;

constexpr auto modulus_assignment = []() {
type_t t(0x5A3DUL);
return t %= 2;
};

uint32_t i = 0x5A3DUL;
constexpr type_t t = modulus_assignment();

CHECK_EQUAL(i%=2, uint32_t(t));
}

//*************************************************************************
TEST(test_comparisons)
{
Expand Down

0 comments on commit b6ac7f0

Please sign in to comment.