dota17
48ae9e8874
update pointer test case
5 years ago
Jaap Keuter
78d8e5c3d5
Properly append to CMAKE_C_FLAGS string
Contrary to other CMAKE variables the CMAKE_C_FLAGS variable is the
composed string of flags for the C compiler. It is therefore not a list
to append to. Current implementation results in these incorrect CFLAGS,
e.g., "-O2 -g -fblahblah;-UNDEBUG". Extending the CFLAGS this way
results in the proper CFLAGS, e.g., "-O2 -g -fblahblah -UNDEBUG".
5 years ago
Eric Haszlakiewicz
0819a55ffb
Undefine NDEBUG for tests - cmake version. See issue #501 .
5 years ago
Eric Haszlakiewicz
37b4da6b92
Merge pull request #501 from andy5995/iss_406-2
undefine NDEBUG for tests
5 years ago
Eric Haszlakiewicz
41f434e89f
Fix test_util_file for VS2013 too, but skip all the tests for anything older than that because the limitations are too inconvenient.
5 years ago
Eric Haszlakiewicz
b99be9cf4e
Fix up the test_util_file test for builds on Windows VS2015.
5 years ago
Eric Haszlakiewicz
7f30afc6e5
Fix some Windows compile issues, add JSON_EXPORT's, fix bogus character escapes, define __func__ and omit unistd.h if needed.
5 years ago
Eric Haszlakiewicz
bdaff94e9a
Build and run the tests as part of the cmake build.
5 years ago
Eric Haszlakiewicz
25aedddcdf
Fix memory leaks in test_double_serializer, and make sure all tests return 0 at the end of main().
5 years ago
Eric Haszlakiewicz
3d3b014971
Add a quick way (JSONC_TEST_TRACE=1) to turn on shell tracing in tests.
5 years ago
Eric Haszlakiewicz
b1ad748842
Extend test_double_serializer to check NaN and Infinity handling.
5 years ago
Eric Haszlakiewicz
baed9983b3
Add a json_object_from_fd_ex() function, to allow the max nesting depth to be specified.
5 years ago
Eric Haszlakiewicz
ac26ea9c5b
Add a test for serializing the double value -1.0.
5 years ago
Eric Haszlakiewicz
05b41b159e
Add a json_tokener_get_parse_end() function to replace direct access of tok->char_offset.
6 years ago
Eric Haszlakiewicz
087534c030
Minor cleanup of includes in a couple of tests.
6 years ago
andy5995
8799623806
undefine NDEBUG for tests
(closes #406 )
6 years ago
Eric Haszlakiewicz
4a94ddbd8b
Merge pull request #500 from andy5995/add_missing_test_deps
test/Makefile.am:add missing deps for test1 and test2
6 years ago
Eric Haszlakiewicz
68abf12afa
Issue #498 : Fix a memory leak bug introduced in test_double_serializer in 485f2a02
by adding a json_object_put call.
6 years ago
andy5995
8ab8df1170
test/Makefile.am:add missing deps for test1 and test2
Allows the tests to pass when running `make distcheck`
This fixes the 2 broken tests I mentioned at
https://github.com/json-c/json-c/pull/499#discussion_r306998261
6 years ago
Pierce Lopez
634900d270
tests: appease -Wwrite-strings
6 years ago
Eric Haszlakiewicz
485f2a02c7
Issue #486 : append a missing ".0" to negative double values too.
6 years ago
Darjan Krijan
7a9075c16b
Added test cases for spaced pretty and pretty_tab used together
6 years ago
janczer
8bd62177e7
Fixed typos
7 years ago
Eric Haszlakiewicz
da4b34355d
Add an parse test for content starting with a UTF8 BOM, which is _not_ a valid start to a JSON message.
7 years ago
Eric Haszlakiewicz
d5da847f51
PR#394: don't always append the ".0" if the double value rounds to zero because some custom formats *will* include it (e.g. %.2f).
Also try to accomodate formats to explicitly exclude the decimal (e.g. %.0f).
7 years ago
Eric Haszlakiewicz
0992aac61f
Remove the TRUE and FALSE defines.
7 years ago
Eric Haszlakiewicz
11ab365324
Deprecated a few typedefs, add docs on json_object_iter, move json_number_chars and json_hex-chars to json_object_private.h.
7 years ago
Eric Haszlakiewicz
a47eafe868
Cast to int64_t instead of long in test_int_add to fix the test on 32-bit platforms.
7 years ago
Eric Haszlakiewicz
e00a07b885
Clean up *.vg.out files too to "make distcheck" works.
7 years ago
Eric Haszlakiewicz
5dae561d33
In json_object_deep_copy(), copy over _userdata, at least for json_type_string's with the default serializer set, and provide a way for people using custom serializers to provide a custom shallow_copy method.
7 years ago
Eric Haszlakiewicz
96efeadd6e
Always build the json_object_deep_copy() code, but conditionalize running it on a --benchmark command line option.
7 years ago
Eric Haszlakiewicz
4dd92180c6
Merge branch 'json_deep_copy' of https://github.com/commodo/json-c into commodo-json_deep_copy
7 years ago
Eric Haszlakiewicz
3628f16dd6
Rename json_object_add_int() to json_object_int_inc() and eliminate the "int64" variant since we store 64-bit values internally anyway.
7 years ago
Alexandru Ardelean
1eab22f0da
tests: add test_deep_copy test
Seems to perform better than outputting to string
and re-parsing it.
BENCHMARK - 1000000 iterations of 'dst2 = json_tokener_parse(json_object_get_string(src2))' took 20 seconds
BENCHMARK - 1000000 iterations of 'dst2 = json_tokener_parse(json_object_get_string(src2))' took 7 seconds
It should make a difference on embedded systems.
The test was performed on a i5 desktop CPU [~3.5 years of age].
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
8 years ago
Eric Haszlakiewicz
91662a5b69
Merge pull request #363 from jvijtiuk/integer_addition
Issue #338 , add json_object_add_int functions
7 years ago
Eric Haszlakiewicz
9c9529f798
Update test_parse.expected to match the code.
7 years ago
Eric Haszlakiewicz
31a6c2fac8
Add a few more tests to the partial parse to cover bytes after "Infinity".
7 years ago
Eric Haszlakiewicz
ba11d334db
Save proper expected output for test_parse from the previous commit.
7 years ago
Eric Haszlakiewicz
48f7e389fb
Fix parsing of "-Infinity" when the "-" and "Infinity" are split across multiple calls.
Add several additional test cases for partial parsing of infinity values.
7 years ago
Eric Haszlakiewicz
4d1e0b4409
Issue #371 : fix parsing of "-Infinity" (although in a somewhat different location than PR#372 used), and add a case to test_parse to check for this.
7 years ago
Eric Haszlakiewicz
2a22858fe7
Add a few extra cases to test_parse to show how trailing bytes are handled, especially for parsing "Infinity".
7 years ago
Eric Haszlakiewicz
b8738dd623
Rewrite test_basic_parse() to factor out a single_basic_parse() to avoid lots of duplicate boiler plate code.
Also, emit the input string in the output so it's easier to see what's going on.
7 years ago
Eric Haszlakiewicz
e424af32b7
Fix definition of NELEM in the tests.
8 years ago
Juraj Vijtiuk
1110e84cce
Add json_object_add_int functions
8 years ago
Eric Haszlakiewicz
81f6edbfd5
PR#331: for Visual Studio, use a snprintf/vsnprintf wrapper that ensures the string is terminated.
8 years ago
Eric Haszlakiewicz
fcad0ec015
PR #336 : since we can't use function overriding (due to problems with it on
OSX) always include the _json_c_strerror function but only enable it with a flag
during tests.
8 years ago
Eric Haszlakiewicz
40317f079e
Allow USE_VALGRIND to be set to anything starting with 0, N or n to disable valgrind during tests.
8 years ago
Alexandru Ardelean
fb72160caf
build: make `strerror()` override-able
If we want to override `strerror()` in libjson-c
to make tests consistent across platforms, we
need to do it build-wide as configure/build
option.
Apple linkers make it really hard to override functions
at link-time, and this seems to be locked down on travis-ci.org
[ for security reasons I assume ].
While I got it to work locally, it did not work
when running on travis.
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
8 years ago
Alexandru Ardelean
7b9432d564
tests: fix leak in `test_util_file` ; found by cppcheck
Which now seems to fail the build.
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
8 years ago
Alexandru Ardelean
9d47ae824c
tests: compress test_utile_file with test_basic
More code compression/de-duplication.
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
8 years ago