mirror of
https://github.com/fastfloat/fast_float.git
synced 2025-12-07 01:06:48 +08:00
# test fixed.
This commit is contained in:
parent
b8163709f5
commit
597c239218
@ -466,7 +466,7 @@ int main() {
|
||||
auto const &f = invalid_base_test_1[i];
|
||||
int result;
|
||||
auto answer =
|
||||
fast_float::from_chars(f.data(), f.data() + f.size(), result, -1);
|
||||
fast_float::from_chars(f.data(), f.data() + f.size(), result, 1);
|
||||
if (answer.ec != std::errc::invalid_argument) {
|
||||
std::cerr << "expected error should be 'invalid_argument' for: \"" << f
|
||||
<< "\"" << std::endl;
|
||||
@ -567,7 +567,7 @@ int main() {
|
||||
auto const &f = int_out_of_range_base_test[i];
|
||||
int64_t result;
|
||||
auto answer = fast_float::from_chars(f.data(), f.data() + f.size(), result,
|
||||
int(2 + (i / 2)));
|
||||
uint_fast8_t(2 + (i / 2)));
|
||||
if (answer.ec != std::errc::result_out_of_range) {
|
||||
std::cerr << "expected error for should be 'result_out_of_range': \"" << f
|
||||
<< "\"" << std::endl;
|
||||
@ -612,7 +612,7 @@ int main() {
|
||||
"7ORP63SH4DPHI",
|
||||
"5G24A25TWKWFG",
|
||||
"3W5E11264SGSG"};
|
||||
int base_unsigned = 2;
|
||||
uint_fast8_t base_unsigned = 2;
|
||||
for (std::size_t i = 0; i < unsigned_out_of_range_base_test.size(); ++i) {
|
||||
auto const &f = unsigned_out_of_range_base_test[i];
|
||||
uint64_t result;
|
||||
@ -703,7 +703,7 @@ int main() {
|
||||
auto const &f = int_within_range_base_test[i];
|
||||
int64_t result;
|
||||
auto answer = fast_float::from_chars(f.data(), f.data() + f.size(), result,
|
||||
int(2 + (i / 2)));
|
||||
uint_fast8_t(2 + (i / 2)));
|
||||
if (answer.ec != std::errc()) {
|
||||
std::cerr << "converting " << f
|
||||
<< " to int failed (most likely out of range)" << std::endl;
|
||||
@ -748,7 +748,7 @@ int main() {
|
||||
"7ORP63SH4DPHH",
|
||||
"5G24A25TWKWFF",
|
||||
"3W5E11264SGSF"};
|
||||
int base_unsigned2 = 2;
|
||||
uint_fast8_t base_unsigned2 = 2;
|
||||
for (std::size_t i = 0; i < unsigned_within_range_base_test.size(); ++i) {
|
||||
auto const &f = unsigned_within_range_base_test[i];
|
||||
uint64_t result;
|
||||
@ -806,7 +806,7 @@ int main() {
|
||||
auto const &f = int_leading_zeros_test[i];
|
||||
int result;
|
||||
auto answer = fast_float::from_chars(f.data(), f.data() + f.size(), result,
|
||||
int(i + 2));
|
||||
uint_fast8_t(i + 2));
|
||||
if (answer.ec != std::errc()) {
|
||||
std::cerr << "could not convert to int for input: \"" << f << "\""
|
||||
<< std::endl;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user