Commit graph

90 commits

Author SHA1 Message Date
Niels Lohmann 7444c7fa25
Merge pull request #2145 from FrancoisChabot/1813-user-input
Fix Issue#1813: user defined input adapters
2020-06-05 14:30:39 +02:00
Francois Chabot 5684d9a498 unified input API 2020-05-27 12:40:04 -04:00
Niels Lohmann 325e8ab8ab
🔧 explicitly switch on tests in CI 2020-05-27 13:22:14 +02:00
Niels Lohmann e7a88b2d7f
💚 fix AppVeyor and Travis builds 2020-05-03 19:33:01 +02:00
Niels Lohmann 24237af983
🎨 fix format 2020-05-03 13:40:23 +02:00
Niels Lohmann 2f0d37d7d2
🔥 remove fastcov 2020-05-02 23:48:11 +02:00
Niels Lohmann 929f5d398c
🔨 fix coverage tests 2020-05-02 23:24:21 +02:00
Niels Lohmann 752c62b4bd
🔨 remove double tests 2020-05-02 16:07:09 +02:00
Niels Lohmann bec554936c
🔨 fix paths 2020-05-02 10:56:01 +02:00
Niels Lohmann cfb2f34ebb
🔨 fix benchmarks 2020-05-01 20:59:47 +02:00
Niels Lohmann ec5cfdd307
🔨 properly find and use Git 2020-05-01 16:18:04 +02:00
Niels Lohmann 7ade3a0efb
remove dependency to FetchContent 2020-05-01 15:14:37 +02:00
Niels Lohmann dbf1a1f413
♻️ download test data from external repository 2020-05-01 14:32:37 +02:00
ArthurSonzogni c331706644 Add CMake fetchcontent documentation and tests
Github issue:
https://github.com/nlohmann/json/issues/2073

nlohmann::json documents 2 way of depending on it using CMake
1) Copy-paste the project/source into your own project.
2) Install nlohman::json and then use find_package.

(1) pollutes your git repository, (2) requires everyone to install the
dependencies themselves.

