Skip to content

Commit

Permalink
Make the tests pass on a CHERI system.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidchisnall committed Jun 9, 2022
1 parent 48b7e3d commit a06eba0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/format-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1493,8 +1493,13 @@ TEST(format_test, format_pointer) {
EXPECT_EQ("0x0", fmt::format("{0}", static_cast<void*>(nullptr)));
EXPECT_EQ("0x1234", fmt::format("{0}", reinterpret_cast<void*>(0x1234)));
EXPECT_EQ("0x1234", fmt::format("{0:p}", reinterpret_cast<void*>(0x1234)));
#ifdef __CHERI_PURE_CAPABILITY__
EXPECT_EQ("0x" + std::string(sizeof(size_t) * CHAR_BIT / 4, 'f'),
fmt::format("{0}", reinterpret_cast<void*>(~uintptr_t())));
#else
EXPECT_EQ("0x" + std::string(sizeof(void*) * CHAR_BIT / 4, 'f'),
fmt::format("{0}", reinterpret_cast<void*>(~uintptr_t())));
#endif
EXPECT_EQ("0x1234",
fmt::format("{}", fmt::ptr(reinterpret_cast<int*>(0x1234))));
std::unique_ptr<int> up(new int(1));
Expand Down

0 comments on commit a06eba0

Please sign in to comment.