aboutsummaryrefslogtreecommitdiff
path: root/tests (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove redundant comment from test.luaMark Pulford2011-12-311-7/+0
|
* Remove "update_locale" Lua functionMark Pulford2011-12-311-2/+2
| | | | | | | Only update the locale when the module is initialised. cjson.new() can be used if the locale changes part way through program execution.
* Add support for Lua 5.2 and cjson.newMark Pulford2011-12-305-16/+16
| | | | | | | | | | | | | | Update all Lua scripts to use new module init style everywhere: local json = require "cjson" Lua CJSON does not register a global table under Lua 5.2. The global table can be disabled under Lua 5.1 with DISABLE_CJSON_GLOBAL. Other changes: - Store CJSON configuration as an upvalue for each function. - Add "cjson.new" function to create another module table with a separate configuration. - Add _NAME and _VERSION variables.
* Add fpconv to work around comma decimal pointsMark Pulford2011-12-301-0/+2
| | | | | | | | Create a separate buffer and translate comma <> dot before calling strtod(), and after calling sprintf() as required. - Add "update_locale" Lua API call and init locale on module load. - Move sprintf format string to fpconv
* Display success when all tests passMark Pulford2011-12-301-3/+4
|
* Display failed test count (test.lua)Mark Pulford2011-12-261-1/+1
|
* Update build testing to show test counts/failuresMark Pulford2011-12-132-2/+20
| | | | | Display failed tests, and successful/total test counts. Use "awk" to provide a portable "ggrep -E" with context.
* Silence genutf8.pl warnings across Perl versionsMark Pulford2011-12-081-14/+5
| | | | | | | - Use Perl filehandles directly since IO::Handle generates unicode warnings that can't be silenced. - Disable all warnings since the specific "nonchar" warning only exists in newer versions.
* Add automated build testing (LuaRocks, Makefile)Mark Pulford2011-11-291-1/+1
|
* Add workaround to handle platforms that print -nanMark Pulford2011-11-291-4/+0
|
* Support locales which use comma decimal separatorsMark Pulford2011-10-051-0/+16
| | | | | | | | | | | | | Some locales (cs_CZ, de_DE,..) use a comma as their decimal separator. This causes CJSON to generate incorrect JSON (Eg, [10,1]), and fail when parsing some valid JSON (Eg, [10,"test"]). Added USE_POSIX_LOCALE #define which harnesses the thread-safe POSIX.1-2008 locale support (newlocale(), uselocale(), freelocale()) to temporarily use the POSIX locale during JSON conversion. Some older POSIX operating systems with xlocale.h (MacOSX) are also supported.
* Fix detection of objects with numeric string keysMark Pulford2011-08-101-2/+3
| | | | | | | | | | | | lua_array_length() recognised some objects with numeric string keys as arrays since it was incorrectly using lua_isnumber(). When an object was incorrectly recognised as an array, json_append_array() would not find any entries and generate a result like: [null,null,...] Reported by: Zhang "agentzh" Yichun <agentzh@gmail.com>
* Use a benchmark duration, not interation countMark Pulford2011-05-291-2/+12
| | | | | Roughly calculate the number of iterations required to run the benchmark for the chosen duration.
* Add trivial types.json exampleMark Pulford2011-05-292-0/+3
|
* Display CJSON library version when testingMark Pulford2011-05-291-1/+3
|
* Add support for runtime number precision configMark Pulford2011-05-291-0/+7
| | | | | | Add cjson.encode_number_precision(). Reducing the number precision from 14 to 3 can increase performance up to 50% with number heavy conversions.
* Test module with invalid numbers enabledMark Pulford2011-05-161-2/+1
|
* Add support for stdin to encode.lua/decode.luaMark Pulford2011-05-163-20/+42
|
* Use Perl builtin UTF-8 support, not Text::IconvMark Pulford2011-05-161-7/+13
| | | | Remove Perl dependency on Text::Iconv to improve portability.
* Move all benchmark code into bench.luaMark Pulford2011-05-162-39/+34
| | | | | Move benchmark() into bench.lua since it not used elsewhere. Replace posix.gettimeofday() with socket.gettime() to improve portability.
* Remove invalid newlines from JSON examplesMark Pulford2011-05-162-8/+4
|
* Add command line encode/decode utilitiesMark Pulford2011-05-162-0/+37
|
* Warn that a failed NaN test may not be an errorMark Pulford2011-05-162-3/+9
| | | | | | | Sprintf returns "-nan" rather than "nan" on some platforms, which causes the test script to incorrectly flag a failure. Also allow test functions without "==> Config" output.
* Remove trailing whitespace1.0.1Mark Pulford2011-05-102-4/+4
|
* run_test_group(): Change helper functions to localMark Pulford2011-05-101-2/+2
|
* Add runtime option for persistent encode bufferMark Pulford2011-05-101-1/+1
|
* Suspend the garbage collector during benchmarksMark Pulford2011-05-101-1/+2
| | | | Suspending GC appears to make the benchmark results more consistent.
* Remove whitespace from generated JSON outputMark Pulford2011-05-101-5/+5
| | | | | | | Remove excess whitespace to reduce output size and increase encode performance. Suggested by: Zhang "agentzh" Yichun <agentzh@gmail.com>
* Add extra encoding/nesting testsMark Pulford2011-05-102-6/+43
| | | | | | - Use pcall() to call test config functions. - Test encoding with refuse_invalid_numbers() options. - Test encoding invalid types.
* Add support for perl installs outside of /usr/binMark Pulford2011-05-101-1/+2
| | | | | Change "perl -w" to "use warnings" for compatibility with systems that put all #! args into argv[1].
* Add test for excessive nesting during encodeMark Pulford2011-05-082-6/+16
|
* Add NaN/Inf encoding tests, rearrange test orderMark Pulford2011-05-081-71/+74
|
* Generate error when attempting to decode UTF-16/32Mark Pulford2011-05-081-0/+4
|
* Add UTF-16 surrogate pair decode supportMark Pulford2011-05-084-2/+93
| | | | | | | | - Add tests for UTF-16 decoding and failures - Add getutf8.pl to assist with UTF-16 decode testing - Re-add test_decode_cycle() which was accidentally removed earlier - Rename bytestring.dat to octets-escaped.dat
* Test octect encode/decode separatelyMark Pulford2011-05-082-24/+9
|
* Convert tests to automatically verify outputMark Pulford2011-05-081-106/+107
|
* Implement data driven test frameworkMark Pulford2011-05-083-29/+158
| | | | | | | | - Add run_test(): Test a function and verify its output - Add run_test_group(): Execute a test batch - Add serialise_value(): Serialise a Lua value into the Lua syntax - Add file_save() helper function - Add NaN comparison support to compare_values()
* Add test to compare objects after decode/encodeMark Pulford2011-05-072-3/+40
|
* Document permission received to use examplesMark Pulford2011-05-041-0/+2
| | | | | | | | | | | Douglas Crockford <douglas@crockford.com> has given permission for these examples to be used. Message-ID: <4DC01FB7.8090001@crockford.com> Date: Tue, 03 May 2011 08:31:03 -0700 From: Douglas Crockford To: Mark Pulford Subject: Re: JSON examples
* Add basic JSON tests and benchmarkMark Pulford2011-05-0311-0/+465