Commit Graph

24 Commits

Author SHA1 Message Date
dota17
74bbe349c4 clang-format test1.c 2020-04-14 09:20:51 +08:00
chenguoping
110c60fcdd fix valgrind errors 2020-04-14 09:13:29 +08:00
chenguoping
76e1472808 testcase for array_list 2020-04-14 09:13:06 +08:00
dota17
8b162c4b89 clang-format the files 2020-04-03 11:39:30 +08:00
dota17
010f33d460 add json_object_new_null 2020-01-20 16:46:46 +08:00
Eric Haszlakiewicz
fd9b3b2260 Issue #332: fix a long-standing bug in array_list_put_idx() where it would attempt to free previously free'd entries due to not checking the current array length.
Add a test that triggers the problem to ensure it stays fixed.
2017-07-08 19:04:35 -07:00
Eric Haszlakiewicz
3948fcad2d Issue #300: Cast size_t values to int instead of unsigned long long to work around broken behavior of MinGW. 2017-02-05 17:00:35 +00:00
Eric Haszlakiewicz
75825a9f01 Use strdup instead of strndup in test1.c, there's no need for the latter because json_object_to_json_string_length() will always return a properly sized string. 2017-02-03 17:10:27 +00:00
Eric Haszlakiewicz
5fccfed4f4 Issue #260: add a check to prevent trivial loops in the object tree, even though it is up to the callers to avoid doing so in more complex cases. 2016-08-20 22:42:59 -04:00
Eric Haszlakiewicz
61cd433131 Merge branch 'tests' of https://github.com/RyDroid/json-c into RyDroid-tests
Conflicts:
	tests/test_util_file.c
2016-08-13 09:17:01 -04:00
Nicola Spanti (RyDroid)
8215c0ac0e Very minor changes to some tests 2016-08-13 00:53:33 +02:00
José Bollo
1fceb2207a test: add test of 'json_object_to_json_string_length'
The test is implied in test1.

The idea is to check that the returned lengths and strings
are identical to what is expected to return the already
tested function 'json_object_to_json_string_ext'.

Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-08-01 15:04:54 +02:00
Matthias Schiffer
d13cfe10f6 tests/tests1: fix printf format for size_t arguments
Change %d to %llu and add cast to unsigned long long for size_t arguments,
otherwise compilation will fail with errors like:

test1.c:70:15: error: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘size_t {aka long unsigned int}’ [-Werror=format=]

%zu is avoided to stay compatible with old libc versions (like old Visual
Studio).
2016-06-07 10:49:42 +02:00
Eric Haszlakiewicz
996be85843 Fix a few places that needed adjustment for the size_t changes, including updating the range checks to use a calculated SIZE_T_MAX. 2016-05-23 02:10:58 +00:00
Eric Haszlakiewicz
3345b25962 Add tests for the json_object_array_del_idx() function. 2016-04-30 19:09:45 +00:00
chenha0
dffdee966f Fix issue #221: JSON_C_TO_STRING_NOSLASHESCAPE works incorrectly
Tests added.
2016-01-21 20:12:48 +08:00
Eric Haszlakiewicz
316da85818 Fix issue #201: add a JSON_C_TO_STRING_NOSLASHESCAPE flag to turn off escaping of forward slashes. 2015-11-28 20:00:30 -06:00
Michael Vetter
fcf5ad1bd6 Remove trailing whitespace 2014-08-26 14:48:59 +02:00
Eric Haszlakiewicz
aec876357c Add a missing json_object_get() so we don't try to use a freed object in test1. 2012-11-29 15:06:17 -05:00
Eric Haszlakiewicz
c3d1d597ab Fix a memory leak in test1 with respect to how json_object_object_del was used. 2012-09-16 20:49:22 -05:00
Eric Haszlakiewicz
c3068bfd09 Reformat the test sources. No functional change. 2012-09-16 20:43:29 -05:00
Mateusz Loskot
271c53ebdd Missing explicit casts from void* to specific pointers required. Added #define strcasecmp for Visual C++. 2012-05-22 23:51:44 +01:00
Eric Haszlakiewicz
4c7f38eb9b Extend test1 and test2 to run using json_object_to_json_string_ext() based on an additional command line parameter.
Extend the run_output_test() function so we actually can pass command line
 parameters and so we can support different output files for the same test
 executable.
Also provide some hints about what to do if a test fails (i.e. set VERBOSE=1).
2012-04-28 14:14:26 -05:00
Eric Haszlakiewicz
1e89ba68af Create a tests subdirectory and move one of the test to there. 2012-04-22 10:27:50 -05:00