chromium/third_party/fast_float/src/tests/fast_int.cpp

#ifndef __cplusplus
#error fastfloat requires a C++ compiler
#endif

// We want to enable the tests only for C++17 and above.
#ifndef FASTFLOAT_CPLUSPLUS
#if defined(_MSVC_LANG) && !defined(__clang__)
#define FASTFLOAT_CPLUSPLUS
#else
#define FASTFLOAT_CPLUSPLUS
#endif
#endif

#if FASTFLOAT_CPLUSPLUS >= 201703L

#include <cstdlib>
#include <iostream>
#include <vector>
#include <string_view>
#include <cstring>
#include "fast_float/fast_float.h"
#include <cstdint>

/*
all tests conducted are to check fast_float::from_chars functionality with int
and unsigned test cases include: int basic tests - numbers only, numbers with
strings behind, decimals, negative numbers unsigned basic tests - numbers only,
numbers with strings behind, decimals int invalid tests - strings only, strings
with numbers behind, space in front of number, plus sign in front of number
unsigned invalid tests - strings only, strings with numbers behind, space in
front of number, plus/minus sign in front of number int out of range tests -
numbers exceeding int bit size for 8, 16, 32, and 64 bits unsigned out of range
tests - numbers exceeding unsigned bit size 8, 16, 32, and 64 bits int pointer
tests - points to first character that is not recognized as int unsigned pointer
tests - points to first character that is not recognized as unsigned
int/unsigned base 2 tests - numbers are converted from binary to decimal
octal tests - numbers are converted from octal to decimal
hex tests - numbers are converted from hex to decimal (Note: 0x and 0X are
considered invalid) invalid base tests - any base not within 2-36 is invalid out
of range base tests - numbers exceeding int/unsigned bit size after converted
from base (Note: only 64 bit int and unsigned are tested) within range base
tests - max/min numbers are still within int/unsigned bit size after converted
from base (Note: only 64 bit int and unsigned are tested) leading zeros tests -
ignores all zeroes in front of valid number after converted from base
*/

int main() {}
#else
#include <iostream>
#include <cstdlib>

int main() {
  std::cerr << "The test requires C++17." << std::endl;
  return EXIT_SUCCESS;
}
#endif