Skip to content

Commit

Permalink
Replace limit macros and use namespaced int types
Browse files Browse the repository at this point in the history
  • Loading branch information
falbrechtskirchinger committed Sep 4, 2022
1 parent 307c053 commit 7c7bf27
Show file tree
Hide file tree
Showing 5 changed files with 651 additions and 652 deletions.
32 changes: 14 additions & 18 deletions tests/src/unit-bson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using nlohmann::json;

#include <fstream>
#include <limits>
#include <sstream>
#include "make_test_data_available.hpp"
#include "test_utils.hpp"
Expand Down Expand Up @@ -921,9 +922,9 @@ TEST_CASE("BSON numerical data")

SECTION("signed std::int32_t: INT32_MIN .. INT32_MAX")
{
std::vector<int32_t> numbers
std::vector<std::int32_t> numbers
{
INT32_MIN,
std::numeric_limits<std::int32_t>::min(),
-2147483647L,
-1000000000L,
-100000000L,
Expand All @@ -947,12 +948,11 @@ TEST_CASE("BSON numerical data")
100000000L,
1000000000L,
2147483646L,
INT32_MAX
std::numeric_limits<std::int32_t>::max()
};

for (auto i : numbers)
{

CAPTURE(i)

json j =
Expand Down Expand Up @@ -988,9 +988,9 @@ TEST_CASE("BSON numerical data")

SECTION("signed std::int64_t: INT32_MAX+1 .. INT64_MAX")
{
std::vector<int64_t> numbers
std::vector<std::int64_t> numbers
{
INT64_MAX,
std::numeric_limits<std::int64_t>::max(),
1000000000000000000LL,
100000000000000000LL,
10000000000000000LL,
Expand All @@ -1000,12 +1000,11 @@ TEST_CASE("BSON numerical data")
1000000000000LL,
100000000000LL,
10000000000LL,
static_cast<std::int64_t>(INT32_MAX) + 1,
static_cast<std::int64_t>(std::numeric_limits<std::int32_t>::max()) + 1,
};

for (auto i : numbers)
{

CAPTURE(i)

json j =
Expand Down Expand Up @@ -1062,12 +1061,11 @@ TEST_CASE("BSON numerical data")
100000000ULL,
1000000000ULL,
2147483646ULL,
static_cast<std::uint64_t>(INT32_MAX)
static_cast<std::uint64_t>(std::numeric_limits<std::int32_t>::max())
};

for (auto i : numbers)
{

CAPTURE(i)

json j =
Expand Down Expand Up @@ -1105,9 +1103,9 @@ TEST_CASE("BSON numerical data")
{
std::vector<std::uint64_t> numbers
{
static_cast<std::uint64_t>(INT32_MAX) + 1,
static_cast<std::uint64_t>(std::numeric_limits<std::int32_t>::max()) + 1,
4000000000ULL,
static_cast<std::uint64_t>(UINT32_MAX),
static_cast<std::uint64_t>(std::numeric_limits<std::uint32_t>::max()),
10000000000ULL,
100000000000ULL,
1000000000000ULL,
Expand All @@ -1117,12 +1115,11 @@ TEST_CASE("BSON numerical data")
10000000000000000ULL,
100000000000000000ULL,
1000000000000000000ULL,
static_cast<std::uint64_t>(INT64_MAX),
static_cast<std::uint64_t>(std::numeric_limits<std::int64_t>::max()),
};

for (auto i : numbers)
{

CAPTURE(i)

json j =
Expand Down Expand Up @@ -1163,16 +1160,15 @@ TEST_CASE("BSON numerical data")
{
std::vector<std::uint64_t> numbers
{
static_cast<std::uint64_t>(INT64_MAX) + 1ULL,
static_cast<std::uint64_t>(std::numeric_limits<std::int64_t>::max()) + 1ULL,
10000000000000000000ULL,
18000000000000000000ULL,
UINT64_MAX - 1ULL,
UINT64_MAX,
std::numeric_limits<std::uint64_t>::max() - 1ULL,
std::numeric_limits<std::uint64_t>::max()
};

for (auto i : numbers)
{

CAPTURE(i)

json j =
Expand Down
Loading

0 comments on commit 7c7bf27

Please sign in to comment.