Skip to content

Commit

Permalink
Fix details::Boolean compatibility checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
1uc committed Nov 28, 2023
1 parent 94c3841 commit b88a51b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tests/unit/tests_high_five_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2945,9 +2945,16 @@ TEST_CASE("HighFiveReadType") {
TEST_CASE("DirectWriteBool") {
SECTION("Basic compatibility") {
using IntType = typename std::underlying_type<details::Boolean>::type;

details::Boolean true_value = details::Boolean::HighFiveTrue;
IntType const* const true_ptr = static_cast<IntType const* const>((void*) &true_value);

details::Boolean false_value = details::Boolean::HighFiveFalse;
IntType const* const false_ptr = static_cast<IntType const* const>((void*) &false_value);

CHECK(sizeof(bool) == sizeof(details::Boolean));
CHECK(true == static_cast<IntType>(details::Boolean::HighFiveTrue));
CHECK(false == static_cast<IntType>(details::Boolean::HighFiveFalse));
CHECK(*true_ptr == static_cast<IntType>(details::Boolean::HighFiveTrue));
CHECK(*false_ptr == static_cast<IntType>(details::Boolean::HighFiveFalse));
}

auto file = File("rw_bool_from_ptr.h5", File::Truncate);
Expand Down

0 comments on commit b88a51b

Please sign in to comment.