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
Patrick Boettcher
9225cf2f57
allow push_back() and pop_back() calls on json_pointer
...
Putting pop_back() to public and creating a trivial push_back()
method allows users of nlohmann::json_pointer to manipulate an
existing json-pointer by adding or removing keys at the end.
This is useful for traversing a JSON-instance and keeping track
of its "absolute path" at any moment.
In my case for a schema-validator error-handler.
2019-01-15 14:43:46 +01:00
Niels Lohmann
06731b14d7
⬆️ upgraded Catch and Google Benchmark
...
- Catch 1.12.0 -> 1.12.2
- Google Benchmark 1.3.0 -> 1.4.1
2019-01-13 11:29:39 +01:00
Isaac Nickaein
c9dd260a4c
Add unit tests for dump_integer
...
Add some unit tests for formatting integers
to keep code coverage as before.
2019-01-12 08:58:30 -08:00
Isaac Nickaein
be9b4cbd60
Add benchmark for small integers
...
This benchmark is a sample of 1 million "small" integers
in range [-1000000 1000000) sampled from uniform distribution.
2019-01-12 08:58:30 -08:00
Yann E. MORIN
e8b6b7adc1
buildsystem: relax requirement on cmake version
...
Commit 73cc5089
(Using target_compile_features to specify C++ 11
standard) bumped the required cmake version, from 3.0 to 3.8, so
as to get the definition of target_compile_features().
However, target_compile_features() was introduced in cmake-3.1:
https://cmake.org/cmake/help/v3.1/command/target_compile_features.html
And using cmake-3.1 is indeed sufficient to properly build.
As such, relax the minimum required version down to cmake-3.1,
so we can build on oldish, entreprise-grade distributions that
only have cmake-3.1 (or at least, don't have up to cmake-3.8).
Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2018-12-31 18:52:04 +01:00
Niels Lohmann
6f89613acd
🚨 fixed some warnings
2018-12-23 13:56:18 +01:00
Niels Lohmann
78348afeb6
🔖 set version to 3.5.0
2018-12-21 23:52:29 +01:00
Niels Lohmann
d584ab269a
🎨 fixed header
2018-12-20 21:58:16 +01:00
Niels Lohmann
45a8a093d7
🚨 fixed a warning
2018-12-20 21:40:47 +01:00
Niels Lohmann
85849940ba
Merge pull request #1391 from pratikpc/develop
...
Added Support for Structured Bindings
2018-12-20 08:58:08 +01:00
Pratik Chowdhury
ebd3f45808
Added Support for Structured Bindings
...
For further details, read https://github.com/nlohmann/json/issues/1388 and https://blog.tartanllama.xyz/structured-bindings/
2018-12-19 20:17:52 +05:30
Niels Lohmann
5d390e91ff
Merge pull request #1392 from mtalliance/feature/addFileInputAdapter
...
Feature/add file input adapter
2018-12-16 22:10:03 +01:00
Jonathan Dumaresq
635a4fc344
use namespace std when possible. Change the name of private variable.
2018-12-12 16:33:25 -05:00
Jonathan Dumaresq
a794cfdba3
refactor unit test in case of throw, the fclose will not be called. using unique_ptr with custom destructor will ensure that
2018-12-12 14:46:17 -05:00
Jonathan Dumaresq
ef283e0cf8
add tests to cover the new input adapter
2018-12-12 10:18:37 -05:00
mefyl
aa10382629
Set eofbit on exhausted input stream.
...
Fix issue #1340 .
The eofbit is set manually since we don't go through the
stream interface. We could maybe use the stream interface
instead, but there are some assumptions regarding which
exception go through, so this seems to be the most prudent
approach for now.
2018-11-08 11:41:17 +01:00
Niels Lohmann
2f73a4d1f3
🚨 fixed a linter warning
2018-10-31 20:30:24 +01:00
Niels Lohmann
7b2f8cce03
🔖 set version to 3.4.0
2018-10-30 21:30:20 +01:00
Niels Lohmann
39419cd5c4
🚨 fixed another linter warning
2018-10-29 18:51:30 +01:00
Niels Lohmann
f0c1459554
🐛 fixed a bug parsing BSON strings #1320
2018-10-28 09:16:40 +01:00
Niels Lohmann
45a761bd60
Merge branch 'develop' of https://github.com/nlohmann/json into develop
2018-10-27 18:31:06 +02:00
Niels Lohmann
4e765596f7
🔨 small improvements
2018-10-27 18:31:03 +02:00
Niels Lohmann
85aaf91b85
Merge branch 'develop' into feature/enum_json_mapping
2018-10-27 16:52:59 +02:00
Niels Lohmann
ad639ad5e6
✨ added NLOHMANN_JSON_SERIALIZE_ENUM marco #1208
2018-10-26 14:48:20 +02:00
Niels Lohmann
d97fa30795
👌 fixed comment #1320
2018-10-25 22:29:27 +02:00
Niels Lohmann
19647e083c
🚨 fixed compiler warnings
2018-10-25 14:27:55 +02:00
Niels Lohmann
62126278a6
🔨 added fix for arrays
2018-10-25 13:01:18 +02:00
Niels Lohmann
1968e5c793
🎨 clean up binary formats
2018-10-24 23:39:30 +02:00
Niels Lohmann
4d1eaace8c
🔨 fixed fuzz code to avoid false positives in case of discarded values
2018-10-24 18:55:08 +02:00
Niels Lohmann
e2c5913a50
🚧 some changes to the BSON code
...
- added fuzz testers
- added some reference files
- made an exception text more clear
2018-10-24 15:43:37 +02:00
Niels Lohmann
bba159121f
Merge branch 'feature/bson' of https://github.com/julian-becker/json into julian-becker-feature/bson
2018-10-24 15:03:15 +02:00
Niels Lohmann
7b501de054
Merge pull request #1314 from nlohmann/feature/codec_errors
...
Allow to set error handler for decoding errors
2018-10-24 08:40:58 +02:00
Niels Lohmann
2343d9caeb
💚 additional tests from the Unicode spec #1198
...
Thanks @abolz!
2018-10-23 17:22:13 +02:00
Niels Lohmann
951a7a6455
🚧 fixed test cases #1198
2018-10-22 18:20:45 +02:00
Niels Lohmann
c51b1e6fab
🚧 fixed an issue with ensure_ascii #1198
2018-10-22 15:53:36 +02:00
Niels Lohmann
c7af027cbb
🚧 respect ensure_ascii parameter #1198
2018-10-22 09:18:16 +02:00
Niels Lohmann
e5dce64115
💚 added tests #1198
...
Test every prefix of Unicode sequences against the different dump functions.
2018-10-21 23:26:25 +02:00
Niels Lohmann
c5821d91e5
🚧 overworked error handlers #1198
2018-10-21 11:49:37 +02:00
Julian Becker
ad11b6c35e
BSON: Improved exception-related tests and report location of U+0000 in the key-string as part of out_of_range.409
-message
2018-10-18 20:05:46 +02:00
Niels Lohmann
9294e25c98
Merge pull request #1301 from theodelrieu/fix/1299
...
add new is_constructible_* traits used in from_json
2018-10-18 19:18:48 +02:00
Julian Becker
5ba812d518
BSON: fixed incorrect casting in unit-bson.cpp
2018-10-18 06:38:34 +02:00
Julian Becker
2a63869159
Merge branch 'develop' of https://github.com/nlohmann/json into feature/bson
...
Conflicts:
include/nlohmann/detail/input/binary_reader.hpp
single_include/nlohmann/json.hpp
src/unit-bson.cpp
2018-10-17 20:26:00 +02:00
Niels Lohmann
dbb0b63187
♿ improved error messages for binary formats #1288
...
This commit is the equivalent of #1282 for CBOR, MessagePack, and UBJSON.
2018-10-17 12:15:58 +02:00
Julian Becker
978c3c4116
BSON: throw json.exception.out_of_range.409
in case a key to be serialized to BSON contains a U+0000
2018-10-16 20:42:00 +02:00
Julian Becker
5bccacda30
BSON: throw json.exception.out_of_range.407 in case a value of type std::uint64_t
is serialized to BSON. Also, added a missing EOF-check to binary_reader.
2018-10-16 19:13:07 +02:00
Théo DELRIEU
45c8af2c46
add new is_constructible_* traits used in from_json
...
is_compatible_* traits were used in from_json, but it made no sense
whatsoever.
It used to work because of non-SFINAE correctness + json_ref
unconstrained variadic template constructor.
SFINAE checks are becoming quite complex, we need a specification of
some sort describing:
* which concepts the library uses
* how the conversion to/from json works in detail
Having such a specification would really help simplifying the current
code (as well as having meaningful checks).
Fixes !1299
2018-10-16 14:00:34 +02:00
Théo DELRIEU
11fecc25af
add constraints for variadic json_ref constructors
...
Fixes #1292
2018-10-12 10:54:58 +02:00
Niels Lohmann
74a31075e3
♿ improved parse error messages
2018-10-07 22:39:17 +02:00
Julian Becker
df0f612d1b
BSON: allow and discard values and object entries of type value_t::discarded
2018-10-07 20:08:05 +02:00
Julian Becker
062aeaf7b6
BSON: Reworked the binary_writer
such that it precomputes the size of the BSON-output.
...
This way, the output_adapter can work on simple output iterators and no longer requires random access iterators.
2018-10-07 18:02:51 +02:00
Niels Lohmann
6d09cdec34
🐛 fixed a bug in the unget function
2018-10-07 16:48:45 +02:00
Niels Lohmann
011b15dd08
♿ added line positions to error messages
...
This is a follow-up to #1210 .
2018-10-07 12:27:24 +02:00
Julian Becker
81f4b34e06
BSON: Improved documentation and error handling/reporting
2018-10-07 09:57:55 +02:00
Niels Lohmann
b968faa882
🔖 set version to 3.3.0
2018-10-05 10:59:33 +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
Niels Lohmann
c8231eff75
Merge pull request #1260 from chuckatkins/fix-cmake-target-alias
...
Fix broken cmake imported target alias
2018-10-01 17:44:50 +02:00
Chuck Atkins
564506a885
cmake: add import config tests
2018-09-30 22:52:47 -04:00
Niels Lohmann
1fae82b7a7
Merge branch 'develop' into fix/1237
2018-09-29 14:50:36 +02:00
Niels Lohmann
d26f39466e
Merge pull request #1231 from theodelrieu/feature/get_with_parameter
...
Add a get overload taking a parameter.
2018-09-29 14:30:04 +02:00
knilch
8c1387cfb3
unit-testsuites.cpp: fix hangup if file not found
...
If run from the wrong directory, std::ifstream f("test/data/big-list-of-naughty-strings/blns.json"); will not find the file and thus f.eof() will never return true.
Use canonical C++ file reading loop from https://gehrcke.de/2011/06/reading-files-in-c-using-ifstream-dealing-correctly-with-badbit-failbit-eofbit-and-perror/ instead.
2018-09-28 11:33:23 +02:00
Théo DELRIEU
521fe49fec
Add basic_json::get_to function.
...
Takes an lvalue reference, and returns the same reference.
This allows non-default constructible types to be converted without
specializing adl_serializer.
This overload does not require CopyConstructible either.
Implements #1227
2018-09-28 11:25:23 +02:00
Henry Fredrick Schreiner
7a37ba0c02
Adding 4.8 test to travis
2018-09-27 22:31:39 +02:00
Julian Becker
ef358ae695
BSON: Fixed hangup in case of incomplete bson input and improved test coverage
2018-09-25 20:34:25 +02:00
Julian Becker
bce4816275
BSON: Added test case for the different input/output_adapters
2018-09-24 23:35:19 +02:00
Julian Becker
763705c2a7
Fix: Add missing begin()
and end()
member functions to alt_string
2018-09-24 19:50:28 +02:00
Théo DELRIEU
4e52277b70
Fix issue #1237
...
* Make the conversion operator SFINAE correct.
* Workaround a GCC bug with some traits in type_traits.hpp
The first bullet-point implies that every `get`/`get_ptr` be SFINAE
correct as well.
2018-09-20 10:33:14 +02:00
Ben Berman
8f07ab6392
Replace "key-style argument" with "string argument"
2018-09-17 15:36:38 -04:00
Julian Becker
df33a90774
BSON: Bugfix for non-empty arrays
2018-09-15 14:08:38 +02:00
Julian Becker
cf485c2907
BSON: Support for arrays
2018-09-15 13:54:08 +02:00
Julian Becker
120d1d77d4
BSON: test case for a more complex document
2018-09-15 13:41:05 +02:00
Julian Becker
5ce7d6bdd7
BSON: support objects with objects as members
2018-09-15 13:03:42 +02:00
Julian Becker
83b427ad67
BSON: unsigned integers
2018-09-15 12:20:30 +02:00
Julian Becker
c0d8921a67
BSON: support objects with int64 members
2018-09-15 12:00:53 +02:00
Julian Becker
7ee361f7ad
BSON: support objects with int32 members
2018-09-15 11:54:17 +02:00
Julian Becker
c5ef023171
BSON: support objects with null members
2018-09-15 11:39:12 +02:00
Julian Becker
6c447de076
BSON: Support objects with string members
2018-09-15 11:33:24 +02:00
Julian Becker
0c0f2e44b5
BSON: support doubles
2018-09-15 10:32:03 +02:00
Julian Becker
9a0dddc5d2
BSON: Object with single boolean
2018-09-15 03:08:50 +02:00
Julian Becker
5f5836ce1c
BSON: Support empty objects
2018-09-15 00:43:39 +02:00
Julian Becker
f06c8fd8e3
BSON: serialization of non-objects is not supported
2018-09-15 00:20:03 +02:00
Niels Lohmann
ebb3c03293
🎨 cleanup after #1228
2018-09-09 18:19:33 +02:00
Théo DELRIEU
4b4bbceebf
make from_json SFINAE-correct
2018-09-07 14:10:37 +02:00
Ben Berman
ad053ef09c
Fix tests for improved error 305(hopefully)
2018-08-30 13:21:55 -04:00
Niels Lohmann
9f3857ef6f
🔖 set version to 3.2.0
2018-08-18 18:46:15 +02:00
Niels Lohmann
5ad52f4167
⬆️ Catch 1.12.0
2018-08-18 12:02:12 +02:00
Niels Lohmann
57faaf42ca
🚨 fixed a compiler warning
2018-08-18 08:15:03 +02:00
Niels Lohmann
e33b31e6aa
🐛 fixed callback-related issue ( https://github.com/nlohmann/json/issues/971#issuecomment-413678360 )
2018-08-17 23:09:45 +02:00
Niels Lohmann
07494e06d7
🚨 fixed some compiler warnings
2018-08-16 18:20:30 +02:00
Théo DELRIEU
38f8a51a8f
use abstract sax class in parser tests
2018-08-16 11:59:49 +02:00
Théo DELRIEU
9bbb133094
remove no_limit constant and default values
2018-08-16 11:59:05 +02:00
Théo DELRIEU
442886d040
use templates in the sax interface instead of virtuals
2018-08-16 11:58:52 +02:00
Théo DELRIEU
f6febbe359
split meta.hpp, add detected_t (used to define concepts)
2018-08-16 11:58:42 +02:00
Niels Lohmann
fed70f6bff
🎨 reindented code
2018-08-14 22:11:08 +02:00
Michael Gmelin
05b27e83b7
Exclude bytewise comparison in certain tests.
...
These tests never worked - they weren't run before
d5aaeb4
.
Note that these tests would fail because of this library
ordering dictionary keys (which is legal). So changing the
input files (or modifying stored cbor/msgpack/ubjson files)
would make the tests work and they could get removed from
"exclude_packaged".
Also move parsing of files in these unit tests to within
the inner sections, so that they're only parsed
number_of_files * number_of_sections instead of
number_of_files * number_of_files * number_of_sections
(so, instead of close to 100k parses about 700).
2018-07-29 14:52:52 +02:00
Michael Gmelin
d5aaeb4cce
Make section names unique in loops, as catch doesn't support duplicate
...
sections, see also https://github.com/catchorg/Catch2/issues/816#issuecomment-278268122
As a result, when built with gcc, loop iterations were skipped. When
built with clang, the test aborted with an assertion in catch.hpp
line 6222.
This also addresses the issues discussed here:
https://github.com/nlohmann/json/issues/1032#issuecomment-378707696
and here:
https://github.com/catchorg/Catch2/issues/1241
Please note that this introduces new problems, as some of
the unit tests fail now - the library stores keys in
lexographical order, while the cbor/msgpack/ubjson examples
store them in original order.
2018-07-29 10:44:36 +02:00