Remove const_check

This commit is contained in:
Victor Zverovich
2026-01-29 17:29:33 -08:00
parent 99803085d4
commit 45f230b9b2
10 changed files with 54 additions and 61 deletions

View File

@@ -200,12 +200,12 @@ TEST(fp_test, dragonbox_max_k) {
using fmt::detail::dragonbox::floor_log10_pow2;
using float_info = fmt::detail::dragonbox::float_info<float>;
EXPECT_EQ(
fmt::detail::const_check(float_info::max_k),
float_info::max_k,
float_info::kappa -
floor_log10_pow2(std::numeric_limits<float>::min_exponent -
fmt::detail::num_significand_bits<float>() - 1));
using double_info = fmt::detail::dragonbox::float_info<double>;
EXPECT_EQ(fmt::detail::const_check(double_info::max_k),
EXPECT_EQ(double_info::max_k,
double_info::kappa -
floor_log10_pow2(
std::numeric_limits<double>::min_exponent -

View File

@@ -995,7 +995,7 @@ TEST(format_test, runtime_width) {
format_error, bad_dynamic_spec_msg);
EXPECT_THROW_MSG((void)fmt::format(runtime("{0:{1}}"), 0, -1l), format_error,
bad_dynamic_spec_msg);
if (fmt::detail::const_check(sizeof(long) > sizeof(int))) {
if (sizeof(long) > sizeof(int)) {
long value = INT_MAX;
EXPECT_THROW_MSG((void)fmt::format(runtime("{0:{1}}"), 0, (value + 1)),
format_error, bad_dynamic_spec_msg);
@@ -1243,7 +1243,7 @@ TEST(format_test, runtime_precision) {
format_error, bad_dynamic_spec_msg);
EXPECT_THROW_MSG((void)fmt::format(runtime("{0:.{1}}"), 0.0, -1l),
format_error, bad_dynamic_spec_msg);
if (fmt::detail::const_check(sizeof(long) > sizeof(int))) {
if (sizeof(long) > sizeof(int)) {
long value = INT_MAX;
EXPECT_THROW_MSG((void)fmt::format(runtime("{0:.{1}}"), 0.0, (value + 1)),
format_error, bad_dynamic_spec_msg);
@@ -1519,7 +1519,7 @@ TEST(format_test, format_double) {
}
#endif
if (fmt::detail::const_check(std::numeric_limits<double>::is_iec559)) {
if (std::numeric_limits<double>::is_iec559) {
double d = (std::numeric_limits<double>::min)();
EXPECT_EQ(fmt::format("{:a}", d), "0x1p-1022");
EXPECT_EQ(fmt::format("{:#a}", d), "0x1.p-1022");
@@ -2489,7 +2489,7 @@ auto format_as(const string& s) -> std::string { return s; }
TEST(format_test, adl) {
// Only check compilation and don't run the code to avoid polluting the output
// and since the output is tested elsewhere.
if (fmt::detail::const_check(true)) return;
if (true) return;
auto s = adl_test::string();
char buf[10];
(void)fmt::format("{}", s);

View File

@@ -348,11 +348,10 @@ void test_length(const char* length_spec, U value) {
unsigned long long unsigned_value = 0;
// Apply integer promotion to the argument.
unsigned long long max = max_value<U>();
using fmt::detail::const_check;
if (const_check(max <= static_cast<unsigned>(max_value<int>()))) {
if (max <= static_cast<unsigned>(max_value<int>())) {
signed_value = static_cast<int>(value);
unsigned_value = static_cast<unsigned long long>(value);
} else if (const_check(max <= max_value<unsigned>())) {
} else if (max <= max_value<unsigned>()) {
signed_value = static_cast<unsigned>(value);
unsigned_value = static_cast<unsigned long long>(value);
}

View File

@@ -159,7 +159,7 @@ TEST(xchar_test, named_arg_udl) {
TEST(xchar_test, print) {
// Check that the wide print overload compiles.
if (fmt::detail::const_check(false)) {
if (false) {
fmt::print(L"test");
fmt::println(L"test");
}