Commit Graph

25 Commits

Author SHA1 Message Date
Petri Lehtinen
5406c2b3d3 load: Check for integer and real overlfows and underflows 2009-09-13 13:18:01 +03:00
Petri Lehtinen
9d16ec755c test/json-compare.py: Use json module from Python >=2.6 or simplejson 2009-09-11 22:22:34 +03:00
Petri Lehtinen
04d550b02e Add stripped unit tests for decoder
That is, test cases where there's no newline or other whitespace at
the beginning or end of input. This was implemented by adding a
--strip option to split-testfile to strip the input file after writing
it.

The actual test JSON texts are the same as testdata/invalid and
testdata/valid. The expected output of the invalid cases had to be
adjusted a bit: because there's no newline at the end, some of the
line numbers needed to be changed.
2009-09-08 17:03:01 +03:00
Petri Lehtinen
c288188a0f test/.gitignore: Add testprogs/test_simple 2009-09-07 21:25:22 +03:00
Petri Lehtinen
234ee47281 Better argument validation
All pointer arguments are now tested for NULL. json_string() now also
tests that strdup() succeeds. This is to ensure that no NULL values
end up in data structures.

Also desribe the different sources of errors in documentation.
2009-09-06 22:24:55 +03:00
Petri Lehtinen
6ffb04f0d4 Expand test coverage
Now all public API functions are tested (at least on some level) in
the test-api suite.
2009-09-06 14:06:02 +03:00
Petri Lehtinen
89d09813c3 Add reference stealing functions for inserting values to objects and arrays
The non-stealing functions are now just simple wrappers around these.
2009-09-04 09:52:37 +03:00
Petri Lehtinen
390b0ba633 Distribute appropriate files 2009-08-25 21:48:34 +03:00
Petri Lehtinen
bf0d383961 test: Add Makefile.am to test/testprogs
This way it's an individual subdirectory and things go easier.
2009-08-25 21:23:26 +03:00
Petri Lehtinen
6e17271fa9 Add some missing copyright notices 2009-08-25 17:50:41 +03:00
Petri Lehtinen
ee2d164025 Detect garbage near EOF in json_loadf() and json_load_file() 2009-08-24 20:58:59 +03:00
Petri Lehtinen
b3e265eb84 Add test for numbers 2009-08-24 20:54:40 +03:00
Petri Lehtinen
0565988d12 Expand value test coverage 2009-08-23 13:34:12 +03:00
Petri Lehtinen
c21ade41e0 run-test: Don't remove all testlogs when starting a new test suite 2009-08-23 13:34:12 +03:00
Petri Lehtinen
2f4d6f8ae7 Add LICENSE and a copyright note to all sources 2009-07-30 11:32:24 +03:00
Petri Lehtinen
f41e380984 Rename json_{load,dump} to json_{load,dump}_file 2009-07-28 10:58:13 +03:00
Petri Lehtinen
b348519e96 Fix some memory leaks and invalid memory references 2009-07-28 10:38:21 +03:00
Petri Lehtinen
f60c563bab Enhance test system
- Tests are now named
- Testlogs are preserved between runs
- Tests can be run through Valgrind Memcheck tool
2009-07-28 10:36:16 +03:00
Petri Lehtinen
d3b3055a34 Expand encoder test coverage 2009-07-26 21:51:45 +03:00
Petri Lehtinen
20efe4aa26 Expand parser and Unicode test coverage 2009-07-26 11:31:25 +03:00
Petri Lehtinen
9240146c10 Implement support for \u escapes 2009-07-16 09:58:23 +03:00
Petri Lehtinen
df307f1bc3 Report errors from lexical and stream level in parser
Before, only the syntax level (parse_*) was able to set the error
string. This patch fixes the situation so that lexical (lex_*) and
stream (stream_*) levels can report detailed error messages.

Also, instead of 0, EOF is now returned by stream on error.
2009-07-14 00:24:39 +03:00
Petri Lehtinen
625f50f916 Streamify the loader
It's no longer needed to load the whole input into a string and then
parse from the string. Instead, the input is read as needed from
a string or file.
2009-07-13 21:45:16 +03:00
Petri Lehtinen
4c414bdd6d Get rid of json_dumpfd and json_loadfd
fdopen() makes supporting separate API for file descriptors useless.
Supporting fd's also makes Jansson less portable.
2009-07-13 21:45:16 +03:00
Petri Lehtinen
8ef778c843 Add some tests 2009-07-09 21:01:40 +03:00