Merge branch 'feature/travis' into develop
This commit is contained in:
commit
37fdcd893d
5 changed files with 453 additions and 154 deletions
12
.gitignore
vendored
12
.gitignore
vendored
|
@ -1,18 +1,16 @@
|
||||||
json_unit
|
json_unit
|
||||||
json_benchmarks
|
json_benchmarks
|
||||||
|
|
||||||
fuzz-testing
|
fuzz-testing
|
||||||
|
|
||||||
*.dSYM
|
*.dSYM
|
||||||
|
*.o
|
||||||
|
*.gcno
|
||||||
|
*.gcda
|
||||||
|
|
||||||
working
|
working
|
||||||
|
|
||||||
html
|
doc/xml
|
||||||
|
doc/html
|
||||||
me.nlohmann.json.docset
|
me.nlohmann.json.docset
|
||||||
|
|
||||||
android
|
|
||||||
doc/xml
|
|
||||||
|
|
||||||
benchmarks/files/numbers/*.json
|
benchmarks/files/numbers/*.json
|
||||||
|
|
||||||
*.o
|
|
||||||
|
|
391
.travis.yml
391
.travis.yml
|
@ -1,175 +1,290 @@
|
||||||
|
#########################
|
||||||
|
# project configuration #
|
||||||
|
#########################
|
||||||
|
|
||||||
|
# C++ project
|
||||||
language: cpp
|
language: cpp
|
||||||
|
|
||||||
dist: trusty
|
dist: trusty
|
||||||
sudo: required
|
sudo: required
|
||||||
|
|
||||||
|
|
||||||
|
###################
|
||||||
|
# global settings #
|
||||||
|
###################
|
||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
# The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
|
# The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
|
||||||
# via the "travis encrypt" command using the project repo's public key
|
# via the "travis encrypt" command using the project repo's public key
|
||||||
- secure: "m89SSgE+ASLO38rSKx7MTXK3n5NkP9bIx95jwY71YEiuFzib30PDJ/DifKnXxBjvy/AkCGztErQRk/8ZCvq+4HXozU2knEGnL/RUitvlwbhzfh2D4lmS3BvWBGS3N3NewoPBrRmdcvnT0xjOGXxtZaJ3P74TkB9GBnlz/HmKORA="
|
- secure: "m89SSgE+ASLO38rSKx7MTXK3n5NkP9bIx95jwY71YEiuFzib30PDJ/DifKnXxBjvy/AkCGztErQRk/8ZCvq+4HXozU2knEGnL/RUitvlwbhzfh2D4lmS3BvWBGS3N3NewoPBrRmdcvnT0xjOGXxtZaJ3P74TkB9GBnlz/HmKORA="
|
||||||
|
|
||||||
# from http://stackoverflow.com/a/32127147/266378
|
|
||||||
|
################
|
||||||
|
# build matrix #
|
||||||
|
################
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: linux
|
|
||||||
compiler: gcc
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
|
||||||
packages: ['g++-4.9', 'valgrind', 'python-pip', 'python-yaml']
|
|
||||||
before_script:
|
|
||||||
- pip install --user git+git://github.com/eddyxu/cpp-coveralls.git
|
|
||||||
after_success:
|
|
||||||
- make clean
|
|
||||||
- touch src/json.hpp
|
|
||||||
- make json_unit CXXFLAGS="-fprofile-arcs -ftest-coverage -std=c++11 -lstdc++" CXX=$COMPILER
|
|
||||||
- test/json_unit "*"
|
|
||||||
- coveralls --build-root test --exclude src/catch.hpp --exclude src/unit-algorithms.cpp --exclude src/unit-allocator.cpp --exclude src/unit-capacity.cpp --exclude src/unit-class_const_iterator.cpp --exclude src/unit-class_iterator.cpp --exclude src/unit-class_lexer.cpp --exclude src/unit-class_parser.cpp --exclude src/unit-comparison.cpp --exclude src/unit-concepts.cpp --exclude src/unit-constructor1.cpp --exclude src/unit-constructor2.cpp --exclude src/unit-convenience.cpp --exclude src/unit-conversions.cpp --exclude src/unit-deserialization.cpp --exclude src/unit-element_access1.cpp --exclude src/unit-element_access2.cpp --exclude src/unit-inspection.cpp --exclude src/unit-iterator_wrapper.cpp --exclude src/unit-iterators1.cpp --exclude src/unit-iterators2.cpp --exclude src/unit-json_patch.cpp --exclude src/unit-json_pointer.cpp --exclude src/unit-modifiers.cpp --exclude src/unit-pointer_access.cpp --exclude src/unit-readme.cpp --exclude src/unit-reference_access.cpp --exclude src/unit-regression.cpp --exclude src/unit-serialization.cpp --exclude src/unit-testsuites.cpp --exclude src/unit-unicode.cpp --include ../src/json.hpp --gcov-options '\-lp' --gcov 'gcov-4.9'
|
|
||||||
env: COMPILER=g++-4.9
|
|
||||||
|
|
||||||
- os: linux
|
# Valgrind
|
||||||
compiler: gcc
|
|
||||||
before_install: echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-certificates.crt
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
|
||||||
packages: ['g++-5', 'valgrind']
|
|
||||||
coverity_scan:
|
|
||||||
project:
|
|
||||||
name: "nlohmann/json"
|
|
||||||
description: "Build submitted via Travis CI"
|
|
||||||
notification_email: niels.lohmann@gmail.com
|
|
||||||
build_command_prepend: "make clean ; sudo cp $(which g++-5) $(which g++)"
|
|
||||||
build_command: "make"
|
|
||||||
branch_pattern: coverity_scan
|
|
||||||
env: COMPILER=g++-5
|
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: gcc
|
compiler: gcc
|
||||||
addons:
|
env:
|
||||||
apt:
|
- COMPILER=g++-4.9
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
- SPECIAL=valgrind
|
||||||
packages: ['g++-6', 'valgrind']
|
addons:
|
||||||
env: COMPILER=g++-6
|
apt:
|
||||||
|
sources: ['ubuntu-toolchain-r-test']
|
||||||
|
packages: [g++-4.9, valgrind]
|
||||||
|
after_success:
|
||||||
|
- valgrind --error-exitcode=1 --leak-check=full test/json_unit
|
||||||
|
|
||||||
# from https://github.com/travis-ci/travis-ci/issues/6120
|
# Coveralls (http://gronlier.fr/blog/2015/01/adding-code-coverage-to-your-c-project/)
|
||||||
- os: linux
|
|
||||||
env:
|
|
||||||
- LLVM_VERSION=3.8.0
|
|
||||||
- LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz
|
|
||||||
- COMPILER=clang++
|
|
||||||
- CPPFLAGS="-I $HOME/clang-$LLVM_VERSION/include/c++/v1"
|
|
||||||
- LDFLAGS=-lc++
|
|
||||||
- PATH=$HOME/clang-$LLVM_VERSION/bin:$PATH
|
|
||||||
- LD_LIBRARY_PATH=$HOME/clang-$LLVM_VERSION/lib:$LD_LIBRARY_PATH
|
|
||||||
before_install:
|
|
||||||
- wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH
|
|
||||||
- mkdir $HOME/clang-$LLVM_VERSION
|
|
||||||
- tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1
|
|
||||||
|
|
||||||
# Clang 3.5 is not able to compile the code,
|
- os: linux
|
||||||
# see https://travis-ci.org/nlohmann/json/jobs/126720186
|
compiler: gcc
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources: ['ubuntu-toolchain-r-test']
|
||||||
|
packages: ['g++-4.9', 'ruby']
|
||||||
|
before_script:
|
||||||
|
- wget http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.11.orig.tar.gz
|
||||||
|
- tar xf lcov_1.11.orig.tar.gz
|
||||||
|
- sudo make -C lcov-1.11/ install
|
||||||
|
- gem install coveralls-lcov
|
||||||
|
after_success:
|
||||||
|
- make clean
|
||||||
|
- CXXFLAGS="--coverage -g -O0" CPPFLAGS="-DNDEBUG" make
|
||||||
|
- test/json_unit "*"
|
||||||
|
- coveralls --build-root test --exclude src/catch.hpp --exclude src/unit-algorithms.cpp --exclude src/unit-allocator.cpp --exclude src/unit-capacity.cpp --exclude src/unit-class_const_iterator.cpp --exclude src/unit-class_iterator.cpp --exclude src/unit-class_lexer.cpp --exclude src/unit-class_parser.cpp --exclude src/unit-comparison.cpp --exclude src/unit-concepts.cpp --exclude src/unit-constructor1.cpp --exclude src/unit-constructor2.cpp --exclude src/unit-convenience.cpp --exclude src/unit-conversions.cpp --exclude src/unit-deserialization.cpp --exclude src/unit-element_access1.cpp --exclude src/unit-element_access2.cpp --exclude src/unit-inspection.cpp --exclude src/unit-iterator_wrapper.cpp --exclude src/unit-iterators1.cpp --exclude src/unit-iterators2.cpp --exclude src/unit-json_patch.cpp --exclude src/unit-json_pointer.cpp --exclude src/unit-modifiers.cpp --exclude src/unit-pointer_access.cpp --exclude src/unit-readme.cpp --exclude src/unit-reference_access.cpp --exclude src/unit-regression.cpp --exclude src/unit-serialization.cpp --exclude src/unit-testsuites.cpp --exclude src/unit-unicode.cpp --include ../src/json.hpp --gcov-options '\-lp' --gcov 'gcov-4.9'
|
||||||
|
- lcov --directory src --directory test/src --capture --output-file coverage.info --rc lcov_branch_coverage=1 --no-external
|
||||||
|
- lcov --remove coverage.info 'test/src/*' --output-file coverage.info --rc lcov_branch_coverage=1
|
||||||
|
- lcov --list coverage.info --rc lcov_branch_coverage=1
|
||||||
|
- coveralls-lcov --repo-token F9bs4Nop10JRgqPQXRcifyQKYhb3FczkS coverage.info
|
||||||
|
env:
|
||||||
|
- COMPILER=g++-4.9
|
||||||
|
- SPECIAL=coveralls
|
||||||
|
|
||||||
# - os: linux
|
# Coverity (only for branch coverity_scan)
|
||||||
# compiler: clang
|
|
||||||
# addons:
|
|
||||||
# apt:
|
|
||||||
# sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.6']
|
|
||||||
# packages: ['clang-3.6', 'valgrind']
|
|
||||||
# env: COMPILER=clang++-3.6
|
|
||||||
#
|
|
||||||
# - os: linux
|
|
||||||
# compiler: clang
|
|
||||||
# addons:
|
|
||||||
# apt:
|
|
||||||
# sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.7']
|
|
||||||
# packages: ['clang-3.7', 'valgrind']
|
|
||||||
# env: COMPILER=clang++-3.7
|
|
||||||
#
|
|
||||||
# - os: linux
|
|
||||||
# compiler: clang
|
|
||||||
# addons:
|
|
||||||
# apt:
|
|
||||||
# sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.8']
|
|
||||||
# packages: ['clang-3.8', 'valgrind']
|
|
||||||
# env: COMPILER=clang++-3.8
|
|
||||||
|
|
||||||
# - os: linux
|
- os: linux
|
||||||
# compiler: clang
|
compiler: gcc
|
||||||
# addons:
|
before_install: echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-certificates.crt
|
||||||
# apt:
|
addons:
|
||||||
# sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise']
|
apt:
|
||||||
# packages: ['clang-3.9', 'valgrind']
|
sources: ['ubuntu-toolchain-r-test']
|
||||||
# env: COMPILER=clang++-3.9
|
packages: ['g++-5', 'valgrind']
|
||||||
|
coverity_scan:
|
||||||
|
project:
|
||||||
|
name: "nlohmann/json"
|
||||||
|
description: "Build submitted via Travis CI"
|
||||||
|
notification_email: niels.lohmann@gmail.com
|
||||||
|
build_command_prepend: "make clean ; sudo cp $(which g++-5) $(which g++)"
|
||||||
|
build_command: "make"
|
||||||
|
branch_pattern: coverity_scan
|
||||||
|
env:
|
||||||
|
- COMPILER=g++-5
|
||||||
|
- SPECIAL=coverity
|
||||||
|
|
||||||
- os: osx
|
# OSX / Clang
|
||||||
osx_image: beta-xcode6.1
|
|
||||||
compiler: clang
|
|
||||||
env:
|
|
||||||
- COMPILER=clang
|
|
||||||
- CXXFLAGS=-lstdc++
|
|
||||||
|
|
||||||
- os: osx
|
- os: osx
|
||||||
osx_image: beta-xcode6.2
|
osx_image: beta-xcode6.1
|
||||||
compiler: clang
|
|
||||||
env:
|
|
||||||
- COMPILER=clang
|
|
||||||
- CXXFLAGS=-lstdc++
|
|
||||||
|
|
||||||
- os: osx
|
- os: osx
|
||||||
osx_image: beta-xcode6.3
|
osx_image: beta-xcode6.2
|
||||||
compiler: clang
|
|
||||||
env:
|
|
||||||
- COMPILER=clang
|
|
||||||
- CXXFLAGS=-lstdc++
|
|
||||||
|
|
||||||
- os: osx
|
- os: osx
|
||||||
osx_image: xcode6.4
|
osx_image: beta-xcode6.3
|
||||||
compiler: clang
|
|
||||||
env:
|
|
||||||
- COMPILER=clang
|
|
||||||
- CXXFLAGS=-lstdc++
|
|
||||||
|
|
||||||
- os: osx
|
- os: osx
|
||||||
osx_image: xcode7.1
|
osx_image: xcode6.4
|
||||||
compiler: clang
|
|
||||||
env:
|
|
||||||
- COMPILER=clang
|
|
||||||
- CXXFLAGS=-lstdc++
|
|
||||||
|
|
||||||
- os: osx
|
- os: osx
|
||||||
osx_image: xcode7.2
|
osx_image: xcode7.1
|
||||||
compiler: clang
|
|
||||||
env:
|
|
||||||
- COMPILER=clang
|
|
||||||
- CXXFLAGS=-lstdc++
|
|
||||||
|
|
||||||
- os: osx
|
- os: osx
|
||||||
osx_image: xcode7.3
|
osx_image: xcode7.2
|
||||||
compiler: clang
|
|
||||||
env:
|
|
||||||
- COMPILER=clang
|
|
||||||
- CXXFLAGS=-lstdc++
|
|
||||||
|
|
||||||
- os: osx
|
- os: osx
|
||||||
osx_image: xcode8
|
osx_image: xcode7.3
|
||||||
compiler: clang
|
|
||||||
env:
|
- os: osx
|
||||||
- COMPILER=clang
|
osx_image: xcode8
|
||||||
- CXXFLAGS=-lstdc++
|
|
||||||
|
# Linux / GCC
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: gcc
|
||||||
|
env: COMPILER=g++-4.9
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources: ['ubuntu-toolchain-r-test']
|
||||||
|
packages: g++-4.9
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: gcc
|
||||||
|
env: COMPILER=g++-5
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources: ['ubuntu-toolchain-r-test']
|
||||||
|
packages: g++-5
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: gcc
|
||||||
|
env: COMPILER=g++-6
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources: ['ubuntu-toolchain-r-test']
|
||||||
|
packages: g++-6
|
||||||
|
|
||||||
|
# Linux / Clang
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
env: LLVM_VERSION=3.6.0
|
||||||
|
compiler: clang
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
env: LLVM_VERSION=3.6.1
|
||||||
|
compiler: clang
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
env: LLVM_VERSION=3.6.2
|
||||||
|
compiler: clang
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
env: LLVM_VERSION=3.7.0
|
||||||
|
compiler: clang
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
env: LLVM_VERSION=3.7.1
|
||||||
|
compiler: clang
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
env: LLVM_VERSION=3.8.0
|
||||||
|
compiler: clang
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
env: LLVM_VERSION=3.8.1
|
||||||
|
compiler: clang
|
||||||
|
|
||||||
|
#####################
|
||||||
|
# installation step #
|
||||||
|
#####################
|
||||||
|
|
||||||
|
# set directories to cache
|
||||||
|
cache:
|
||||||
|
directories:
|
||||||
|
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.6.2
|
||||||
|
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.6.1
|
||||||
|
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.6.0
|
||||||
|
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.7.0
|
||||||
|
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.7.1
|
||||||
|
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.8.0
|
||||||
|
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.8.1
|
||||||
|
|
||||||
|
|
||||||
|
install:
|
||||||
|
# create deps dir if not existing
|
||||||
|
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
|
||||||
|
- mkdir -p ${DEPS_DIR}
|
||||||
|
|
||||||
|
# make sure CXX is correctly set
|
||||||
|
- if [[ "${COMPILER}" != "" ]]; then export CXX=${COMPILER}; fi
|
||||||
|
|
||||||
|
# install LLVM/clang when LLVM_VERSION is set
|
||||||
|
- |
|
||||||
|
if [[ "${LLVM_VERSION}" != "" ]]; then
|
||||||
|
LLVM_DIR=${DEPS_DIR}/llvm-${LLVM_VERSION}
|
||||||
|
if [[ -z "$(ls -A ${LLVM_DIR})" ]]; then
|
||||||
|
LLVM_URL="http://llvm.org/releases/${LLVM_VERSION}/llvm-${LLVM_VERSION}.src.tar.xz"
|
||||||
|
LIBCXX_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxx-${LLVM_VERSION}.src.tar.xz"
|
||||||
|
LIBCXXABI_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxxabi-${LLVM_VERSION}.src.tar.xz"
|
||||||
|
CLANG_URL="http://llvm.org/releases/${LLVM_VERSION}/clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-ubuntu-14.04.tar.xz"
|
||||||
|
mkdir -p ${LLVM_DIR} ${LLVM_DIR}/build ${LLVM_DIR}/projects/libcxx ${LLVM_DIR}/projects/libcxxabi ${LLVM_DIR}/clang
|
||||||
|
travis_retry wget --quiet -O - ${LLVM_URL} | tar --strip-components=1 -xJ -C ${LLVM_DIR}
|
||||||
|
travis_retry wget --quiet -O - ${LIBCXX_URL} | tar --strip-components=1 -xJ -C ${LLVM_DIR}/projects/libcxx
|
||||||
|
travis_retry wget --quiet -O - ${LIBCXXABI_URL} | tar --strip-components=1 -xJ -C ${LLVM_DIR}/projects/libcxxabi
|
||||||
|
travis_retry wget --quiet -O - ${CLANG_URL} | tar --strip-components=1 -xJ -C ${LLVM_DIR}/clang
|
||||||
|
(cd ${LLVM_DIR}/build && cmake .. -DCMAKE_INSTALL_PREFIX=${LLVM_DIR}/install -DCMAKE_CXX_COMPILER=clang++)
|
||||||
|
(cd ${LLVM_DIR}/build/projects/libcxx && make install -j2)
|
||||||
|
(cd ${LLVM_DIR}/build/projects/libcxxabi && make install -j2)
|
||||||
|
fi
|
||||||
|
export CXXFLAGS="-nostdinc++ -isystem ${LLVM_DIR}/install/include/c++/v1"
|
||||||
|
export LDFLAGS="-L ${LLVM_DIR}/install/lib -l c++ -l c++abi"
|
||||||
|
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${LLVM_DIR}/install/lib"
|
||||||
|
export PATH="${LLVM_DIR}/clang/bin:${PATH}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
################
|
||||||
|
# build script #
|
||||||
|
################
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
# show OS/compiler version
|
||||||
- uname -a
|
- uname -a
|
||||||
- $COMPILER --version
|
- $CXX --version
|
||||||
- make CXX=$COMPILER
|
|
||||||
|
# compile
|
||||||
|
- make
|
||||||
|
|
||||||
|
# execute unit tests
|
||||||
- test/json_unit "*"
|
- test/json_unit "*"
|
||||||
- if [ `which valgrind` ]; then
|
|
||||||
valgrind --error-exitcode=1 --leak-check=full test/json_unit ;
|
# check if homebrew works (only checks develop branch)
|
||||||
fi
|
|
||||||
- if [ `which brew` ]; then
|
- if [ `which brew` ]; then
|
||||||
brew update ;
|
brew update ;
|
||||||
brew tap nlohmann/json ;
|
brew tap nlohmann/json ;
|
||||||
brew install nlohmann_json --HEAD ;
|
brew install nlohmann_json --HEAD ;
|
||||||
brew test nlohmann_json ;
|
brew test nlohmann_json ;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#language: cpp
|
||||||
|
#
|
||||||
|
#dist: trusty
|
||||||
|
#sudo: required
|
||||||
|
#
|
||||||
|
#env:
|
||||||
|
# global:
|
||||||
|
# # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
|
||||||
|
# # via the "travis encrypt" command using the project repo's public key
|
||||||
|
# - secure: "m89SSgE+ASLO38rSKx7MTXK3n5NkP9bIx95jwY71YEiuFzib30PDJ/DifKnXxBjvy/AkCGztErQRk/8ZCvq+4HXozU2knEGnL/RUitvlwbhzfh2D4lmS3BvWBGS3N3NewoPBrRmdcvnT0xjOGXxtZaJ3P74TkB9GBnlz/HmKORA="
|
||||||
|
#
|
||||||
|
## from http://stackoverflow.com/a/32127147/266378
|
||||||
|
#matrix:
|
||||||
|
# include:
|
||||||
|
# - os: linux
|
||||||
|
# compiler: gcc
|
||||||
|
# addons:
|
||||||
|
# apt:
|
||||||
|
# sources: ['ubuntu-toolchain-r-test']
|
||||||
|
# packages: ['g++-4.9', 'valgrind', 'python-pip', 'python-yaml']
|
||||||
|
# before_script:
|
||||||
|
# - pip install --user git+git://github.com/eddyxu/cpp-coveralls.git
|
||||||
|
# after_success:
|
||||||
|
# - make clean
|
||||||
|
# - touch src/json.hpp
|
||||||
|
# - make json_unit CXXFLAGS="-fprofile-arcs -ftest-coverage -std=c++11 -lstdc++" CXX=$COMPILER
|
||||||
|
# - test/json_unit "*"
|
||||||
|
# - coveralls --build-root test --exclude src/catch.hpp --exclude src/unit-algorithms.cpp --exclude src/unit-allocator.cpp --exclude src/unit-capacity.cpp --exclude src/unit-class_const_iterator.cpp --exclude src/unit-class_iterator.cpp --exclude src/unit-class_lexer.cpp --exclude src/unit-class_parser.cpp --exclude src/unit-comparison.cpp --exclude src/unit-concepts.cpp --exclude src/unit-constructor1.cpp --exclude src/unit-constructor2.cpp --exclude src/unit-convenience.cpp --exclude src/unit-conversions.cpp --exclude src/unit-deserialization.cpp --exclude src/unit-element_access1.cpp --exclude src/unit-element_access2.cpp --exclude src/unit-inspection.cpp --exclude src/unit-iterator_wrapper.cpp --exclude src/unit-iterators1.cpp --exclude src/unit-iterators2.cpp --exclude src/unit-json_patch.cpp --exclude src/unit-json_pointer.cpp --exclude src/unit-modifiers.cpp --exclude src/unit-pointer_access.cpp --exclude src/unit-readme.cpp --exclude src/unit-reference_access.cpp --exclude src/unit-regression.cpp --exclude src/unit-serialization.cpp --exclude src/unit-testsuites.cpp --exclude src/unit-unicode.cpp --include ../src/json.hpp --gcov-options '\-lp' --gcov 'gcov-4.9'
|
||||||
|
# env: COMPILER=g++-4.9
|
||||||
|
#
|
||||||
|
# - os: linux
|
||||||
|
# compiler: gcc
|
||||||
|
# before_install: echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-certificates.crt
|
||||||
|
# addons:
|
||||||
|
# apt:
|
||||||
|
# sources: ['ubuntu-toolchain-r-test']
|
||||||
|
# packages: ['g++-5', 'valgrind']
|
||||||
|
# coverity_scan:
|
||||||
|
# project:
|
||||||
|
# name: "nlohmann/json"
|
||||||
|
# description: "Build submitted via Travis CI"
|
||||||
|
# notification_email: niels.lohmann@gmail.com
|
||||||
|
# build_command_prepend: "make clean ; sudo cp $(which g++-5) $(which g++)"
|
||||||
|
# build_command: "make"
|
||||||
|
# branch_pattern: coverity_scan
|
||||||
|
# env: COMPILER=g++-5
|
||||||
|
#
|
||||||
|
|
|
@ -416,7 +416,13 @@ The following compilers are currently used in continuous integration at [Travis]
|
||||||
| GCC 4.9.3 | Ubuntu 14.04.4 LTS | g++-4.9 (Ubuntu 4.9.3-8ubuntu2~14.04) 4.9.3 |
|
| GCC 4.9.3 | Ubuntu 14.04.4 LTS | g++-4.9 (Ubuntu 4.9.3-8ubuntu2~14.04) 4.9.3 |
|
||||||
| GCC 5.3.0 | Ubuntu 14.04.4 LTS | g++-5 (Ubuntu 5.3.0-3ubuntu1~14.04) 5.3.0 20151204 |
|
| GCC 5.3.0 | Ubuntu 14.04.4 LTS | g++-5 (Ubuntu 5.3.0-3ubuntu1~14.04) 5.3.0 20151204 |
|
||||||
| GCC 6.1.1 | Ubuntu 14.04.4 LTS | g++-6 (Ubuntu 6.1.1-3ubuntu11~14.04.1) 6.1.1 20160511 |
|
| GCC 6.1.1 | Ubuntu 14.04.4 LTS | g++-6 (Ubuntu 6.1.1-3ubuntu11~14.04.1) 6.1.1 20160511 |
|
||||||
|
| Clang 3.6.0 | Ubuntu 14.04.4 LTS | clang version 3.6.0 (tags/RELEASE_360/final) |
|
||||||
|
| Clang 3.6.1 | Ubuntu 14.04.4 LTS | clang version 3.6.1 (tags/RELEASE_361/final) |
|
||||||
|
| Clang 3.6.2 | Ubuntu 14.04.4 LTS | clang version 3.6.2 (tags/RELEASE_362/final) |
|
||||||
|
| Clang 3.7.0 | Ubuntu 14.04.4 LTS | clang version 3.7.0 (tags/RELEASE_370/final) |
|
||||||
|
| Clang 3.7.1 | Ubuntu 14.04.4 LTS | clang version 3.7.1 (tags/RELEASE_371/final) |
|
||||||
| Clang 3.8.0 | Ubuntu 14.04.4 LTS | clang version 3.8.0 (tags/RELEASE_380/final) |
|
| Clang 3.8.0 | Ubuntu 14.04.4 LTS | clang version 3.8.0 (tags/RELEASE_380/final) |
|
||||||
|
| Clang 3.8.1 | Ubuntu 14.04.4 LTS | clang version 3.8.1 (tags/RELEASE_381/final) |
|
||||||
| Clang Xcode 6.1 | Darwin Kernel Version 13.4.0 (OSX 10.9.5) | Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn) |
|
| Clang Xcode 6.1 | Darwin Kernel Version 13.4.0 (OSX 10.9.5) | Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn) |
|
||||||
| Clang Xcode 6.2 | Darwin Kernel Version 13.4.0 (OSX 10.9.5) | Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn) |
|
| Clang Xcode 6.2 | Darwin Kernel Version 13.4.0 (OSX 10.9.5) | Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn) |
|
||||||
| Clang Xcode 6.3 | Darwin Kernel Version 14.3.0 (OSX 10.10.3) | Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn) |
|
| Clang Xcode 6.3 | Darwin Kernel Version 14.3.0 (OSX 10.10.3) | Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn) |
|
||||||
|
@ -504,7 +510,7 @@ To compile and run the tests, you need to execute
|
||||||
$ make check
|
$ make check
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
All tests passed (8905012 assertions in 32 test cases)
|
All tests passed (8905099 assertions in 32 test cases)
|
||||||
```
|
```
|
||||||
|
|
||||||
For more information, have a look at the file [.travis.yml](https://github.com/nlohmann/json/blob/master/.travis.yml).
|
For more information, have a look at the file [.travis.yml](https://github.com/nlohmann/json/blob/master/.travis.yml).
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
# additional flags
|
# additional flags
|
||||||
CXXFLAGS += -std=c++11 -Wall -Wextra -pedantic -Weffc++ -Wcast-align -Wcast-qual -Wno-ctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-declarations -Wmissing-include-dirs -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-overflow=5 -Wswitch -Wundef -Wno-unused -Wnon-virtual-dtor -Wreorder -Wdeprecated -Wno-keyword-macro -Wno-float-equal
|
CXXFLAGS += -std=c++11 -Wall -Wextra -pedantic -Weffc++ -Wcast-align -Wcast-qual -Wno-ctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-declarations -Wmissing-include-dirs -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-overflow=5 -Wswitch -Wundef -Wno-unused -Wnon-virtual-dtor -Wreorder -Wdeprecated -Wno-float-equal
|
||||||
CPPFLAGS += -I ../src -I .
|
CPPFLAGS += -I ../src -I .
|
||||||
|
|
||||||
SOURCES = src/unit.cpp \
|
SOURCES = src/unit.cpp \
|
||||||
|
@ -51,4 +51,4 @@ json_unit: $(OBJECTS) ../src/json.hpp src/catch.hpp
|
||||||
@$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@
|
@$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -fr json_unit $(OBJECTS)
|
rm -fr json_unit $(OBJECTS) $(SOURCES:.cpp=.gcno) $(SOURCES:.cpp=.gcda)
|
||||||
|
|
|
@ -79,18 +79,30 @@ TEST_CASE("pointer access")
|
||||||
|
|
||||||
SECTION("pointer access to const object_t")
|
SECTION("pointer access to const object_t")
|
||||||
{
|
{
|
||||||
using test_type = json::object_t;
|
using test_type = const json::object_t;
|
||||||
const json value = {{"one", 1}, {"two", 2}};
|
const json value = {{"one", 1}, {"two", 2}};
|
||||||
|
|
||||||
// this should not compile
|
|
||||||
// test_type* p1 = value.get_ptr<test_type*>();
|
|
||||||
|
|
||||||
// check if pointers are returned correctly
|
// check if pointers are returned correctly
|
||||||
|
test_type* p1 = value.get_ptr<test_type*>();
|
||||||
|
CHECK(p1 == value.get_ptr<test_type*>());
|
||||||
|
CHECK(*p1 == value.get<test_type>());
|
||||||
|
|
||||||
const test_type* p2 = value.get_ptr<const test_type*>();
|
const test_type* p2 = value.get_ptr<const test_type*>();
|
||||||
|
CHECK(p1 == value.get_ptr<const test_type*>());
|
||||||
CHECK(*p2 == value.get<test_type>());
|
CHECK(*p2 == value.get<test_type>());
|
||||||
|
|
||||||
const test_type* const p3 = value.get_ptr<const test_type* const>();
|
const test_type* const p3 = value.get_ptr<const test_type* const>();
|
||||||
CHECK(p2 == p3);
|
CHECK(p1 == value.get_ptr<const test_type* const>());
|
||||||
|
CHECK(*p3 == value.get<test_type>());
|
||||||
|
|
||||||
|
// check if null pointers are returned correctly
|
||||||
|
CHECK(value.get_ptr<const json::object_t*>() != nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::array_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::string_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::boolean_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::number_integer_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::number_unsigned_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::number_float_t*>() == nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("pointer access to array_t")
|
SECTION("pointer access to array_t")
|
||||||
|
@ -121,6 +133,34 @@ TEST_CASE("pointer access")
|
||||||
CHECK(value.get_ptr<json::number_float_t*>() == nullptr);
|
CHECK(value.get_ptr<json::number_float_t*>() == nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SECTION("pointer access to const array_t")
|
||||||
|
{
|
||||||
|
using test_type = const json::array_t;
|
||||||
|
const json value = {1, 2, 3, 4};
|
||||||
|
|
||||||
|
// check if pointers are returned correctly
|
||||||
|
test_type* p1 = value.get_ptr<test_type*>();
|
||||||
|
CHECK(p1 == value.get_ptr<test_type*>());
|
||||||
|
CHECK(*p1 == value.get<test_type>());
|
||||||
|
|
||||||
|
const test_type* p2 = value.get_ptr<const test_type*>();
|
||||||
|
CHECK(p1 == value.get_ptr<const test_type*>());
|
||||||
|
CHECK(*p2 == value.get<test_type>());
|
||||||
|
|
||||||
|
const test_type* const p3 = value.get_ptr<const test_type* const>();
|
||||||
|
CHECK(p1 == value.get_ptr<const test_type* const>());
|
||||||
|
CHECK(*p3 == value.get<test_type>());
|
||||||
|
|
||||||
|
// check if null pointers are returned correctly
|
||||||
|
CHECK(value.get_ptr<const json::object_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::array_t*>() != nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::string_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::boolean_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::number_integer_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::number_unsigned_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::number_float_t*>() == nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
SECTION("pointer access to string_t")
|
SECTION("pointer access to string_t")
|
||||||
{
|
{
|
||||||
using test_type = json::string_t;
|
using test_type = json::string_t;
|
||||||
|
@ -149,6 +189,34 @@ TEST_CASE("pointer access")
|
||||||
CHECK(value.get_ptr<json::number_float_t*>() == nullptr);
|
CHECK(value.get_ptr<json::number_float_t*>() == nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SECTION("pointer access to const string_t")
|
||||||
|
{
|
||||||
|
using test_type = const json::string_t;
|
||||||
|
const json value = "hello";
|
||||||
|
|
||||||
|
// check if pointers are returned correctly
|
||||||
|
test_type* p1 = value.get_ptr<test_type*>();
|
||||||
|
CHECK(p1 == value.get_ptr<test_type*>());
|
||||||
|
CHECK(*p1 == value.get<test_type>());
|
||||||
|
|
||||||
|
const test_type* p2 = value.get_ptr<const test_type*>();
|
||||||
|
CHECK(p1 == value.get_ptr<const test_type*>());
|
||||||
|
CHECK(*p2 == value.get<test_type>());
|
||||||
|
|
||||||
|
const test_type* const p3 = value.get_ptr<const test_type* const>();
|
||||||
|
CHECK(p1 == value.get_ptr<const test_type* const>());
|
||||||
|
CHECK(*p3 == value.get<test_type>());
|
||||||
|
|
||||||
|
// check if null pointers are returned correctly
|
||||||
|
CHECK(value.get_ptr<const json::object_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::array_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::string_t*>() != nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::boolean_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::number_integer_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::number_unsigned_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::number_float_t*>() == nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
SECTION("pointer access to boolean_t")
|
SECTION("pointer access to boolean_t")
|
||||||
{
|
{
|
||||||
using test_type = json::boolean_t;
|
using test_type = json::boolean_t;
|
||||||
|
@ -177,6 +245,34 @@ TEST_CASE("pointer access")
|
||||||
CHECK(value.get_ptr<json::number_float_t*>() == nullptr);
|
CHECK(value.get_ptr<json::number_float_t*>() == nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SECTION("pointer access to const boolean_t")
|
||||||
|
{
|
||||||
|
using test_type = const json::boolean_t;
|
||||||
|
const json value = false;
|
||||||
|
|
||||||
|
// check if pointers are returned correctly
|
||||||
|
test_type* p1 = value.get_ptr<test_type*>();
|
||||||
|
CHECK(p1 == value.get_ptr<test_type*>());
|
||||||
|
//CHECK(*p1 == value.get<test_type>());
|
||||||
|
|
||||||
|
const test_type* p2 = value.get_ptr<const test_type*>();
|
||||||
|
CHECK(p1 == value.get_ptr<const test_type*>());
|
||||||
|
//CHECK(*p2 == value.get<test_type>());
|
||||||
|
|
||||||
|
const test_type* const p3 = value.get_ptr<const test_type* const>();
|
||||||
|
CHECK(p1 == value.get_ptr<const test_type* const>());
|
||||||
|
//CHECK(*p3 == value.get<test_type>());
|
||||||
|
|
||||||
|
// check if null pointers are returned correctly
|
||||||
|
CHECK(value.get_ptr<const json::object_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::array_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::string_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::boolean_t*>() != nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::number_integer_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::number_unsigned_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::number_float_t*>() == nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
SECTION("pointer access to number_integer_t")
|
SECTION("pointer access to number_integer_t")
|
||||||
{
|
{
|
||||||
using test_type = json::number_integer_t;
|
using test_type = json::number_integer_t;
|
||||||
|
@ -205,6 +301,34 @@ TEST_CASE("pointer access")
|
||||||
CHECK(value.get_ptr<json::number_float_t*>() == nullptr);
|
CHECK(value.get_ptr<json::number_float_t*>() == nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SECTION("pointer access to const number_integer_t")
|
||||||
|
{
|
||||||
|
using test_type = const json::number_integer_t;
|
||||||
|
const json value = 23;
|
||||||
|
|
||||||
|
// check if pointers are returned correctly
|
||||||
|
test_type* p1 = value.get_ptr<test_type*>();
|
||||||
|
CHECK(p1 == value.get_ptr<test_type*>());
|
||||||
|
CHECK(*p1 == value.get<test_type>());
|
||||||
|
|
||||||
|
const test_type* p2 = value.get_ptr<const test_type*>();
|
||||||
|
CHECK(p1 == value.get_ptr<const test_type*>());
|
||||||
|
CHECK(*p2 == value.get<test_type>());
|
||||||
|
|
||||||
|
const test_type* const p3 = value.get_ptr<const test_type* const>();
|
||||||
|
CHECK(p1 == value.get_ptr<const test_type* const>());
|
||||||
|
CHECK(*p3 == value.get<test_type>());
|
||||||
|
|
||||||
|
// check if null pointers are returned correctly
|
||||||
|
CHECK(value.get_ptr<const json::object_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::array_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::string_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::boolean_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::number_integer_t*>() != nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::number_unsigned_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::number_float_t*>() == nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
SECTION("pointer access to number_unsigned_t")
|
SECTION("pointer access to number_unsigned_t")
|
||||||
{
|
{
|
||||||
using test_type = json::number_unsigned_t;
|
using test_type = json::number_unsigned_t;
|
||||||
|
@ -233,6 +357,34 @@ TEST_CASE("pointer access")
|
||||||
CHECK(value.get_ptr<json::number_float_t*>() == nullptr);
|
CHECK(value.get_ptr<json::number_float_t*>() == nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SECTION("pointer access to const number_unsigned_t")
|
||||||
|
{
|
||||||
|
using test_type = const json::number_unsigned_t;
|
||||||
|
const json value = 23u;
|
||||||
|
|
||||||
|
// check if pointers are returned correctly
|
||||||
|
test_type* p1 = value.get_ptr<test_type*>();
|
||||||
|
CHECK(p1 == value.get_ptr<test_type*>());
|
||||||
|
CHECK(*p1 == value.get<test_type>());
|
||||||
|
|
||||||
|
const test_type* p2 = value.get_ptr<const test_type*>();
|
||||||
|
CHECK(p1 == value.get_ptr<const test_type*>());
|
||||||
|
CHECK(*p2 == value.get<test_type>());
|
||||||
|
|
||||||
|
const test_type* const p3 = value.get_ptr<const test_type* const>();
|
||||||
|
CHECK(p1 == value.get_ptr<const test_type* const>());
|
||||||
|
CHECK(*p3 == value.get<test_type>());
|
||||||
|
|
||||||
|
// check if null pointers are returned correctly
|
||||||
|
CHECK(value.get_ptr<const json::object_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::array_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::string_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::boolean_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::number_integer_t*>() != nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::number_unsigned_t*>() != nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::number_float_t*>() == nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
SECTION("pointer access to number_float_t")
|
SECTION("pointer access to number_float_t")
|
||||||
{
|
{
|
||||||
using test_type = json::number_float_t;
|
using test_type = json::number_float_t;
|
||||||
|
@ -260,4 +412,32 @@ TEST_CASE("pointer access")
|
||||||
CHECK(value.get_ptr<json::number_unsigned_t*>() == nullptr);
|
CHECK(value.get_ptr<json::number_unsigned_t*>() == nullptr);
|
||||||
CHECK(value.get_ptr<json::number_float_t*>() != nullptr);
|
CHECK(value.get_ptr<json::number_float_t*>() != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SECTION("pointer access to const number_float_t")
|
||||||
|
{
|
||||||
|
using test_type = const json::number_float_t;
|
||||||
|
const json value = 42.23;
|
||||||
|
|
||||||
|
// check if pointers are returned correctly
|
||||||
|
test_type* p1 = value.get_ptr<test_type*>();
|
||||||
|
CHECK(p1 == value.get_ptr<test_type*>());
|
||||||
|
CHECK(*p1 == Approx(value.get<test_type>()));
|
||||||
|
|
||||||
|
const test_type* p2 = value.get_ptr<const test_type*>();
|
||||||
|
CHECK(p1 == value.get_ptr<const test_type*>());
|
||||||
|
CHECK(*p2 == Approx(value.get<test_type>()));
|
||||||
|
|
||||||
|
const test_type* const p3 = value.get_ptr<const test_type* const>();
|
||||||
|
CHECK(p1 == value.get_ptr<const test_type* const>());
|
||||||
|
CHECK(*p3 == Approx(value.get<test_type>()));
|
||||||
|
|
||||||
|
// check if null pointers are returned correctly
|
||||||
|
CHECK(value.get_ptr<const json::object_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::array_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::string_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::boolean_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::number_integer_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::number_unsigned_t*>() == nullptr);
|
||||||
|
CHECK(value.get_ptr<const json::number_float_t*>() != nullptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue