704 Commits

Author SHA1 Message Date
Steve Hanson
fe1a29ca69 fix platform-dependent compiler error with >> 2021-02-25 23:54:44 +00:00
Steve Hanson
ad73c032e7 fix compile errors 2021-02-25 22:51:35 +00:00
Steve Hanson
7698b3cd48 code and tests 2021-02-25 21:45:29 +00:00
Steve Hanson
9bb81e20ff fix crash where simple type with sub-schema has a bad value 2021-02-12 17:36:55 +00:00
Steve Hanson
167efb4fa0 work around issue 1089 2021-02-03 08:34:10 +00:00
Steve Hanson
28dc42d8d3 restore coverage 2021-01-29 19:20:01 +00:00
Steve Hanson
05e7b33977 code and tests 2021-01-28 12:11:43 +00:00
Krystian Chmura
cbf62de55d Add implicit conversion from Object and Array to Value (#1404)
Allows resolution of JSON Pointer on Object and Array
2021-01-05 14:20:57 +01:00
Xuanyi Zhou
5e50f27ed1 also initialize class member 2020-12-26 23:41:42 -05:00
Xuanyi Zhou
1e4f59d3ae add return statement & comment 2020-12-26 23:38:27 -05:00
Xuanyi Zhou
d742a030aa add body to private copy constructor & copy assignment 2020-12-26 23:27:43 -05:00
Xuanyi Zhou
13f5ab4f44 fix schema test compile error 2020-12-26 22:58:13 -05:00
Silas S. Brown
b7734d97c0 Remove unnecessary wording from BSD license not needed for MIT license (fixes #528) 2020-10-09 10:04:27 +01:00
escherstair
5fbf8bf89c fix unit test 2020-08-06 15:55:42 +02:00
escherstair
58e2964856 add unit test for clzll() 2020-08-06 14:57:39 +02:00
Lars Klein
6694c996b9 Add test case for low surrogate handling 2020-07-04 14:48:55 +02:00
xpahos
a895ce150f
Allow escaped apostrophe in values (#1639)
* Allow escaped apostrophe in values

* Allow escaped apostrophe in values

* Canonical flag name

* Add translation for escaped apostrophe

Co-authored-by: Milo Yip <miloyip@gmail.com>
2020-02-13 09:53:15 +08:00
Milo Yip
dfbe1db9da
Merge pull request #1502 from ylavic/compilation_fixes
Compilation fixes
2019-12-03 09:51:05 +08:00
Etienne Laurin
123d7c89a4 add test for non-null-terminated token 2019-09-12 08:12:06 +01:00
ylavic
92f99bc2ee RAPIDJSON_NOEXCEPT_ASSERT() should never throw.
clang warns about throwing from RAPIDJSON_NOEXCEPT_ASSERT() in a nothrow
context.

If RAPIDJSON_ASSERT() throws it can never be used for _NOEXCEPT_ASSERT(),
so use C assert() instead.

Finally (and originally), since RAPIDJSON_ASSERT() in "unittest.h" throws,
make it define RAPIDJSON_ASSERT_THROWS for RAPIDJSON_NOEXCEPT_ASSERT() to
now do the right thing.
2019-05-09 13:37:49 +02:00
Milo Yip
b56eb28575
Merge branch 'master' into pointer_less_than 2018-12-18 09:32:09 +08:00
ylavic
2ce91b823c Pointer tests now need <algorithm> (for std::swap), but no tabs. 2018-12-17 14:45:23 +01:00
ylavic
a66cf7924c Allow to (std::)Swap two pointers. 2018-12-17 14:33:32 +01:00
ylavic
eb6ee17d2d Speed up Pointer::operator<().
Speed is more important than alphabetical order (which makes few sense in
JSON in general, and with pointers especially). The use case is indexing
in std containers, i.e. O(log n) with rbtree, so the faster comparison
the better.
2018-12-12 22:32:56 +01:00
ylavic
0e34ed43f4 Rework Pointer::operator<() loop.
I must be too dumb to understand the mess MSVC (32bit only) did with the
previous loop, and to figure out how it might have make it never end.
Anyway, hopefully any compiler can grok this new loop...
2018-12-12 15:15:43 +01:00
ylavic
af17f196c6 Unit test for Pointer::operator<(). 2018-12-11 00:19:13 +01:00
Milo Yip
66eb6067b1
Merge pull request #1425 from ylavic/filereadstream_peek4
Fix off by one in FileReadStream::Peek4()
2018-12-06 23:44:10 +08:00
ylavic
38d25d7458 Fix FileReadStream::Peek4().
Until Read() reaches EOF, Peek4() must not take off by one in
bufferLast_ into account; otherwise a buffer of size exactly 4 always
returns NULL.
2018-12-06 08:38:21 +01:00
ylavic
8c14787398 Unit test for invalid GenericRegex (unclosed parenthesis). 2018-12-03 11:49:34 +01:00
Philipp A. Hartmann
0cc44c82c9
Update test/unittest/pointertest.cpp
Co-Authored-By: yhager <yhager@users.noreply.github.com>
2018-10-31 20:31:04 -07:00
Yuval Hager
a77b49dcb8 silence clang-7 self-assign-overloaded warning 2018-10-26 14:58:57 -07:00
Lele Gaifax
91d50c849d Add test case on kParseNumbersAsStringsFlag being able to load big ints
See issue #1368.
2018-10-08 10:21:25 +02:00
Milo Yip
f5f6052c56
Merge pull request #1327 from gongminmin/FixCompileInVS
Fix the compiling problems in VS
2018-09-10 11:23:26 +08:00
Milo Yip
08b1a8a41e
Merge pull request #1302 from chwarr/min-max-guard
Guard against min/max being macros in reader.h
2018-09-10 11:22:28 +08:00
Lele Gaifax
c9eabf9e13 Extend the test on issue #1336 to cover all basic types 2018-08-05 09:44:15 +02:00
Lele Gaifax
3fc9299b84 Add simple test for issue #1336 2018-08-03 12:34:03 +02:00
Veselin Georgiev
748a652f04 Fix SIGBUS due to unaligned access
Update RAPIDJSON_ALIGN() to always align on an 8-byte boundary
unless otherwise overridden.

On some platforms (such as ARM), 64-bit items (such as doubles and
64-bit integers) must be aligned to an 8 byte address, even though the
architecture is only 32-bits. On these platforms, MemoryPoolAllocator
must match the malloc() behavior and return a 8 byte aligned allocation.
This eliminates any alignment issues that may occur at the expense of
additional memory overhead.

Failure to do so caused a SIGBUS signal when calling
GenericValue::SetNull(). The size of the data_ member of the
GenericValue class is 16 bytes in 32-bit mode and its constructor
requires an 8-byte aligned access.

While parsing a JSON formatted string using Document::ParseStream(), a
stack object containing GenericValue items was constructed. Since the
stack was 8-byte aligned, the constructor calls would succeed. When the
lifetime of the object ends, SetObjectRaw() is invoked. This triggered
an allocation with 4-byte alignment to which the previously 8-byte
aligned GenericValue array was copied. After this, any call to a
GenericValue API that triggered the constructor and thus the placement
new operation on the Data type member would trigger a SIGBUS.

Signed-off-by: Veselin Georgiev <veselin.georgiev@garmin.com>
Signed-off-by: Joshua Watt <Joshua.Watt@garmin.com>
2018-07-31 09:02:26 -05:00
Minmin Gong
ff76343336 Update the code to adapt the new gtest. 2018-07-16 20:36:20 -07:00
Philipp A Hartmann
a26267d16d Fix -Wsign-conversion warnings/errors
GCC 8 (incorrectly) warns about sign conversions in (constant)
array size expressions:

error: conversion to 'long unsigned int' from 'int' may
change the sign of the result [-Werror=sign-conversion]
     char schemaBuffer_[128 * 1024];

Make these expressions unsigned by adding a 'u' suffix to
the first operands.
2018-07-15 16:01:02 +02:00
Christopher Warrington
960b9cfd19 Guard against min/max being macros in reader.h
Sometimes, particularly when Microsoft's windows.h is included, min/max
are defined as macros, interfering with use of
std::numeric_limits::min() and the like.

To guard against this, the function name is wrapped in an extra set of
parenthesis, which inhibits function-style macro expansion.

This is a similar commit to 6e38649ec6, but fixes uses of
std::numeric_limits added after that commit, like those introduced in
2ea43433e2.
2018-07-10 11:08:41 -07:00
Milo Yip
7e68aa0a21
Merge pull request #1252 from StilesCrisis/issue-1251-test
Unit Test: Parsing "128.74836467836484838364836483643636483648e-336" causes a crash
2018-06-19 12:43:54 +08:00
Milo Yip
c511ce303f
Merge pull request #1250 from StilesCrisis/issue-1249-test
Unit Test: Parsing "0e100" in full precision mode causes UB
2018-06-18 23:54:53 +08:00
abolz
7101911d9b Run all the new tests in full-precision mode only
until I know what the normal-precision algorithm really does...
2018-06-16 15:23:44 +02:00
abolz
319944a11a Disable failing test for now 2018-06-16 14:55:07 +02:00
abolz
a757a2aeb8 Add more tests
Some more need to be fixed.
2018-06-16 14:31:48 +02:00
abolz
179277817d Add a test for BigInteger::operator<< 2018-06-16 13:48:33 +02:00
abolz
a0f9c5fc46 [Debug - clean up] 2018-06-16 12:32:17 +02:00
abolz
8b98f4a782 Workaround incorrect rounding in MSVC 2018-06-16 09:40:40 +02:00
abolz
292f787c04 [Debug] 2018-06-15 15:10:50 +02:00
abolz
a78c8e3a4f Add more tests (which need to be fixed) 2018-06-15 12:59:39 +02:00