Skip to content

Commit 2423180

Browse files
committed
cleanup
1 parent f92d7fb commit 2423180

File tree

3 files changed

+14
-16
lines changed

3 files changed

+14
-16
lines changed

tests/fast_int.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ int main() {
661661
auto const &f = invalid_base_test_1[i];
662662
int result;
663663
auto answer =
664-
fast_float::from_chars(f.data(), f.data() + f.size(), result, 1);
664+
fast_float::from_chars(f.data(), f.data() + f.size(), result, -1);
665665
if (answer.ec != std::errc::invalid_argument) {
666666
std::cerr << "expected error should be 'invalid_argument' for: \"" << f
667667
<< "\"" << std::endl;
@@ -762,7 +762,7 @@ int main() {
762762
auto const &f = int_out_of_range_base_test[i];
763763
int64_t result;
764764
auto answer = fast_float::from_chars(f.data(), f.data() + f.size(), result,
765-
uint_fast8_t(2 + (i / 2)));
765+
int(2 + (i / 2)));
766766
if (answer.ec != std::errc::result_out_of_range) {
767767
std::cerr << "expected error for should be 'result_out_of_range': \"" << f
768768
<< "\"" << std::endl;
@@ -807,7 +807,7 @@ int main() {
807807
"7ORP63SH4DPHI",
808808
"5G24A25TWKWFG",
809809
"3W5E11264SGSG"};
810-
uint_fast8_t base_unsigned = 2;
810+
int base_unsigned = 2;
811811
for (std::size_t i = 0; i < unsigned_out_of_range_base_test.size(); ++i) {
812812
auto const &f = unsigned_out_of_range_base_test[i];
813813
uint64_t result;
@@ -898,7 +898,7 @@ int main() {
898898
auto const &f = int_within_range_base_test[i];
899899
int64_t result;
900900
auto answer = fast_float::from_chars(f.data(), f.data() + f.size(), result,
901-
uint_fast8_t(2 + (i / 2)));
901+
int(2 + (i / 2)));
902902
if (answer.ec != std::errc()) {
903903
std::cerr << "converting " << f
904904
<< " to int failed (most likely out of range)" << std::endl;
@@ -943,7 +943,7 @@ int main() {
943943
"7ORP63SH4DPHH",
944944
"5G24A25TWKWFF",
945945
"3W5E11264SGSF"};
946-
uint_fast8_t base_unsigned2 = 2;
946+
int base_unsigned2 = 2;
947947
for (std::size_t i = 0; i < unsigned_within_range_base_test.size(); ++i) {
948948
auto const &f = unsigned_within_range_base_test[i];
949949
uint64_t result;
@@ -1001,7 +1001,7 @@ int main() {
10011001
auto const &f = int_leading_zeros_test[i];
10021002
int result;
10031003
auto answer = fast_float::from_chars(f.data(), f.data() + f.size(), result,
1004-
uint_fast8_t(i + 2));
1004+
int(i + 2));
10051005
if (answer.ec != std::errc()) {
10061006
std::cerr << "could not convert to int for input: \"" << f << "\""
10071007
<< std::endl;

tests/fortran.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ int main() {
3131
"1d-1", "1d-2", "1d-3", "1d-4"};
3232
std::vector<std::string> const fmt3{"+1+4", "+1+3", "+1+2", "+1+1", "+1+0",
3333
"+1-1", "+1-2", "+1-3", "+1-4"};
34-
3534
fast_float::parse_options const options{
3635
fast_float::chars_format::fortran |
3736
fast_float::chars_format::allow_leading_plus};

tests/json_fmt.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ int main_readme() {
1010
fast_float::parse_options options{
1111
fast_float::chars_format::json |
1212
fast_float::chars_format::allow_leading_plus}; // should be ignored
13-
auto const answer = fast_float::from_chars_advanced(
13+
auto answer = fast_float::from_chars_advanced(
1414
input.data(), input.data() + input.size(), result, options);
1515
if (answer.ec == std::errc()) {
1616
std::cerr << "should have failed\n";
@@ -25,7 +25,7 @@ int main_readme2() {
2525
fast_float::parse_options options{
2626
fast_float::chars_format::json |
2727
fast_float::chars_format::allow_leading_plus}; // should be ignored
28-
auto const answer = fast_float::from_chars_advanced(
28+
auto answer = fast_float::from_chars_advanced(
2929
input.data(), input.data() + input.size(), result, options);
3030
if (answer.ec == std::errc()) {
3131
std::cerr << "should have failed\n";
@@ -41,7 +41,7 @@ int main_readme3() {
4141
fast_float::parse_options options{
4242
fast_float::chars_format::json_or_infnan |
4343
fast_float::chars_format::allow_leading_plus}; // should be ignored
44-
auto const answer = fast_float::from_chars_advanced(
44+
auto answer = fast_float::from_chars_advanced(
4545
input.data(), input.data() + input.size(), result, options);
4646
if (answer.ec != std::errc() || (!std::isinf(result))) {
4747
std::cerr << "should have parsed infinity\n";
@@ -97,7 +97,7 @@ int main() {
9797
auto const &s = accept[i].input;
9898
auto const &expected = accept[i].expected;
9999
double result;
100-
auto const answer =
100+
auto answer =
101101
fast_float::from_chars(s.data(), s.data() + s.size(), result,
102102
fast_float::chars_format::json_or_infnan);
103103
if (answer.ec != std::errc()) {
@@ -120,8 +120,8 @@ int main() {
120120
for (std::size_t i = 0; i < reject.size(); ++i) {
121121
auto const &s = reject[i].input;
122122
double result;
123-
auto const answer = fast_float::from_chars(
124-
s.data(), s.data() + s.size(), result, fast_float::chars_format::json);
123+
auto answer = fast_float::from_chars(s.data(), s.data() + s.size(), result,
124+
fast_float::chars_format::json);
125125
if (answer.ec == std::errc()) {
126126
std::cerr << "json fmt accepted invalid json " << s << std::endl;
127127
return EXIT_FAILURE;
@@ -131,12 +131,11 @@ int main() {
131131
for (std::size_t i = 0; i < reject.size(); ++i) {
132132
auto const &f = reject[i].input;
133133
auto const &expected_reason = reject[i].reason;
134-
auto const answer = fast_float::parse_number_string<true>(
134+
auto answer = fast_float::parse_number_string<true>(
135135
f.data(), f.data() + f.size(),
136136
fast_float::parse_options(
137137
fast_float::chars_format::json |
138-
fast_float::chars_format::allow_leading_plus)); // should be
139-
// ignored
138+
fast_float::chars_format::allow_leading_plus)); // should be ignored
140139
if (!answer.invalid) {
141140
std::cerr << "json parse accepted invalid json " << f << std::endl;
142141
return EXIT_FAILURE;

0 commit comments

Comments
 (0)