Skip to content

Commit

Permalink
Added workaround for Catch2 uint8_t limitation
Browse files Browse the repository at this point in the history
Linked bug report: catchorg/Catch2#2433
  • Loading branch information
saxbophone committed May 22, 2022
1 parent a30ba20 commit 0ffb30e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/casting.cpp
Expand Up @@ -73,10 +73,18 @@ TEST_CASE("arby::Uint::from_float() with positive value") {
CHECK((long double)object == Approx(std::trunc(value)));
}

TEST_CASE("arby::Uint can be constructed from unsigned types smaller than uintmax_t - uint8_t",) {
std::uint8_t input = GENERATE(take(1000, random((std::uint16_t)0x00, (std::uint16_t)0xFF)));

arby::Uint object = input;

CHECK((uintmax_t)object == input);
}

TEMPLATE_TEST_CASE(
"arby::Uint can be constructed from unsigned types smaller than uintmax_t",
"",
std::uint8_t, std::uint16_t, std::uint32_t, std::uint64_t
std::uint16_t, std::uint32_t, std::uint64_t
) {
TestType input = GENERATE(take(1000, random((TestType)0, std::numeric_limits<TestType>::max())));

Expand Down

0 comments on commit 0ffb30e

Please sign in to comment.