Skip to content

Commit

Permalink
Add constexpr test
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
  • Loading branch information
phprus committed May 23, 2023
1 parent a8de699 commit 7d3092e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/format-impl-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,22 @@ TEST(format_impl_test, to_utf8) {
EXPECT_EQ(s.size(), u.size());
}

FMT_CONSTEXPR20 bool constexpr_iceil() {
for (double v : std::initializer_list<double>{
((std::numeric_limits<int>::min)() + 0.5),
-1.2,
-0.2,
0.0,
0.2,
1.2,
4.0,
((std::numeric_limits<int>::max)() - 0.5),
}) {
auto r = fmt::detail::iceil<int>(v);
fmt::detail::ignore_unused(r);
}
return true;
}
TEST(format_impl_test, iceil) {
for (double v : std::initializer_list<double>{
((std::numeric_limits<int>::min)() + 0.5),
Expand All @@ -537,4 +553,7 @@ TEST(format_impl_test, iceil) {
}) {
EXPECT_EQ(fmt::detail::iceil<int>(v), static_cast<int>(std::ceil(v)));
}

FMT_CONSTEXPR20 auto result = constexpr_iceil();
EXPECT_TRUE(result);
}

0 comments on commit 7d3092e

Please sign in to comment.