1
0
mirror of https://github.com/nlohmann/json synced 2024-11-23 20:40:08 +00:00

try with GCC 4.9

This commit is contained in:
Niels 2015-02-08 16:57:53 +01:00
parent d6f54711f3
commit a35d93e980
2 changed files with 351 additions and 3 deletions

View File

@ -6,8 +6,8 @@ compiler:
before_install:
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
- sudo apt-get update -qq
- if [ "$CXX" = "g++" ]; then sudo apt-get install -qq g++-4.8; fi
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi
- if [ "$CXX" = "g++" ]; then sudo apt-get install -qq g++-4.9; fi
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi
- sudo pip install cpp-coveralls pyyaml
- sudo apt-get install valgrind
@ -24,4 +24,4 @@ after_success:
- make clean
- make json_unit CXXFLAGS="-fprofile-arcs -ftest-coverage"
- ./json_unit
- coveralls --gcov-options '\-lp' --gcov 'gcov-4.8'
- coveralls --exclude test/catch.hpp --exclude test/unit.cpp --include src/json.hpp --gcov-options '\-lp' --gcov 'gcov-4.9'

View File

@ -1478,6 +1478,150 @@ TEST_CASE("value conversion")
CHECK(json(n) == j);
}
SECTION("int8_t")
{
int8_t n = j.get<int8_t>();
CHECK(json(n) == j);
}
SECTION("int16_t")
{
int16_t n = j.get<int16_t>();
CHECK(json(n) == j);
}
SECTION("int32_t")
{
int32_t n = j.get<int32_t>();
CHECK(json(n) == j);
}
SECTION("int64_t")
{
int64_t n = j.get<int64_t>();
CHECK(json(n) == j);
}
SECTION("int8_fast_t")
{
int_fast8_t n = j.get<int_fast8_t>();
CHECK(json(n) == j);
}
SECTION("int16_fast_t")
{
int_fast16_t n = j.get<int_fast16_t>();
CHECK(json(n) == j);
}
SECTION("int32_fast_t")
{
int_fast32_t n = j.get<int_fast32_t>();
CHECK(json(n) == j);
}
SECTION("int64_fast_t")
{
int_fast64_t n = j.get<int_fast64_t>();
CHECK(json(n) == j);
}
SECTION("int8_least_t")
{
int_least8_t n = j.get<int_least8_t>();
CHECK(json(n) == j);
}
SECTION("int16_least_t")
{
int_least16_t n = j.get<int_least16_t>();
CHECK(json(n) == j);
}
SECTION("int32_least_t")
{
int_least32_t n = j.get<int_least32_t>();
CHECK(json(n) == j);
}
SECTION("int64_least_t")
{
int_least64_t n = j.get<int_least64_t>();
CHECK(json(n) == j);
}
SECTION("uint8_t")
{
uint8_t n = j.get<uint8_t>();
CHECK(json(n) == j);
}
SECTION("uint16_t")
{
uint16_t n = j.get<uint16_t>();
CHECK(json(n) == j);
}
SECTION("uint32_t")
{
uint32_t n = j.get<uint32_t>();
CHECK(json(n) == j);
}
SECTION("uint64_t")
{
uint64_t n = j.get<uint64_t>();
CHECK(json(n) == j);
}
SECTION("uint8_fast_t")
{
uint_fast8_t n = j.get<uint_fast8_t>();
CHECK(json(n) == j);
}
SECTION("uint16_fast_t")
{
uint_fast16_t n = j.get<uint_fast16_t>();
CHECK(json(n) == j);
}
SECTION("uint32_fast_t")
{
uint_fast32_t n = j.get<uint_fast32_t>();
CHECK(json(n) == j);
}
SECTION("uint64_fast_t")
{
uint_fast64_t n = j.get<uint_fast64_t>();
CHECK(json(n) == j);
}
SECTION("uint8_least_t")
{
uint_least8_t n = j.get<uint_least8_t>();
CHECK(json(n) == j);
}
SECTION("uint16_least_t")
{
uint_least16_t n = j.get<uint_least16_t>();
CHECK(json(n) == j);
}
SECTION("uint32_least_t")
{
uint_least32_t n = j.get<uint_least32_t>();
CHECK(json(n) == j);
}
SECTION("uint64_least_t")
{
uint_least64_t n = j.get<uint_least64_t>();
CHECK(json(n) == j);
}
SECTION("exception in case of a non-number type")
{
CHECK_THROWS_AS(json(json::value_t::null).get<json::number_integer_t>(), std::logic_error);
@ -1488,4 +1632,208 @@ TEST_CASE("value conversion")
CHECK_NOTHROW(json(json::value_t::number_float).get<json::number_integer_t>());
}
}
SECTION("get an integer number (implicit)")
{
json::number_integer_t n_reference {42};
json j(n_reference);
SECTION("number_integer_t")
{
json::number_integer_t n = j.get<json::number_integer_t>();
CHECK(json(n) == j);
}
SECTION("short")
{
short n = j;
CHECK(json(n) == j);
}
SECTION("unsigned short")
{
unsigned short n = j;
CHECK(json(n) == j);
}
SECTION("int")
{
int n = j;
CHECK(json(n) == j);
}
SECTION("unsigned int")
{
unsigned int n = j;
CHECK(json(n) == j);
}
SECTION("long")
{
long n = j;
CHECK(json(n) == j);
}
SECTION("unsigned long")
{
unsigned long n = j;
CHECK(json(n) == j);
}
SECTION("long long")
{
long long n = j;
CHECK(json(n) == j);
}
SECTION("unsigned long long")
{
unsigned long long n = j;
CHECK(json(n) == j);
}
SECTION("int8_t")
{
int8_t n = j;
CHECK(json(n) == j);
}
SECTION("int16_t")
{
int16_t n = j;
CHECK(json(n) == j);
}
SECTION("int32_t")
{
int32_t n = j;
CHECK(json(n) == j);
}
SECTION("int64_t")
{
int64_t n = j;
CHECK(json(n) == j);
}
SECTION("int8_fast_t")
{
int_fast8_t n = j;
CHECK(json(n) == j);
}
SECTION("int16_fast_t")
{
int_fast16_t n = j;
CHECK(json(n) == j);
}
SECTION("int32_fast_t")
{
int_fast32_t n = j;
CHECK(json(n) == j);
}
SECTION("int64_fast_t")
{
int_fast64_t n = j;
CHECK(json(n) == j);
}
SECTION("int8_least_t")
{
int_least8_t n = j;
CHECK(json(n) == j);
}
SECTION("int16_least_t")
{
int_least16_t n = j;
CHECK(json(n) == j);
}
SECTION("int32_least_t")
{
int_least32_t n = j;
CHECK(json(n) == j);
}
SECTION("int64_least_t")
{
int_least64_t n = j;
CHECK(json(n) == j);
}
SECTION("uint8_t")
{
uint8_t n = j;
CHECK(json(n) == j);
}
SECTION("uint16_t")
{
uint16_t n = j;
CHECK(json(n) == j);
}
SECTION("uint32_t")
{
uint32_t n = j;
CHECK(json(n) == j);
}
SECTION("uint64_t")
{
uint64_t n = j;
CHECK(json(n) == j);
}
SECTION("uint8_fast_t")
{
uint_fast8_t n = j;
CHECK(json(n) == j);
}
SECTION("uint16_fast_t")
{
uint_fast16_t n = j;
CHECK(json(n) == j);
}
SECTION("uint32_fast_t")
{
uint_fast32_t n = j;
CHECK(json(n) == j);
}
SECTION("uint64_fast_t")
{
uint_fast64_t n = j;
CHECK(json(n) == j);
}
SECTION("uint8_least_t")
{
uint_least8_t n = j;
CHECK(json(n) == j);
}
SECTION("uint16_least_t")
{
uint_least16_t n = j;
CHECK(json(n) == j);
}
SECTION("uint32_least_t")
{
uint_least32_t n = j;
CHECK(json(n) == j);
}
SECTION("uint64_least_t")
{
uint_least64_t n = j;
CHECK(json(n) == j);
}
}
}