Skip to content

Commit 8aed609

Browse files
committed
lint
1 parent d377c92 commit 8aed609

File tree

1 file changed

+41
-25
lines changed

1 file changed

+41
-25
lines changed

tests/basictest.cpp

Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2106,15 +2106,21 @@ void integer_multiplication_by_power_of_10_test(Int mantissa,
21062106
}
21072107

21082108
template <typename Int>
2109-
void verify_integer_multiplication_by_power_of_10(Int mantissa, int32_t decimal_exponent) {
2110-
std::string constructed_string = std::to_string(mantissa) + "e" + std::to_string(decimal_exponent);
2111-
double expected_result;
2112-
auto result = fast_float::from_chars(constructed_string.data(), constructed_string.data() + constructed_string.size(), expected_result);
2113-
if(result.ec != std::errc()) {
2114-
INFO("Failed to parse: " << constructed_string);
2115-
}
2116-
std::cout << "Testing: " << constructed_string << " -> " << fHexAndDec(expected_result) << "\n";
2117-
integer_multiplication_by_power_of_10_test(mantissa, decimal_exponent, expected_result);
2109+
void verify_integer_multiplication_by_power_of_10(Int mantissa,
2110+
int32_t decimal_exponent) {
2111+
std::string constructed_string =
2112+
std::to_string(mantissa) + "e" + std::to_string(decimal_exponent);
2113+
double expected_result;
2114+
auto result = fast_float::from_chars(
2115+
constructed_string.data(),
2116+
constructed_string.data() + constructed_string.size(), expected_result);
2117+
if (result.ec != std::errc()) {
2118+
INFO("Failed to parse: " << constructed_string);
2119+
}
2120+
std::cout << "Testing: " << constructed_string << " -> "
2121+
<< fHexAndDec(expected_result) << "\n";
2122+
integer_multiplication_by_power_of_10_test(mantissa, decimal_exponent,
2123+
expected_result);
21182124
}
21192125

21202126
TEST_CASE("multiply_integer_and_power_of_10") {
@@ -2158,18 +2164,20 @@ TEST_CASE("multiply_integer_and_power_of_10") {
21582164
verify_integer_multiplication_by_power_of_10(1, -1);
21592165
verify_integer_multiplication_by_power_of_10(-1, -1);
21602166

2161-
integer_multiplication_by_power_of_10_test<uint64_t>(49406564584124654, -340,
2162-
DBL_TRUE_MIN);
2163-
integer_multiplication_by_power_of_10_test<uint64_t>(22250738585072014, -324,
2164-
DBL_MIN);
2165-
integer_multiplication_by_power_of_10_test<uint64_t>(17976931348623158, 292, DBL_MAX);
2167+
integer_multiplication_by_power_of_10_test<uint64_t>(49406564584124654,
2168+
-340, DBL_TRUE_MIN);
2169+
integer_multiplication_by_power_of_10_test<uint64_t>(22250738585072014,
2170+
-324, DBL_MIN);
2171+
integer_multiplication_by_power_of_10_test<uint64_t>(17976931348623158, 292,
2172+
DBL_MAX);
21662173

21672174
// DBL_TRUE_MIN / 2 underflows to 0
2168-
integer_multiplication_by_power_of_10_test<uint64_t>(49406564584124654 / 2, -340, 0.);
2175+
integer_multiplication_by_power_of_10_test<uint64_t>(49406564584124654 / 2,
2176+
-340, 0.);
21692177

21702178
// DBL_TRUE_MIN / 2 + 0.0000000000000001e-324 rounds to DBL_TRUE_MIN
2171-
integer_multiplication_by_power_of_10_test<uint64_t>(49406564584124654 / 2 + 1, -340,
2172-
DBL_TRUE_MIN);
2179+
integer_multiplication_by_power_of_10_test<uint64_t>(
2180+
49406564584124654 / 2 + 1, -340, DBL_TRUE_MIN);
21732181

21742182
// DBL_MAX + 0.0000000000000001e308 overflows to infinity
21752183
integer_multiplication_by_power_of_10_test<uint64_t>(
@@ -2192,14 +2200,22 @@ TEST_CASE("multiply_integer_and_power_of_10") {
21922200
verify_integer_multiplication_by_power_of_10<uint64_t>(1234567890123, 42);
21932201
verify_integer_multiplication_by_power_of_10<uint64_t>(12345678901234, 42);
21942202
verify_integer_multiplication_by_power_of_10<uint64_t>(123456789012345, 42);
2195-
verify_integer_multiplication_by_power_of_10<uint64_t>(1234567890123456, 42);
2196-
verify_integer_multiplication_by_power_of_10<uint64_t>(12345678901234567, 42);
2197-
verify_integer_multiplication_by_power_of_10<uint64_t>(123456789012345678, 42);
2198-
verify_integer_multiplication_by_power_of_10<uint64_t>(1234567890123456789, 42);
2199-
verify_integer_multiplication_by_power_of_10<uint64_t>(12345678901234567890ULL, 42);
2203+
verify_integer_multiplication_by_power_of_10<uint64_t>(1234567890123456,
2204+
42);
2205+
verify_integer_multiplication_by_power_of_10<uint64_t>(12345678901234567,
2206+
42);
2207+
verify_integer_multiplication_by_power_of_10<uint64_t>(123456789012345678,
2208+
42);
2209+
verify_integer_multiplication_by_power_of_10<uint64_t>(1234567890123456789,
2210+
42);
2211+
verify_integer_multiplication_by_power_of_10<uint64_t>(
2212+
12345678901234567890ULL, 42);
22002213
// ULLONG_MAX
2201-
verify_integer_multiplication_by_power_of_10<uint64_t>(18446744073709551615ULL, 42);
2202-
verify_integer_multiplication_by_power_of_10<int64_t>(std::numeric_limits<int64_t>::max(), 42);
2203-
verify_integer_multiplication_by_power_of_10<int64_t>(std::numeric_limits<int64_t>::min(), 42);
2214+
verify_integer_multiplication_by_power_of_10<uint64_t>(
2215+
18446744073709551615ULL, 42);
2216+
verify_integer_multiplication_by_power_of_10<int64_t>(
2217+
std::numeric_limits<int64_t>::max(), 42);
2218+
verify_integer_multiplication_by_power_of_10<int64_t>(
2219+
std::numeric_limits<int64_t>::min(), 42);
22042220
}
22052221
}

0 commit comments

Comments
 (0)