Commit Graph

134 Commits

Author SHA1 Message Date
Krzysiek Karbowiak
ce35256825 Refactor unit tests to use more convenient doctest assertion macros (#3393)
* Add missing check

* Refactor assertions in unit-algorithms.cpp

* Refactor assertions in unit-bson.cpp

* Refactor assertions in unit-cbor.cpp

* Refactor assertions in unit-class_const_iterator.cpp

* Refactor assertions in unit-class_iterator.cpp

* Refactor assertions in unit-class_parser.cpp

* Refactor assertions in unit-constructor1.cpp

* Refactor assertions in unit-convenience.cpp

* Refactor assertions in unit-conversions.cpp

* Refactor assertions in unit-deserialization.cpp

* Refactor assertions in unit-element_access1.cpp

* Refactor assertions in unit-element_access2.cpp

* Refactor assertions in unit-iterators1.cpp

* Refactor assertions in unit-iterators2.cpp

* Refactor assertions in unit-json_patch.cpp

* Refactor assertions in unit-json_pointer.cpp

* Refactor assertions in unit-modifiers.cpp

* Refactor assertions in unit-msgpack.cpp

* Refactor assertions in unit-reference_access.cpp

* Refactor assertions in unit-regression1.cpp

* Refactor assertions in unit-serialization.cpp

* Refactor assertions in unit-ubjson.cpp

* Refactor assertions in unit-unicode1.cpp

* Apply formatting
2022-03-24 15:55:35 +01:00
Florian Albrechtskirchinger
ad103e5b45 Improve unit testing (Part 1) (#3380)
* Refactor unit test creation

Add functions for creating tests and to supply test- and
standard-specific build settings.

Raises minimum CMake version to 3.13 in test directory.

json_test_add_test_for(
    <file>
    MAIN <main>
    [CXX_STANDARDS <version_number>...] [FORCE])

Given a <file> unit-foo.cpp, produces

    test-foo_cpp<version_number>

if C++ standard <version_number> is supported by the compiler and
thesource file contains JSON_HAS_CPP_<version_number>.  Use FORCE to
create the test regardless of the file containing
JSON_HAS_CPP_<version_number>.  Test targets are linked against <main>.
CXX_STANDARDS defaults to "11".

json_test_set_test_options(
    all|<tests>
    [CXX_STANDARDS all|<args>...]
    [COMPILE_DEFINITIONS <args>...]
    [COMPILE_FEATURES <args>...]
    [COMPILE_OPTIONS <args>...]
    [LINK_LIBRARIES <args>...]
    [LINK_OPTIONS <args>...])

Supply test- and standard-specific build settings.
Specify multiple tests using a list e.g., "test-foo;test-bar".

Must be called BEFORE the test is created.

* Use CMAKE_MODULE_PATH

* Don't undef some macros if JSON_TEST_KEEP_MACROS is defined

* Use JSON_TEST_KEEP_MACROS

Incidentally enables the regression tests for #2546 and #3070.

A CHECK_THROWS_WITH_AS in #3070 was disabled which is tracked in #3377
and a line in from_json(..., std_fs::path&) was marked with LCOV_EXCL_LINE.

* Add three-way comparison feature test macro

* Disable broken comparison if JSON_HAS_THREE_WAY_COMPARISON

* Fix redefinition of inline constexpr statics

Redelcaration of inline constexpr static data members in namespace scope
was deprecated in C++17. Fixes -Werror=deprecated compilation failures.

* Fix more test build failures due to missing noexcept

* CI: update cmake_flags test to use CMake 3.13 in test directory

Also change default for JSON_BuildTests option to depend on CMake
version.

* CI: turn *_CXXFLAGS into CMake lists

* CI: use JSON_TestStandards to set CXX_STANDARD

* CI: pass extra CXXFLAGS to standards tests
2022-03-24 07:54:07 +01:00
Niels Lohmann
b5364faf9d 🔖 set version to 3.10.5 2022-01-02 22:35:35 +01:00
Niels Lohmann
6d3115924c Add C++17 copies of the test binaries (#3101)
* ⚗️ add C++17 copies of the test binaries
* ⚗️ use proper header for filesystem
* 🚨 fix warnings
* ⚗️ do not use too old compilers with C++17
*  add test
* 🔨 add more constraints #3097
* ⚗️ use fix from https://github.com/nlohmann/json/pull/3101#issuecomment-998788786
* ⚗️ use fix from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90050
* 👷 use published CI image
2021-12-29 09:47:05 +01:00
Niels Lohmann
a09bfa5faa 🔖 set version to 3.10.4 2021-10-16 13:34:31 +02:00
Niels Lohmann
ab6a2c7425 🔖 set version to 3.10.3 2021-10-08 13:58:48 +02:00
Niels Lohmann
33b674b4b2 🔖 set version to 3.10.2 2021-08-26 08:13:04 +02:00
Niels Lohmann
8ad66e9136 🔖 set version to 3.10.1 2021-08-24 20:19:55 +02:00
Niels Lohmann
1de378f580 🔖 set version to 3.10.0 2021-08-17 15:23:23 +02:00
Niels Lohmann
346c9c1a19 💚 fix MSVC build 2021-08-07 13:37:17 +02:00
Niels Lohmann
176e9bf0ab add tests for CBOR 2021-08-07 13:14:08 +02:00
Niels Lohmann
89c98dfc20 add option to process binary subtypes in CBOR 2021-08-06 16:41:01 +02:00
Niels Lohmann
51a9880022 add tests for CBOR 2021-08-06 15:31:11 +02:00
Sven Fink
3f5545f99b Remove -Wfloat-equal suppressions on tests 2021-08-04 09:14:45 +02:00
Niels Lohmann
6f551930e5 🚨 add new CI and fix warnings (#2561)
* ⚗️ move CI targets to CMake
* ♻️ add target for cpplint
* ♻️ add target for self-contained binaries
* ♻️ add targets for iwyu and infer
* 🔊 add version output
* ♻️ add target for oclint
* 🚨 fix warnings
* ♻️ rename targets
* ♻️ use iwyu properly
* 🚨 fix warnings
* ♻️ use iwyu properly
* ♻️ add target for benchmarks
* ♻️ add target for CMake flags
* 👷 use GitHub Actions
* ⚗️ try to install Clang 11
* ⚗️ try to install GCC 11
* ⚗️ try to install Clang 11
* ⚗️ try to install GCC 11
* ⚗️ add clang analyze target
* 🔥 remove Google Benchmark
* ⬆️ Google Benchmark 1.5.2
* 🔥 use fetchcontent
* 🐧 add target to download a Linux version of CMake
* 🔨 fix dependency
* 🚨 fix includes
* 🚨 fix comment
* 🔧 adjust flags for GCC 11.0.0 20210110 (experimental)
* 🐳 user Docker image to run CI
* 🔧 add target for Valgrind
* 👷 add target for Valgrind tests
* ⚗️ add Dart
*  remove Dart
* ⚗️ do not call ctest in test subdirectory
* ⚗️ download test data explicitly
* ⚗️ only execute Valgrind tests
* ⚗️ fix labels
* 🔥 remove unneeded jobs
* 🔨 cleanup
* 🐛 fix OCLint call
*  add targets for offline and git-independent tests
*  add targets for C++ language versions and reproducible tests
* 🔨 clean up
* 👷 add CI steps for cppcheck and cpplint
* 🚨 fix warnings from Clang-Tidy
* 👷 add CI steps for Clang-Tidy
* 🚨 fix warnings
* 🔧 select proper binary
* 🚨 fix warnings
* 🚨 suppress some unhelpful warnings
* 🚨 fix warnings
* 🎨 fix format
* 🚨 fix warnings
* 👷 add CI steps for Sanitizers
* 🚨 fix warnings
*  add optimization to sanitizer build
* 🚨 fix warnings
* 🚨 add missing header
* 🚨 fix warnings
* 👷 add CI step for coverage
* 👷 add CI steps for disabled exceptions and implicit conversions
* 🚨 fix warnings
* 👷 add CI steps for checking indentation
* 🐛 fix variable use
* 💚 fix build
*  remove CircleCI
* 👷 add CI step for diagnostics
* 🚨 fix warning
* 🔥 clean Travis
2021-03-24 07:15:18 +01:00
Niels Lohmann
c026e1a475 🚨 fix warnings 2020-12-16 21:44:35 +01:00
Niels Lohmann
b3e5cb7f20 🔖 set version to 3.9.1 2020-08-06 13:45:29 +02:00
Niels Lohmann
e110667d21 🔖 set version to 3.9.0 2020-07-27 15:48:09 +02:00
Niels Lohmann
e22cbacc41 🚨 fix warning 2020-07-26 12:12:17 +02:00
Niels Lohmann
40b78d3847 Merge pull request #2308 from nlohmann/cbor_tags
Fix bug in CBOR tag handling
2020-07-25 19:43:11 +02:00
Niels Lohmann
480ad529e3 🐛 fix bug in CBOR tag handling 2020-07-24 14:18:39 +02:00
Niels Lohmann
e571c67c0d 🚨 fix implicit conversion warning when opening binary file 2020-07-23 14:02:12 +02:00
Niels Lohmann
a048b72fe1 Merge pull request #1559 from theodelrieu/feat/explicit_conversion_operator
Feat/explicit conversion operator
2020-07-23 08:52:51 +02:00
Théo DELRIEU
74b446f5fd add a switch to enable implicit conversions (defaults to true)
wrap implicit conversions tests around the JSON_USE_IMPLICIT_CONVERSIONS
macro
2020-07-22 10:49:01 +02:00
Niels Lohmann
8b14c9b305 🚨 fix warnings 2020-07-21 23:00:56 +02:00
Niels Lohmann
a10d486e36 Merge pull request #2244 from matthewbauer/tag-cbor
Tag binary values in cbor if set
2020-07-17 14:05:48 +02:00
Niels Lohmann
93cdf05928 add tests 2020-07-15 14:23:22 +02:00
Matthew Bauer
dd08f7705f Add simple test for cbor byte 2020-07-06 18:06:10 -04:00
Niels Lohmann
ac3922c7aa Merge branch 'develop' of https://github.com/nlohmann/json into clang_windows
 Conflicts:
	include/nlohmann/detail/input/binary_reader.hpp
	include/nlohmann/detail/input/input_adapters.hpp
	include/nlohmann/detail/input/lexer.hpp
	include/nlohmann/detail/output/binary_writer.hpp
	include/nlohmann/json.hpp
	single_include/nlohmann/json.hpp
2020-06-27 13:14:48 +02:00
Niels Lohmann
5f862710fe 🔖 set version to 3.8.0 2020-06-14 17:16:45 +02:00
Niels Lohmann
65c4b07451 🎨 replace alternative operators (and, not, or) 2020-06-03 21:22:07 +02:00
Niels Lohmann
a82c80e9af Merge pull request #2125 from nlohmann/binary_type
Clean up implementation of binary type
2020-05-20 18:58:29 +02:00
Niels Lohmann
21b1680ea1 🚚 rename binary_array() to binary() 2020-05-19 13:30:22 +02:00
Niels Lohmann
b7ff40029a 💥 change serialization of binary values 2020-05-18 13:53:20 +02:00
gistrec
9e765f5aed Fixed std::numeric_limit::max() call 2020-05-18 10:25:55 +00:00
Niels Lohmann
28e20bd9e4 🚨 fix warnings #2113 2020-05-16 14:26:17 +02:00
chenguoping
ed9c205b5d add somes test cases 2020-05-15 21:48:29 +08:00
chenguoping
779a0ec7df update 2020-05-15 17:35:43 +08:00
chenguoping
47c6570470 Add some test cases about to_cbor() 2020-05-14 15:11:38 +08:00
Niels Lohmann
fff46ea98c add tests for binary type 2020-05-09 23:18:12 +02:00
Niels Lohmann
f0c6ab4d3b 🐛 fix bug in SAX callback parser 2020-05-08 14:21:11 +02:00
Niels Lohmann
2b39efd545 add tests for binary type 2020-05-05 12:59:57 +02:00
Niels Lohmann
dbf1a1f413 ♻️ download test data from external repository 2020-05-01 14:32:37 +02:00
Michael Reilly
012c9665ac Add binary type support to all binary file formats, as well as an internally represented binary type 2020-04-14 10:22:45 -04:00
Niels Lohmann
c5eafe74e8 🔖 set version to 3.7.3 2019-11-17 12:09:12 +01:00
Niels Lohmann
56109eacd7 🔖 set version to 3.7.2 2019-11-10 21:23:39 +01:00
Niels Lohmann
aacdc6bbe3 🔖 set version to 3.7.1 2019-11-06 18:37:26 +01:00
Niels Lohmann
dfe53c36da 🚨 fix UBSAN warnings 2019-11-03 13:48:25 +01:00
Florian Pigorsch
b93d414a35 Fix some spelling errors - mostly in comments & documentation.
I did not touch the Changelog file and any third party stuff.

additonal -> additional (1)
apppend -> append (2)
constuctor -> constructor (2)
contect -> context (2)
dobulequote -> doublequote (1)
elemnts -> elements (1)
exakt -> exact (2)
exluded -> exclude (1)
explicitely -> explicitly (2)
narcissic -> narcissistic (1)
ocurred -> occurred (1)
occuring -> occurring (2)
preceeds -> preceded (1)
ot -> to (2)
wehther -> whether (2)
2019-10-19 11:59:51 +02:00
Niels Lohmann
48e1fe03b5 🔖 set version to 3.7.0 2019-07-28 20:20:41 +02:00