mirror of
https://github.com/fastfloat/fast_float.git
synced 2025-12-06 16:56:57 +08:00
Merge pull request #107 from mumbleskates/main
Testing changes and fixes
This commit is contained in:
commit
dd04b5ebd7
@ -56,17 +56,18 @@ endfunction(fast_float_add_cpp_test)
|
|||||||
fast_float_add_cpp_test(example_test)
|
fast_float_add_cpp_test(example_test)
|
||||||
fast_float_add_cpp_test(example_comma_test)
|
fast_float_add_cpp_test(example_comma_test)
|
||||||
fast_float_add_cpp_test(basictest)
|
fast_float_add_cpp_test(basictest)
|
||||||
|
fast_float_add_cpp_test(long_test)
|
||||||
|
fast_float_add_cpp_test(powersoffive_hardround)
|
||||||
|
fast_float_add_cpp_test(string_test)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
option(FASTFLOAT_EXHAUSTIVE "Exhaustive tests" OFF)
|
option(FASTFLOAT_EXHAUSTIVE "Exhaustive tests" OFF)
|
||||||
|
|
||||||
if (FASTFLOAT_EXHAUSTIVE)
|
if (FASTFLOAT_EXHAUSTIVE)
|
||||||
fast_float_add_cpp_test(powersoffive_hardround)
|
|
||||||
fast_float_add_cpp_test(short_random_string)
|
fast_float_add_cpp_test(short_random_string)
|
||||||
fast_float_add_cpp_test(exhaustive32_midpoint)
|
fast_float_add_cpp_test(exhaustive32_midpoint)
|
||||||
fast_float_add_cpp_test(random_string)
|
fast_float_add_cpp_test(random_string)
|
||||||
fast_float_add_cpp_test(string_test)
|
|
||||||
fast_float_add_cpp_test(exhaustive32)
|
fast_float_add_cpp_test(exhaustive32)
|
||||||
fast_float_add_cpp_test(exhaustive32_64)
|
fast_float_add_cpp_test(exhaustive32_64)
|
||||||
fast_float_add_cpp_test(long_exhaustive32)
|
fast_float_add_cpp_test(long_exhaustive32)
|
||||||
|
|||||||
@ -3,8 +3,13 @@
|
|||||||
#include <doctest/doctest.h>
|
#include <doctest/doctest.h>
|
||||||
|
|
||||||
#include "fast_float/fast_float.h"
|
#include "fast_float/fast_float.h"
|
||||||
|
#include <cmath>
|
||||||
|
#include <cstdio>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
#include <ios>
|
||||||
|
#include <limits>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <system_error>
|
||||||
|
|
||||||
#ifndef SUPPLEMENTAL_TEST_DATA_DIR
|
#ifndef SUPPLEMENTAL_TEST_DATA_DIR
|
||||||
#define SUPPLEMENTAL_TEST_DATA_DIR "data/"
|
#define SUPPLEMENTAL_TEST_DATA_DIR "data/"
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
|
|
||||||
#include "fast_float/fast_float.h"
|
#include "fast_float/fast_float.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
#include <system_error>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
const std::string input = "3,1416 xyz ";
|
const std::string input = "3,1416 xyz ";
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
|
|
||||||
#include "fast_float/fast_float.h"
|
#include "fast_float/fast_float.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
#include <system_error>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
const std::string input = "3.1416 xyz ";
|
const std::string input = "3.1416 xyz ";
|
||||||
|
|||||||
@ -1,9 +1,13 @@
|
|||||||
|
|
||||||
#include "fast_float/fast_float.h"
|
#include "fast_float/fast_float.h"
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <ios>
|
||||||
|
#include <iostream>
|
||||||
|
#include <limits>
|
||||||
|
#include <system_error>
|
||||||
|
|
||||||
template <typename T> char *to_string(T d, char *buffer) {
|
template <typename T> char *to_string(T d, char *buffer) {
|
||||||
auto written = std::snprintf(buffer, 64, "%.*e",
|
auto written = std::snprintf(buffer, 64, "%.*e",
|
||||||
|
|||||||
@ -1,9 +1,14 @@
|
|||||||
|
|
||||||
#include "fast_float/fast_float.h"
|
#include "fast_float/fast_float.h"
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <ios>
|
||||||
|
#include <iostream>
|
||||||
|
#include <limits>
|
||||||
|
#include <string>
|
||||||
|
#include <system_error>
|
||||||
|
|
||||||
template <typename T> char *to_string(T d, char *buffer) {
|
template <typename T> char *to_string(T d, char *buffer) {
|
||||||
auto written = std::snprintf(buffer, 64, "%.*e",
|
auto written = std::snprintf(buffer, 64, "%.*e",
|
||||||
|
|||||||
@ -1,8 +1,12 @@
|
|||||||
#include "fast_float/fast_float.h"
|
#include "fast_float/fast_float.h"
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <ios>
|
||||||
|
#include <iostream>
|
||||||
|
#include <limits>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__)
|
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__)
|
||||||
// Anything at all that is related to cygwin, msys and so forth will
|
// Anything at all that is related to cygwin, msys and so forth will
|
||||||
|
|||||||
@ -1,9 +1,12 @@
|
|||||||
|
|
||||||
#include "fast_float/fast_float.h"
|
#include "fast_float/fast_float.h"
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <ios>
|
||||||
|
#include <iostream>
|
||||||
|
#include <system_error>
|
||||||
|
|
||||||
template <typename T> char *to_string(T d, char *buffer) {
|
template <typename T> char *to_string(T d, char *buffer) {
|
||||||
auto written = std::snprintf(buffer, 128, "%.*e",
|
auto written = std::snprintf(buffer, 128, "%.*e",
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
#include "fast_float/fast_float.h"
|
#include "fast_float/fast_float.h"
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <ios>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
template <typename T> char *to_string(T d, char *buffer) {
|
template <typename T> char *to_string(T d, char *buffer) {
|
||||||
auto written = std::snprintf(buffer, 128, "%.*e",
|
auto written = std::snprintf(buffer, 128, "%.*e",
|
||||||
|
|||||||
@ -1,8 +1,11 @@
|
|||||||
#include "fast_float/fast_float.h"
|
#include "fast_float/fast_float.h"
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <ios>
|
||||||
|
#include <iostream>
|
||||||
|
#include <system_error>
|
||||||
|
|
||||||
template <typename T> char *to_string(T d, char *buffer) {
|
template <typename T> char *to_string(T d, char *buffer) {
|
||||||
auto written = std::snprintf(buffer, 128, "%.*e",
|
auto written = std::snprintf(buffer, 128, "%.*e",
|
||||||
|
|||||||
@ -1,5 +1,10 @@
|
|||||||
#include "fast_float/fast_float.h"
|
#include "fast_float/fast_float.h"
|
||||||
|
|
||||||
|
#include <cctype>
|
||||||
|
#include <iostream>
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
#include <system_error>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
inline void Assert(bool Assertion) {
|
inline void Assert(bool Assertion) {
|
||||||
@ -14,6 +19,7 @@ bool test() {
|
|||||||
const char * end = input.data() + input.size();
|
const char * end = input.data() + input.size();
|
||||||
for(size_t i = 0; i < answers.size(); i++) {
|
for(size_t i = 0; i < answers.size(); i++) {
|
||||||
T result_value;
|
T result_value;
|
||||||
|
while((begin < end) && (std::isspace(*begin))) { begin++; }
|
||||||
auto result = fast_float::from_chars(begin, end,
|
auto result = fast_float::from_chars(begin, end,
|
||||||
result_value);
|
result_value);
|
||||||
if (result.ec != std::errc()) {
|
if (result.ec != std::errc()) {
|
||||||
|
|||||||
@ -1,8 +1,12 @@
|
|||||||
#include "fast_float/fast_float.h"
|
#include "fast_float/fast_float.h"
|
||||||
|
|
||||||
|
#include <ios>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <random>
|
#include <random>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
#include <system_error>
|
||||||
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
@ -11,7 +15,6 @@
|
|||||||
// always use this fallback because we cannot rely on it behaving as normal
|
// always use this fallback because we cannot rely on it behaving as normal
|
||||||
// gcc.
|
// gcc.
|
||||||
#include <locale>
|
#include <locale>
|
||||||
#include <sstream>
|
|
||||||
// workaround for CYGWIN
|
// workaround for CYGWIN
|
||||||
double cygwin_strtod_l(const char* start, char** end) {
|
double cygwin_strtod_l(const char* start, char** end) {
|
||||||
double d;
|
double d;
|
||||||
|
|||||||
@ -1,8 +1,12 @@
|
|||||||
#include "fast_float/fast_float.h"
|
#include "fast_float/fast_float.h"
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <ios>
|
||||||
|
#include <iostream>
|
||||||
|
#include <limits>
|
||||||
|
#include <system_error>
|
||||||
|
|
||||||
template <typename T> char *to_string(T d, char *buffer) {
|
template <typename T> char *to_string(T d, char *buffer) {
|
||||||
auto written = std::snprintf(buffer, 64, "%.*e",
|
auto written = std::snprintf(buffer, 64, "%.*e",
|
||||||
|
|||||||
@ -1,8 +1,11 @@
|
|||||||
#include "fast_float/fast_float.h"
|
#include "fast_float/fast_float.h"
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <ios>
|
||||||
|
#include <iostream>
|
||||||
#include <random>
|
#include <random>
|
||||||
|
#include <system_error>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) || defined(sun) || defined(__sun)
|
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) || defined(sun) || defined(__sun)
|
||||||
// Anything at all that is related to cygwin, msys and so forth will
|
// Anything at all that is related to cygwin, msys and so forth will
|
||||||
|
|||||||
@ -1,7 +1,11 @@
|
|||||||
#include "fast_float/fast_float.h"
|
#include "fast_float/fast_float.h"
|
||||||
#include <iostream>
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <ios>
|
||||||
|
#include <iostream>
|
||||||
#include <random>
|
#include <random>
|
||||||
|
#include <system_error>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) || defined(sun) || defined(__sun)
|
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) || defined(sun) || defined(__sun)
|
||||||
// Anything at all that is related to cygwin, msys and so forth will
|
// Anything at all that is related to cygwin, msys and so forth will
|
||||||
|
|||||||
@ -1,5 +1,12 @@
|
|||||||
#include "fast_float/fast_float.h"
|
#include "fast_float/fast_float.h"
|
||||||
|
|
||||||
|
#include <cctype>
|
||||||
|
#include <cstdio>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <limits>
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
#include <system_error>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) || defined(sun) || defined(__sun)
|
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) || defined(sun) || defined(__sun)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user