Skip to content

Commit

Permalink
Migrate all tests to compatibility headers
Browse files Browse the repository at this point in the history
  • Loading branch information
anarthal committed Jan 14, 2025
1 parent bcc4720 commit 128fd88
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 37 deletions.
6 changes: 4 additions & 2 deletions test/from_chars_float.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt

#include <boost/charconv.hpp>
#include "before_impl_headers.hpp"
#include <math.h>
#define BOOST_CHARCONV_SOURCE
#include "../src/from_chars_float_impl.hpp"
#undef BOOST_CHARCONV_SOURCE
#include <boost/charconv.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/config/std/system_error.hpp>
#include <boost/config/std/iostream.hpp>
Expand Down
2 changes: 1 addition & 1 deletion test/from_chars_float2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <boost/charconv.hpp>
#include <boost/core/detail/splitmix64.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/config/std/cstdio.hpp>
#include <cstdio> // stderr

static boost::detail::splitmix64 rng;

Expand Down
8 changes: 5 additions & 3 deletions test/github_issue_122.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt

#define BOOST_CHARCONV_SOURCE
#include <boost/charconv/detail/fallback_routines.hpp>
#undef BOOST_CHARCONV_SOURCE

#include <boost/charconv.hpp>
#include <boost/config/std/locale.hpp>
#include <boost/config/std/iostream.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/charconv.hpp>
#include "before_impl_headers.hpp"
#include <boost/charconv/detail/fallback_routines.hpp>

template <typename T>
void test()
Expand Down
18 changes: 8 additions & 10 deletions test/github_issue_152_float128.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt

#include <boost/charconv/detail/config.hpp>
#include <ostream>
#include <boost/charconv.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/config/std/system_error.hpp>
#include <boost/config/std/ostream.hpp>
#include <boost/config/std/limits.hpp>
#include <boost/config/std/random.hpp>
#include <boost/config/std/array.hpp>
#include <boost/config/std/cstdint.hpp>

#ifdef BOOST_CHARCONV_HAS_QUADMATH

Expand All @@ -25,14 +31,6 @@ std::ostream& operator<<( std::ostream& os, std::float128_t v )
}
#endif

#include <boost/charconv.hpp>
#include <boost/core/lightweight_test.hpp>
#include <system_error>
#include <limits>
#include <random>
#include <array>
#include <cstdint>

constexpr std::size_t N = 1024;
static std::mt19937_64 rng(42);

Expand Down
2 changes: 1 addition & 1 deletion test/github_issue_212.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#include <boost/charconv.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/config/std/system_error.hpp>
#include <boost/config/std/cstdint.hpp>
#include <boost/config/std/cstring.hpp>
#include <cstdint>

template <typename T>
void test()
Expand Down
2 changes: 1 addition & 1 deletion test/test_128bit_emulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <boost/config/std/limits.hpp>
#include <boost/config/std/iostream.hpp>
#include <boost/config/std/cstdint.hpp>
#include <boost/config/std/climits.hpp>
#include <limits.h> // CHAR_BIT

#ifdef BOOST_HAS_INT128

Expand Down
3 changes: 2 additions & 1 deletion test/test_boost_json_values.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
#include <boost/config/std/random.hpp>
#include <boost/config/std/type_traits.hpp>
#include <boost/config/std/cstring.hpp>
#include <boost/config/std/cinttypes.hpp>
#include <cinttypes>
#include <cstdio> // stderr

template <typename T>
void grind(const std::string& str, const T expected_value)
Expand Down
2 changes: 1 addition & 1 deletion test/test_compute_float32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt

#include <math.h>
#include "before_impl_headers.hpp"
#include <boost/charconv/detail/compute_float32.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/config/std/limits.hpp>
#include <boost/config/std/cstdint.hpp>
#include <math.h>

using boost::charconv::detail::compute_float32;

Expand Down
2 changes: 1 addition & 1 deletion test/test_compute_float64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt

#include <math.h>
#include "before_impl_headers.hpp"
#include <boost/charconv/detail/compute_float64.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/config/std/random.hpp>
#include <boost/config/std/limits.hpp>
#include <cstdint>
#include <math.h>

using boost::charconv::detail::compute_float64;

Expand Down
26 changes: 13 additions & 13 deletions test/test_float128.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,19 @@
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt

#include <boost/charconv/detail/config.hpp>

#define BOOST_CHARCONV_SOURCE
#include <boost/charconv/detail/issignaling.hpp>
#include "../src/float128_impl.hpp"
#undef BOOST_CHARCONV_SOURCE
#include <boost/charconv.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/core/detail/splitmix64.hpp>
#include <boost/config/std/limits.hpp>
#include <boost/config/std/iostream.hpp>
#include <boost/config/std/iomanip.hpp>
#include <boost/config/std/string.hpp>
#include <boost/config/std/random.hpp>

#if defined(BOOST_CHARCONV_HAS_QUADMATH) && defined(BOOST_HAS_INT128)

Expand Down Expand Up @@ -83,18 +95,6 @@ std::ostream& operator<<( std::ostream& os, boost::int128_type v )
}


#include <boost/charconv.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/core/detail/splitmix64.hpp>
#include <boost/charconv/detail/issignaling.hpp>
#include <boost/config/std/limits.hpp>
#include <boost/config/std/iostream.hpp>
#include <boost/config/std/iomanip.hpp>
#include <boost/config/std/string.hpp>
#include <boost/config/std/random.hpp>
#include "before_impl_headers.hpp"
#include "../src/float128_impl.hpp"

constexpr int N = 1024;
static boost::detail::splitmix64 rng;

Expand Down
2 changes: 2 additions & 0 deletions test/to_chars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include <boost/config/std/string.hpp>
#include <boost/config/std/cstring.hpp>
#include <boost/config/std/cerrno.hpp>
#include <stdint.h> // UINT64_C
#include <limits.h> // INT_MIN

#ifdef BOOST_CHARCONV_HAS_INT128
template <typename T>
Expand Down
7 changes: 4 additions & 3 deletions test/to_chars_float.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt

#include <boost/charconv.hpp>
#include "before_impl_headers.hpp"
#define BOOST_CHARCONV_SOURCE
#include <boost/charconv/detail/fallback_routines.hpp>
#undef BOOST_CHARCONV_SOURCE
#include <boost/charconv.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/core/detail/splitmix64.hpp>
#include <boost/config/std/system_error.hpp>
#include <boost/config/std/type_traits.hpp>
#include <boost/config/std/limits.hpp>
Expand All @@ -18,7 +20,6 @@
#include <boost/config/std/random.hpp>
#include <boost/config/std/iomanip.hpp>
#include <boost/config/std/sstream.hpp>
#include <boost/core/detail/splitmix64.hpp>

// These numbers diverge from what the formatting is using printf
// See: https://godbolt.org/z/zd34KcWMW
Expand Down

0 comments on commit 128fd88

Please sign in to comment.