Since 2018, CMake provide some kind of 'package manager' features using
[FetchContent](https://cmake.org/cmake/help/v3.17/module/FetchContent.html)
It gives the following:
~~~cmake
include(FetchContent)

FetchContent_Declare(json
  GIT_REPOSITORY https://github.com/nlohmann/json
  GIT_TAG v3.7.3)

FetchContent_GetProperties(json)
if(NOT json_POPULATED)
  FetchContent_Populate(json)
  add_subdirectory( ${json_SOURCE_DIR} ${json_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
~~~

Then declares the dependency in the target using it:
~~~cmake
target_link_library(my_project PRIVATE nlohmann_json::nlohmann_json
~~~

This patch updates the documentation and provides tests.
2020-04-29 18:28:06 +02:00
Michael Balszun 25e0175bc3 Remove unnecessary warning suppressions in test cmake file 2019-11-19 11:26:35 +01:00
Isaac Nickaein 7e2445a0f4 Move deep JSON test to a separate unit-test 2019-11-09 21:42:39 +03:30
Thomas Braun eb6fe421ae test/CMakeLists.txt: Use an explicit list instead of GLOB
Using GLOB is slow and considered bad practice.

From https://cmake.org/cmake/help/latest/command/file.html:

> We do not recommend using GLOB to collect a list of source files from
> your source tree. If no CMakeLists.txt file changes when a source is
> added or removed then the generated build system cannot know when to ask
> CMake to regenerate. The CONFIGURE_DEPENDS flag may not work reliably on
> all generators, or if a new generator is added in the future that cannot
> support it, projects using it will be stuck. Even if CONFIGURE_DEPENDS
> works reliably, there is still a cost to perform the check on every
> rebuild.
2019-10-07 21:13:09 +02:00
Thomas Braun 9ea3e19121 .travis/cmake: Rework clang sanitizer invocation
- Switch to clang-7
- Adapt PATH so that llvm-symbolizer can be found for useful stacktraces
- Adapt compile flags
  "-O0" ensures much faster compile times
  "-fno-sanitize-recover=all
  -fsanitize-recover=unsigned-integer-overflow" this fails the build on
  all issues except unsigned integer overflows. Not failing in this case
  is required in combination with the sanitizer suppression file as only
  recoverable errors can be suppressed.

The UBSAN suppression file ignores errors from stl_bvector.h (which
holds std::vector<bool>).

Clang reports that error as

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_bvector.h:158:20 in

      Start 34: test-deserialization_all
28/88 Test #71: test-testsuites_default .............***Failed    0.32 sec
/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_bvector.h:158:20: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'unsigned int'
    #0 0x628f72 in std::_Bit_iterator_base::_M_bump_down() /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_bvector.h:158:20
    #1 0x628d16 in std::_Bit_iterator::operator--() /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_bvector.h:251:7
    #2 0x634aac in std::vector<bool, std::allocator<bool> >::pop_back() /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_bvector.h:1010:7
    #3 0x61eff0 in bool nlohmann::detail::parser<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer> >::sax_parse_internal<nlohmann::detail::json_sax_dom_parser<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer> > >(nlohmann::detail::json_sax_dom_parser<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer> >*) /home/firma/devel/json/include/nlohmann/detail/input/parser.hpp:439:28
    #4 0x604864 in nlohmann::detail::parser<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer> >::parse(bool, nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer>&) /home/firma/devel/json/include/nlohmann/detail/input/parser.hpp:116:13
    #5 0x5f8079 in nlohmann::operator>>(std::istream&, nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer>&) /home/firma/devel/json/include/nlohmann/json.hpp:6356:42
    #6 0x5e1d92 in _DOCTEST_ANON_FUNC_21() /home/firma/devel/json/test/src/unit-testsuites.cpp:343:9
    #7 0x7207fe in doctest::Context::run() /home/firma/devel/json/test/thirdparty/doctest/doctest.h:5938:21
    #8 0x72681a in main /home/firma/devel/json/test/thirdparty/doctest/doctest.h:6016:71
    #9 0x7f75d22362e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
    #10 0x4c28b9 in _start (/home/firma/devel/json/build/test/test-testsuites+0x4c28b9)

The pop_back() in parser.hpp

      assert(not states.empty());
  ->  states.pop_back();

triggers the UBSAN report. But the assertion above ensure that we only
call pop_back() on an non-empty vector, therefore this is a STL library
bug and thus must be ignored for us.
2019-09-03 13:22:03 +02:00
Thomas Braun f0bff49ffd test/CMakeLists.txt: Remove trailing whitespace 2019-09-03 13:22:03 +02:00
Niels Lohmann f0bc16d899
🔨 overworked coverage targets 2019-04-06 09:02:17 +02:00
Niels Lohmann b4b06d89b5
⬆️ updated fastcov 2019-04-06 00:24:19 +02:00
Niels Lohmann 0a1ddd6882
⬆️ updated fastcov 2019-04-05 07:54:46 +02:00
Niels Lohmann 4676f759e8
⬆️ updated fastcov 2019-04-04 09:50:27 +02:00
Niels Lohmann da279234d5
Merge branch 'develop' into feature/fastcov 2019-04-04 09:03:11 +02:00
Niels Lohmann 1f03395e2c
Merge branch 'develop' of https://github.com/nlohmann/json into develop 2019-04-03 17:28:50 +02:00
Niels Lohmann 2f9095ddab
🔨 relaxed requirements to coverage 2019-04-03 17:28:47 +02:00
Viktor Kirilov 64873fb5b8
Merge branch 'develop' into doctest 2019-03-30 23:23:33 +02:00
Niels Lohmann 53001414c7
🔨 using --exclude-gcov to exclude files 2019-03-30 17:00:30 +01:00
Niels Lohmann b12287b362
⚗️ trying fastcov 2019-03-30 09:12:32 +01:00
Niels Lohmann b21c04c938
🔥 removed unsupported flag 2019-03-29 17:34:58 +01:00
Niels Lohmann 191aa0fd6f
🔧 overworked maintaner targets 2019-03-28 14:22:48 +01:00
onqtam 0caf986505 reverted the removal of this if/else branching - this is the easiest way to get -std=c++0x support 2019-03-25 22:04:37 +02:00
Viktor Kirilov 155d196bfa
Update CMakeLists.txt 2019-03-18 17:58:35 +02:00
Viktor Kirilov 365944b0bc
Merge branch 'develop' into doctest 2019-03-18 16:59:36 +02:00
Ivor Wanders 4fd9b52fc2 Use C++11 features supported by CMake 3.1. 2019-01-16 08:50:58 -05:00
onqtam a2c074fd4d this should really fix the XCode 6/7 builds 2019-01-15 22:58:12 +02:00
onqtam 3340162efd fixing osx builds - had forgotten to define this for the object file where the test runner is compiled 2019-01-15 22:48:37 +02:00
onqtam 2f44ac1def moved from Catch to doctest for unit tests 2019-01-15 22:02:16 +02:00
Niels Lohmann 53ec0a16f3
Merge pull request #1271 from chuckatkins/cleanup-deprecated-warnings
Turn off additional deprecation warnings for GCC.
2018-10-02 22:07:18 +02:00
Chuck Atkins 829571ab5c Turn off additional deprecation warnings for GCC.
In follow up from the conversation in #1269, this adds the
`-Wno-deprecate-declarations` flag to unit tests to allow them to
test deprecated APIs without all the noisy compiler warnings.
This also refactors the setting of build properties for test targets
to use `target_<...>` commands instead of `set_target_properties()`.
2018-10-02 13:01:19 -04:00
Chuck Atkins 564506a885 cmake: add import config tests 2018-09-30 22:52:47 -04:00
Sonu Lohani b8ad3388ec Fixed compiler error in VS 2015 for debug mode
https://github.com/nlohmann/json/issues/1114
2018-06-29 09:34:41 +05:30
Niels Lohmann 09c0df4a21
👷 choosing correct image 2018-06-24 17:40:16 +02:00
Niels Lohmann d8fe13fc83
🔨 fixed escaping for MinGW 2018-06-24 16:57:53 +02:00
Niels Lohmann 495436a5d5
Merge pull request #1026 from ktonon/develop
Added public target_compile_features for auto and constexpr
2018-04-03 17:34:42 +02:00
Niels Lohmann 4efa8cdb4c
💚 fixed Valgrind options #1030 2018-03-29 17:19:21 +02:00
Kevin Tonon 73cc5089e3 Using target_compile_features to specify C++ 11 standard 2018-03-28 13:11:49 -04:00
Niels Lohmann 476b2e09be
💚 added regression tests for #972 and #977 2018-03-06 20:13:31 +01:00
Niels Lohmann 74675dd69c
back to the original version 2018-02-09 22:40:52 +01:00
Niels Lohmann ab05df3a48
🔨 another try 2018-02-09 22:27:08 +01:00