Removal of some files not needed by this project
This commit is contained in:
parent
89c6c15f1c
commit
3d2af450dc
105 changed files with 0 additions and 31992 deletions
|
@ -1,371 +0,0 @@
|
|||
#unittesting
|
||||
#library
|
||||
#unicode
|
||||
#standard set
|
||||
STREAM, UNICODE, LIBRARY, SAFE, REF_COUNT, BINARY, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS, STRICT
|
||||
STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
CASTABLE, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no ref counting
|
||||
STREAM, UNICODE, LIBRARY, SAFE, BINARY, WRITER, COMMENTS, VALIDATE
|
||||
UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
CASTABLE, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, PREPARSE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no preparse
|
||||
UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
CASTABLE, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no safe
|
||||
VALIDATE, STREAM, UNICODE, LIBRARY, REF_COUNT, BINARY, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
VALIDATE, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS
|
||||
VALIDATE, STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
VALIDATE, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, VALIDATE, STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
CASTABLE, VALIDATE, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
#string header
|
||||
STREAM, UNICODE, STRINGU_HEADER, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, STRINGU_HEADER, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, STRINGU_HEADER, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, UNICODE, STRINGU_HEADER, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
CASTABLE, STREAM, UNICODE, STRINGU_HEADER, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no ref counting or preparsing
|
||||
STREAM, UNICODE, LIBRARY, SAFE, BINARY, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
CASTABLE, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, SAFE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no ref counting or preparsing or safety
|
||||
STREAM, UNICODE, LIBRARY, BINARY, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, CASTABLE, UNICODE, ESCAPE_WRITES, UNIT_TEST, LIBRARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no unicode
|
||||
#standard set
|
||||
STREAM, LIBRARY, SAFE, REF_COUNT, BINARY, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, STREAM, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, CASTABLE, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no ref counting
|
||||
STREAM, LIBRARY, SAFE, BINARY, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNIT_TEST, LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNIT_TEST, LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNIT_TEST, LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, STREAM, UNIT_TEST, LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
CASTABLE, UNIT_TEST, LIBRARY, SAFE, PREPARSE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no preparse
|
||||
STREAM, UNIT_TEST, LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNIT_TEST, LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNIT_TEST, LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, UNIT_TEST, LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
CASTABLE, STREAM, UNIT_TEST, LIBRARY, SAFE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no safe
|
||||
VALIDATE, STREAM, LIBRARY, REF_COUNT, BINARY, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
VALIDATE, UNIT_TEST, LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS
|
||||
VALIDATE, STREAM, UNIT_TEST, LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
VALIDATE, UNIT_TEST, LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, VALIDATE, STREAM, UNIT_TEST, LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
CASTABLE, VALIDATE, UNIT_TEST, LIBRARY, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
#string header
|
||||
STREAM, STRING_HEADER, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STRING_HEADER, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, STRING_HEADER, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, STREAM, STRING_HEADER, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
CASTABLE, STRING_HEADER, UNIT_TEST, LIBRARY, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no ref counting or preparsing
|
||||
STREAM, LIBRARY, SAFE, BINARY, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNIT_TEST, LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNIT_TEST, LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNIT_TEST, LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, STREAM, UNIT_TEST, LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
CASTABLE, UNIT_TEST, LIBRARY, SAFE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no ref counting or preparsing or safety
|
||||
STREAM, LIBRARY, BINARY, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNIT_TEST, LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNIT_TEST, LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNIT_TEST, LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, STREAM, UNIT_TEST, LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
CASTABLE, UNIT_TEST, LIBRARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
#embedded
|
||||
#unicode
|
||||
#standard set
|
||||
STREAM, UNICODE, SAFE, REF_COUNT, BINARY, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
CASTABLE, UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no ref counting
|
||||
STREAM, UNICODE, SAFE, BINARY, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, CASTABLE, UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, PREPARSE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no preparse
|
||||
STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
CASTABLE, STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no safe
|
||||
VALIDATE, STREAM, UNICODE, REF_COUNT, BINARY, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
VALIDATE, UNICODE, ESCAPE_WRITES, UNIT_TEST, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS
|
||||
VALIDATE, STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
VALIDATE, UNICODE, ESCAPE_WRITES, UNIT_TEST, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, VALIDATE, STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
CASTABLE, VALIDATE, UNICODE, ESCAPE_WRITES, UNIT_TEST, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
#string header
|
||||
STREAM, UNICODE, STRINGU_HEADER, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, STRINGU_HEADER, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, STRINGU_HEADER, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, UNICODE, STRINGU_HEADER, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
CASTABLE, STREAM, UNICODE, STRINGU_HEADER, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no ref counting or preparsing
|
||||
STREAM, UNICODE, SAFE, BINARY, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
CASTABLE, UNICODE, ESCAPE_WRITES, UNIT_TEST, SAFE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no ref counting or preparsing or safety
|
||||
STREAM, UNICODE, BINARY, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, ESCAPE_WRITES, UNIT_TEST, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, ESCAPE_WRITES, UNIT_TEST, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, STREAM, UNICODE, ESCAPE_WRITES, UNIT_TEST, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
CASTABLE, UNICODE, ESCAPE_WRITES, UNIT_TEST, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no unicode
|
||||
#standard set
|
||||
STREAM, SAFE, REF_COUNT, BINARY, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, STREAM, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
CASTABLE, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no ref counting
|
||||
STREAM, SAFE, BINARY, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNIT_TEST, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNIT_TEST, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNIT_TEST, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, STREAM, UNIT_TEST, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
CASTABLE, UNIT_TEST, SAFE, PREPARSE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no preparse
|
||||
STREAM, UNIT_TEST, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNIT_TEST, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNIT_TEST, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, UNIT_TEST, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, CASTABLE, STREAM, UNIT_TEST, SAFE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no safe
|
||||
VALIDATE, STREAM, REF_COUNT, BINARY, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
VALIDATE, UNIT_TEST, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS
|
||||
VALIDATE, STREAM, UNIT_TEST, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
VALIDATE, UNIT_TEST, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, VALIDATE, STREAM, UNIT_TEST, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
CASTABLE, VALIDATE, UNIT_TEST, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
#string header
|
||||
STREAM, STRING_HEADER, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STRING_HEADER, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, STRING_HEADER, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, STRING_HEADER, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
CASTABLE, STREAM, STRING_HEADER, UNIT_TEST, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no ref counting or preparsing
|
||||
STREAM, SAFE, BINARY, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNIT_TEST, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNIT_TEST, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNIT_TEST, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, STREAM, UNIT_TEST, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
CASTABLE, UNIT_TEST, SAFE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no ref counting or preparsing or safety
|
||||
STREAM, BINARY, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNIT_TEST, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNIT_TEST, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNIT_TEST, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, STREAM, UNIT_TEST, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
CASTABLE, UNIT_TEST, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no unittesting
|
||||
#library
|
||||
#unicode
|
||||
#standard set
|
||||
STREAM, UNICODE, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, UNICODE, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, LIBRARY, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no ref counting
|
||||
STREAM, UNICODE, LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, UNICODE, LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, LIBRARY, SAFE, PREPARSE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no preparse
|
||||
STREAM, UNICODE, LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, UNICODE, LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, LIBRARY, SAFE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no safe
|
||||
STREAM, UNICODE, LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, UNICODE, LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, STREAM, UNICODE, LIBRARY, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
#string header
|
||||
STREAM, UNICODE, STRINGU_HEADER, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, STRINGU_HEADER, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, STRINGU_HEADER, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, UNICODE, STRINGU_HEADER, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, STRINGU_HEADER, LIBRARY, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no ref counting or preparsing
|
||||
STREAM, UNICODE, LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, UNICODE, LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, LIBRARY, SAFE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no ref counting or preparsing or safety
|
||||
STREAM, UNICODE, LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, UNICODE, LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, LIBRARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no unicode
|
||||
#standard set
|
||||
STREAM, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, LIBRARY, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no ref counting
|
||||
STREAM, LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, LIBRARY, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, LIBRARY, SAFE, PREPARSE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no preparse
|
||||
STREAM, LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, LIBRARY, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, LIBRARY, SAFE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no safe
|
||||
STREAM, LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS
|
||||
LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, LIBRARY, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, LIBRARY, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
#string header
|
||||
STREAM, STRING_HEADER, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STRING_HEADER, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, STRING_HEADER, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, STRING_HEADER, LIBRARY, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, STREAM, STRING_HEADER, LIBRARY, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no ref counting or preparsing
|
||||
STREAM, LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, LIBRARY, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, LIBRARY, SAFE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no ref counting or preparsing or safety
|
||||
STREAM, LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS
|
||||
LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, LIBRARY, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, LIBRARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
#embedded
|
||||
#unicode
|
||||
#standard set
|
||||
STREAM, UNICODE, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, UNICODE, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no ref counting
|
||||
STREAM, UNICODE, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, UNICODE, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, SAFE, PREPARSE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no preparse
|
||||
STREAM, UNICODE, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, UNICODE, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, SAFE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no safe
|
||||
STREAM, UNICODE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, UNICODE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
#string header
|
||||
STREAM, UNICODE, STRINGU_HEADER, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, STRINGU_HEADER, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, STRINGU_HEADER, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, UNICODE, STRINGU_HEADER, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, STREAM, UNICODE, STRINGU_HEADER, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no ref counting or preparsing
|
||||
STREAM, UNICODE, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, UNICODE, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, SAFE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no ref counting or preparsing or safety
|
||||
STREAM, UNICODE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS
|
||||
UNICODE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, UNICODE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, UNICODE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no unicode
|
||||
#standard set
|
||||
STREAM, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no ref countingv
|
||||
STREAM, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, SAFE, PREPARSE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, SAFE, PREPARSE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no preparse
|
||||
STREAM, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, SAFE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, SAFE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no safe
|
||||
STREAM, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS
|
||||
PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
#string header
|
||||
STREAM, STRING_HEADER, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STRING_HEADER, STRING_HEADER, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, STRING_HEADER, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, STRING_HEADER, SAFE, PREPARSE, REF_COUNT, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, STRING_HEADER, SAFE, PREPARSE, REF_COUNT, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no ref counting or preparsing
|
||||
STREAM, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, SAFE, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, STREAM, SAFE, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, VALIDATE, CASE_INSENSITIVE_FUNCTIONS
|
||||
#no ref counting or preparsing or safety
|
||||
STREAM, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, CASE_INSENSITIVE_FUNCTIONS
|
||||
BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
MEMORY_POOL, BINARY, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
||||
STREAM, MEMORY_CALLBACKS, MEMORY_MANAGE, MUTEX_CALLBACKS, MUTEX_MANAGE, ITERATORS, WRITER, COMMENTS, CASE_INSENSITIVE_FUNCTIONS
|
|
@ -1,246 +0,0 @@
|
|||
#include <iostream>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <fstream>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <map>
|
||||
#include <sys/stat.h>
|
||||
#include "../UnitTest.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
map<string, string> options;
|
||||
vector<string> lines;
|
||||
vector<unsigned int> line_numbers;
|
||||
size_t counter = 0;
|
||||
string make;
|
||||
string ArchivedOptions;
|
||||
string makeStyle;
|
||||
|
||||
string makeOptions[] = {
|
||||
"single",
|
||||
"debug",
|
||||
"small"
|
||||
};
|
||||
|
||||
void makeMap(void){
|
||||
options["LIBRARY"] = "#define JSON_LIBRARY";
|
||||
options["DEBUG"] = "#define JSON_DEBUG";
|
||||
options["STREAM"] = "#define JSON_STREAM";
|
||||
options["SAFE"] = "#define JSON_SAFE";
|
||||
options["STDERROR"] = "#define JSON_STDERROR";
|
||||
options["PREPARSE"] = "#define JSON_PREPARSE";
|
||||
options["LESS_MEMORY"] = "#define JSON_LESS_MEMORY";
|
||||
options["UNICODE"] = "#define JSON_UNICODE";
|
||||
options["REF_COUNT"] = "#define JSON_REF_COUNT";
|
||||
options["BINARY"] = "#define JSON_BINARY";
|
||||
options["MEMORY_CALLBACKS"] = "#define JSON_MEMORY_CALLBACKS";
|
||||
options["MEMORY_MANAGE"] = "#define JSON_MEMORY_MANAGE";
|
||||
options["MUTEX_CALLBACKS"] = "#define JSON_MUTEX_CALLBACKS";
|
||||
options["MUTEX_MANAGE"] = "#define JSON_MUTEX_MANAGE";
|
||||
options["ITERATORS"] = "#define JSON_ITERATORS";
|
||||
options["WRITER"] = "#define JSON_WRITE_PRIORITY MID";
|
||||
options["READER"] = "#define JSON_READ_PRIORITY HIGH";
|
||||
options["NEWLINE"] = "#define JSON_NEWLINE \"\\r\\n\"";
|
||||
options["COMMENTS"] = "#define JSON_COMMENTS";
|
||||
options["INDENT"] = "#define JSON_INDENT \" \"";
|
||||
options["WRITE_BASH_COMMENTS"] = "#define JSON_WRITE_BASH_COMMENTS";
|
||||
options["WRITE_SINGLE_LINE_COMMENTS"] = "#define JSON_WRITE_SINGLE_LINE_COMMENTS";
|
||||
options["VALIDATE"] = "#define JSON_VALIDATE";
|
||||
options["UNIT_TEST"] = "#define JSON_UNIT_TEST";
|
||||
options["INDEX_TYPE"] = "#define JSON_INDEX_TYPE unsigned int";
|
||||
options["CASE_INSENSITIVE_FUNCTIONS"] = "#define JSON_CASE_INSENSITIVE_FUNCTIONS";
|
||||
options["ESCAPE_WRITES"] = "#define JSON_ESCAPE_WRITES";
|
||||
options["STRINGU_HEADER"] = "#define JSON_STRING_HEADER \"../TestSuite/UStringTest.h\"";
|
||||
options["STRING_HEADER"] = "#define JSON_STRING_HEADER \"../TestSuite/StringTest.h\"";
|
||||
options["CASTABLE"] = "#define JSON_CASTABLE";
|
||||
options["STRICT"] = "#define JSON_STRICT";
|
||||
options["MEMORY_POOL"] = "#define JSON_MEMORY_POOL 524288";
|
||||
}
|
||||
|
||||
void testRules(unsigned int i){
|
||||
remove("./testapp");
|
||||
int q = system(make.c_str());
|
||||
bool Archive = false;
|
||||
if (FILE * fp = fopen("./testapp", "r")){
|
||||
fclose(fp);
|
||||
|
||||
remove("./out.html");
|
||||
q = system("./testapp");
|
||||
if (FILE * fp = fopen("./out.html", "r")){
|
||||
char buffer[255];
|
||||
size_t qq = fread(&buffer[0], 255, 1, fp);
|
||||
buffer[254] = '\0';
|
||||
fclose(fp);
|
||||
string buf(&buffer[0]);
|
||||
size_t pos = buf.find("Failed Tests: <c style=\"color:#CC0000\">");
|
||||
if (pos == string::npos){
|
||||
FAIL("Something Wrong");
|
||||
} else {
|
||||
if(buf[pos + 39] == '0'){
|
||||
PASS("GOOD");
|
||||
} else {
|
||||
size_t pp = buf.find('<', pos + 39);
|
||||
FAIL(string("Didn't pass ") + buf.substr(pos + 39, pp - pos - 39) + " tests");
|
||||
ArchivedOptions = std::string("Fail_") + ArchivedOptions;
|
||||
Archive = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
FAIL("Running crashed");
|
||||
ArchivedOptions = std::string("Crashed_") + ArchivedOptions;
|
||||
Archive = true;
|
||||
}
|
||||
} else {
|
||||
FAIL(string("Compilation failed - ") + lines[i]);
|
||||
ArchivedOptions = std::string("Compile_") + ArchivedOptions;
|
||||
Archive = true;
|
||||
}
|
||||
|
||||
//If something broke, make a copy of the options used to make the failure, so it can be easily retested
|
||||
if (Archive){
|
||||
if (FILE * fp = fopen("../JSONOptions.h", "r")){
|
||||
ArchivedOptions = std::string("../") + ArchivedOptions;
|
||||
if (FILE * ofp = fopen(ArchivedOptions.c_str(), "w")){
|
||||
char buffer[2048] = {'\0'};
|
||||
size_t qq = fread(&buffer[0], 2048, 1, fp);
|
||||
fwrite(&buffer[0], strlen(&buffer[0]), 1, ofp);
|
||||
fclose(ofp);
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool makeTempOptions(unsigned int i){
|
||||
string & line = lines[i];
|
||||
|
||||
if (FILE * fp = fopen("../JSONOptions.h", "w")){
|
||||
string res("#ifndef JSON_OPTIONS_H\n#define JSON_OPTIONS_H\n");
|
||||
for (
|
||||
map<string, string>::iterator runner = options.begin(), end = options.end();
|
||||
runner != end;
|
||||
++runner){
|
||||
|
||||
if (line.find(runner -> first) != string::npos){
|
||||
res += runner -> second + "\n";
|
||||
}
|
||||
}
|
||||
res += "#endif\n";
|
||||
|
||||
fwrite(res.c_str(), res.length(), 1, fp);
|
||||
fclose(fp);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool hideGoodOptions(void){
|
||||
struct stat stFileInfo;
|
||||
if (stat("../__JSONOptions.h", &stFileInfo)){
|
||||
remove("../JSONOptions.h");
|
||||
return true;
|
||||
}
|
||||
return (rename("../JSONOptions.h", "../__JSONOptions.h") == 0);
|
||||
}
|
||||
|
||||
bool loadTests(){
|
||||
ifstream infile("All/Options.txt");
|
||||
|
||||
if (!infile){
|
||||
return false;
|
||||
}
|
||||
|
||||
string line;
|
||||
unsigned int iii = 0;
|
||||
while (getline(infile, line)){
|
||||
++iii;
|
||||
size_t pos = line.find_first_not_of(' ');
|
||||
if (pos != string::npos){
|
||||
line = line.substr(pos);
|
||||
pos = line.find_first_not_of("\r\n\t ");
|
||||
if ((line.length() > 5) && (line[0] != '#')){
|
||||
const string temp(line.substr(pos));
|
||||
lines.push_back(string("READER, ") + temp);
|
||||
line_numbers.push_back(iii);
|
||||
if ((temp.find("VALIDATE") == string::npos) && (temp.find("STREAM") == string::npos)){
|
||||
lines.push_back(temp);
|
||||
line_numbers.push_back(iii);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
infile.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
void RunTest(const std::string & version, unsigned int i){
|
||||
if(makeTempOptions(i)){
|
||||
stringstream mystream;
|
||||
mystream << version << " Line " << line_numbers[i];
|
||||
cout << "Compiling " << ++counter << " of " << line_numbers.size() * 3 << " - " << mystream.str() << endl;
|
||||
cout << " " << lines[i] << endl;
|
||||
UnitTest::SetPrefix(mystream.str());
|
||||
stringstream options_;
|
||||
options_ << version << "_Line_" << line_numbers[i] << "_JSONOptions.h";
|
||||
ArchivedOptions = options_.str();
|
||||
testRules(i);
|
||||
remove("../JSONOptions.h");
|
||||
UnitTest::SaveTo("progress.html");
|
||||
}
|
||||
}
|
||||
|
||||
void Go(const std::string & version, unsigned int test){
|
||||
echo(make);
|
||||
if (makeStyle.empty() || (makeStyle == version)){
|
||||
makeStyle.clear();
|
||||
for (unsigned int i = test; i < lines.size(); ++i){
|
||||
RunTest(version, i);
|
||||
}
|
||||
} else {
|
||||
echo("skipping");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RunTests(unsigned int test){
|
||||
if (hideGoodOptions()){
|
||||
if(loadTests()){
|
||||
makeMap();
|
||||
for(unsigned int i = 0; i < sizeof(makeOptions); ++i){
|
||||
make = "make -j4 " + makeOptions[i];
|
||||
Go(makeOptions[i], test);
|
||||
}
|
||||
} else {
|
||||
FAIL("couldn't open options");
|
||||
}
|
||||
rename("../__JSONOptions.h", "../JSONOptions.h");
|
||||
} else {
|
||||
FAIL("Couldn't protect JSONOptions");
|
||||
}
|
||||
}
|
||||
|
||||
int main (int argc, char * const argv[]) {
|
||||
UnitTest::StartTime();
|
||||
unsigned int test = 0;
|
||||
if (argc == 3){
|
||||
test = atoi(argv[2]) - 1;
|
||||
counter = test;
|
||||
echo("starting on test " << test);
|
||||
makeStyle = argv[1];
|
||||
echo("starting with make " << makeStyle);
|
||||
} else if (argc == 2){
|
||||
test = 0;
|
||||
counter = test;
|
||||
echo("starting on test " << test);
|
||||
makeStyle = argv[1];
|
||||
echo("starting with make " << makeStyle);
|
||||
}
|
||||
|
||||
RunTests(test);
|
||||
|
||||
UnitTest::SaveTo("out.html");
|
||||
return 0;
|
||||
}
|
|
@ -1,311 +0,0 @@
|
|||
/**
|
||||
*
|
||||
* This test suite should get run before releasing a new version of libjson, once all
|
||||
* unit tests have passed. This asserts that the Options are in the default configuration,
|
||||
* this prevents me from accidentally releasing libjson using options that I had been testing
|
||||
* with. It also performs a speed benchmark, so I can keep track of how libjson is performing
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <ctime>
|
||||
#include "../../libjson.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
#ifndef JSON_LIBRARY
|
||||
#error, JSON_LIBRARY not on
|
||||
#endif
|
||||
|
||||
#ifdef JSON_STRICT
|
||||
#error, JSON_STRICT on
|
||||
#endif
|
||||
|
||||
#ifdef JSON_DEBUG
|
||||
#error, JSON_DEBUG on
|
||||
#endif
|
||||
|
||||
#ifdef JSON_ISO_STRICT
|
||||
#error, JSON_ISO_STRICT on
|
||||
#endif
|
||||
|
||||
#ifndef JSON_SAFE
|
||||
#error, JSON_SAFE not on
|
||||
#endif
|
||||
|
||||
#ifndef JSON_CASTABLE
|
||||
#error, JSON_CASTABLE not on
|
||||
#endif
|
||||
|
||||
#ifdef JSON_STDERROR
|
||||
#error, JSON_STDERROR on
|
||||
#endif
|
||||
|
||||
#ifdef JSON_PREPARSE
|
||||
#error, JSON_PREPARSE on
|
||||
#endif
|
||||
|
||||
#ifdef JSON_LESS_MEMORY
|
||||
#error, JSON_LESS_MEMORY on
|
||||
#endif
|
||||
|
||||
#ifdef JSON_UNICODE
|
||||
#error, JSON_UNICODE on
|
||||
#endif
|
||||
|
||||
#ifndef JSON_REF_COUNT
|
||||
#error, JSON_REF_COUNT not on
|
||||
#endif
|
||||
|
||||
#ifndef JSON_BINARY
|
||||
#error, JSON_BINARY not on
|
||||
#endif
|
||||
|
||||
#ifndef JSON_EXPOSE_BASE64
|
||||
#error, JSON_EXPOSE_BASE64 not on
|
||||
#endif
|
||||
|
||||
#ifndef JSON_ITERATORS
|
||||
#error, JSON_ITERATORS not on
|
||||
#endif
|
||||
|
||||
#ifndef JSON_STREAM
|
||||
#error, JSON_STREAM not on
|
||||
#endif
|
||||
|
||||
#ifdef JSON_MEMORY_CALLBACKS
|
||||
#error, JSON_MEMORY_CALLBACKS on
|
||||
#endif
|
||||
|
||||
#ifdef JSON_MEMORY_MANAGE
|
||||
#error, JSON_MEMORY_MANAGE on
|
||||
#endif
|
||||
|
||||
#ifdef JSON_MUTEX_CALLBACKS
|
||||
#error, JSON_MUTEX_CALLBACKS on
|
||||
#endif
|
||||
|
||||
#ifdef JSON_MUTEX_MANAGE
|
||||
#error, JSON_MUTEX_MANAGE on
|
||||
#endif
|
||||
|
||||
#ifdef JSON_NO_C_CONSTS
|
||||
#error, JSON_NO_C_CONSTS on
|
||||
#endif
|
||||
|
||||
#ifdef JSON_OCTAL
|
||||
#error, JSON_OCTAL on
|
||||
#endif
|
||||
|
||||
#if (JSON_READ_PRIORITY != HIGH)
|
||||
#error JSON_READ_PRIORITY not high
|
||||
#endif
|
||||
|
||||
#if (JSON_WRITE_PRIORITY != MED)
|
||||
#error JSON_WRITE_PRIORITY not med
|
||||
#endif
|
||||
|
||||
#ifdef JSON_NEWLINE
|
||||
#error, JSON_NEWLINE on
|
||||
#endif
|
||||
|
||||
#ifdef JSON_INDENT
|
||||
#error, JSON_INDENT on
|
||||
#endif
|
||||
|
||||
#ifndef JSON_ESCAPE_WRITES
|
||||
#error, JSON_ESCAPE_WRITES not on
|
||||
#endif
|
||||
|
||||
#ifndef JSON_COMMENTS
|
||||
#error, JSON_COMMENTS not on
|
||||
#endif
|
||||
|
||||
#ifdef JSON_WRITE_BASH_COMMENTS
|
||||
#error, JSON_WRITE_BASH_COMMENTS on
|
||||
#endif
|
||||
|
||||
#ifdef JSON_WRITE_SINGLE_LINE_COMMENTS
|
||||
#error, JSON_WRITE_SINGLE_LINE_COMMENTS on
|
||||
#endif
|
||||
|
||||
#ifdef JSON_ARRAY_ON_ONE_LINE
|
||||
#error, JSON_ARRAY_ON_ONE_LINE on
|
||||
#endif
|
||||
|
||||
#ifndef JSON_VALIDATE
|
||||
#error, JSON_VALIDATE not on
|
||||
#endif
|
||||
|
||||
#ifndef JSON_CASE_INSENSITIVE_FUNCTIONS
|
||||
#error, JSON_CASE_INSENSITIVE_FUNCTIONS not on
|
||||
#endif
|
||||
|
||||
#ifdef JSON_INDEX_TYPE
|
||||
#error, JSON_INDEX_TYPE on
|
||||
#endif
|
||||
|
||||
#ifdef JSON_BOOL_TYPE
|
||||
#error, JSON_BOOL_TYPE on
|
||||
#endif
|
||||
|
||||
#ifdef JSON_INT_TYPE
|
||||
#error, JSON_INT_TYPE on
|
||||
#endif
|
||||
|
||||
#ifdef JSON_STRING_HEADER
|
||||
#error, JSON_STRING_HEADER on
|
||||
#endif
|
||||
|
||||
#ifdef JSON_NO_EXCEPTIONS
|
||||
#error, JSON_NO_EXCEPTIONS on
|
||||
#endif
|
||||
|
||||
#ifndef JSON_DEPRECATED_FUNCTIONS
|
||||
#error, JSON_DEPRECATED_FUNCTIONS not on
|
||||
#endif
|
||||
|
||||
#if (JSON_SECURITY_MAX_NEST_LEVEL != 128)
|
||||
#error JSON_SECURITY_MAX_NEST_LEVEL not 128
|
||||
#endif
|
||||
|
||||
#if (JSON_SECURITY_MAX_STRING_LENGTH != 33554432)
|
||||
#error JSON_SECURITY_MAX_STRING_LENGTH not 33554432
|
||||
#endif
|
||||
|
||||
#if (JSON_SECURITY_MAX_STREAM_OBJECTS != 128)
|
||||
#error JSON_SECURITY_MAX_STREAM_OBJECTS not 128
|
||||
#endif
|
||||
|
||||
#ifdef JSON_MEMORY_POOL
|
||||
#error JSON_MEMORY_POOL is on
|
||||
#endif
|
||||
|
||||
#ifdef JSON_UNIT_TEST
|
||||
#error, JSON_UNIT_TEST on
|
||||
#endif
|
||||
|
||||
#define IT_COUNT 50000
|
||||
static string makeBigFormatted(){
|
||||
string json = "{\n";
|
||||
for(unsigned int i = 0; i < IT_COUNT; ++i){
|
||||
json += "\t//This is an object\r\n\t{\n\t\t\"name\" : 14.783,\n\t\t/* This is a multilen commenet */\n\t\t\"another\" : \"I am a stirng\"\n\t},";
|
||||
json += "\n\n\t//This is an array\r\n\t[4, 16, true, false, 78.98],\n";
|
||||
}
|
||||
json += "\t\"number\" : null\n}";
|
||||
return json;
|
||||
}
|
||||
|
||||
static string makeBig(){
|
||||
string json = "{";
|
||||
for(unsigned int i = 0; i < IT_COUNT; ++i){
|
||||
json += "{\"name\":14.783,\"another\":\"I am a stirng\"},";
|
||||
json += "[4, 16, true, false, 78.98],";
|
||||
}
|
||||
json += "\"number\":null}";
|
||||
return json;
|
||||
}
|
||||
|
||||
int main (int argc, char * const argv[]) {
|
||||
JSONNODE * node;
|
||||
string mystr = makeBigFormatted();
|
||||
clock_t start = clock();
|
||||
for(unsigned int i = 0; i < 100; ++i){
|
||||
node = json_parse(mystr.c_str());
|
||||
for (unsigned int j = 0; j < IT_COUNT; ++j){
|
||||
JSONNODE * meh = json_at(node, j * 2);
|
||||
json_as_float(json_get(meh, "name"));
|
||||
char * str = json_as_string(json_get(meh, "another"));
|
||||
json_free(str);
|
||||
|
||||
meh = json_at(node, j * 2 + 1);
|
||||
json_as_int(json_at(meh, 0));
|
||||
json_as_int(json_at(meh, 1));
|
||||
json_as_bool(json_at(meh, 2));
|
||||
json_as_bool(json_at(meh, 3));
|
||||
json_as_int(json_at(meh, 4));
|
||||
}
|
||||
json_delete(node);
|
||||
}
|
||||
cout << "Reading: " << clock() - start << endl;
|
||||
|
||||
|
||||
|
||||
mystr = makeBig();
|
||||
start = clock();
|
||||
for(unsigned int i = 0; i < 100; ++i){
|
||||
node = json_parse(mystr.c_str());
|
||||
for (unsigned int j = 0; j < IT_COUNT; ++j){
|
||||
JSONNODE * meh = json_at(node, j * 2);
|
||||
json_as_float(json_get(meh, "name"));
|
||||
char * str = json_as_string(json_get(meh, "another"));
|
||||
json_free(str);
|
||||
|
||||
meh = json_at(node, j * 2 + 1);
|
||||
json_as_int(json_at(meh, 0));
|
||||
json_as_int(json_at(meh, 1));
|
||||
json_as_bool(json_at(meh, 2));
|
||||
json_as_bool(json_at(meh, 3));
|
||||
json_as_int(json_at(meh, 4));
|
||||
}
|
||||
json_delete(node);
|
||||
}
|
||||
cout << "Reading Unformatted: " << clock() - start << endl;
|
||||
|
||||
|
||||
start = clock();
|
||||
for(unsigned int i = 0; i < 100; ++i){
|
||||
node = json_new(JSON_NODE);
|
||||
for (unsigned int j = 0; j < IT_COUNT; ++j){
|
||||
JSONNODE * meh = json_new(JSON_NODE);
|
||||
json_push_back(meh, json_new_f("name", 14.783));
|
||||
json_push_back(meh, json_new_a("another", "I am a string"));
|
||||
json_push_back(node, meh);
|
||||
|
||||
meh = json_new(JSON_ARRAY);
|
||||
json_push_back(meh, json_new_i(NULL, 14));
|
||||
json_push_back(meh, json_new_i("", 1));
|
||||
json_push_back(meh, json_new_b(NULL, true));
|
||||
json_push_back(meh, json_new_b("", false));
|
||||
json_push_back(meh, json_new_f(NULL, 14.3243));
|
||||
json_push_back(node, meh);
|
||||
}
|
||||
json_delete(node);
|
||||
}
|
||||
cout << "Building: " << clock() - start << endl;
|
||||
|
||||
|
||||
|
||||
node = json_new(JSON_NODE);
|
||||
for (unsigned int j = 0; j < IT_COUNT; ++j){
|
||||
JSONNODE * meh = json_new(JSON_NODE);
|
||||
json_push_back(meh, json_new_f("name", 14.783));
|
||||
json_push_back(meh, json_new_a("another", "I am a string"));
|
||||
json_push_back(node, meh);
|
||||
|
||||
meh = json_new(JSON_ARRAY);
|
||||
json_push_back(meh, json_new_i(NULL, 14));
|
||||
json_push_back(meh, json_new_i("", 1));
|
||||
json_push_back(meh, json_new_b(NULL, true));
|
||||
json_push_back(meh, json_new_b("", false));
|
||||
json_push_back(meh, json_new_f(NULL, 14.3243));
|
||||
json_push_back(node, meh);
|
||||
}
|
||||
start = clock();
|
||||
for(unsigned int i = 0; i < 100; ++i){
|
||||
char * str = json_write_formatted(node);
|
||||
json_free(str);
|
||||
}
|
||||
cout << "Writing: " << clock() - start << endl;
|
||||
|
||||
start = clock();
|
||||
for(unsigned int i = 0; i < 100; ++i){
|
||||
char * str = json_write(node);
|
||||
json_free(str);
|
||||
}
|
||||
cout << "Writing Unformatted: " << clock() - start << endl;
|
||||
json_delete(node);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
OS=$(shell uname)
|
||||
ifeq ($(OS), Darwin)
|
||||
fastflag = -fast
|
||||
else
|
||||
fastflag = -O3
|
||||
endif
|
||||
|
||||
single:
|
||||
g++ main.cpp \
|
||||
../../Source/internalJSONNode.cpp \
|
||||
../../Source/JSONChildren.cpp ../../Source/JSONDebug.cpp \
|
||||
../../Source/JSONIterators.cpp ../../Source/JSONMemory.cpp \
|
||||
../../Source/JSONNode_Mutex.cpp ../../Source/JSONNode.cpp \
|
||||
../../Source/JSONWorker.cpp ../../Source/JSONWriter.cpp \
|
||||
../../Source/libjson.cpp ../../Source/JSONValidator.cpp \
|
||||
../../Source/JSONStream.cpp ../../Source/JSONAllocator.cpp \
|
||||
../../Source/JSONPreparse.cpp \
|
||||
-Wfatal-errors -DNDEBUG $(fastflag) -ffast-math -fexpensive-optimizations -o testapp
|
||||
|
||||
debug:
|
||||
g++ main.cpp \
|
||||
../../Source/internalJSONNode.cpp \
|
||||
../../Source/JSONChildren.cpp ../../Source/JSONDebug.cpp \
|
||||
../../Source/JSONIterators.cpp ../../Source/JSONMemory.cpp \
|
||||
../../Source/JSONNode_Mutex.cpp ../../Source/JSONNode.cpp \
|
||||
../../Source/JSONWorker.cpp ../../Source/JSONWriter.cpp \
|
||||
../../Source/libjson.cpp ../../Source/JSONValidator.cpp \
|
||||
../../Source/JSONStream.cpp ../../Source/JSONAllocator.cpp \
|
||||
../../Source/JSONPreparse.cpp \
|
||||
-Wfatal-errors -DJSON_DEBUG -o testapp
|
||||
|
||||
small:
|
||||
g++ main.cpp \
|
||||
../../Source/internalJSONNode.cpp \
|
||||
../../Source/JSONChildren.cpp ../../Source/JSONDebug.cpp \
|
||||
../../Source/JSONIterators.cpp ../../Source/JSONMemory.cpp \
|
||||
../../Source/JSONNode_Mutex.cpp ../../Source/JSONNode.cpp \
|
||||
../../Source/JSONWorker.cpp ../../Source/JSONWriter.cpp \
|
||||
../../Source/libjson.cpp ../../Source/JSONValidator.cpp \
|
||||
../../Source/JSONStream.cpp ../../Source/JSONAllocator.cpp \
|
||||
../../Source/JSONPreparse.cpp \
|
||||
-Wfatal-errors -DNDEBUG -Os -ffast-math -DJSON_LESS_MEMORY -o testapp
|
|
@ -1,12 +0,0 @@
|
|||
Update LIBJSON_VERSION values and values in makefile too
|
||||
Strip all trailing white space
|
||||
Run test in XCode using all options on
|
||||
Export Documentation to PDF
|
||||
Delete build folders
|
||||
Run all tests on Mac
|
||||
Run all tests on Linux
|
||||
Run test in VC++ using all options on (if possible)
|
||||
Run benchmark to assert options are all the default
|
||||
Remove Hidden Finder files
|
||||
Zip TestSuite
|
||||
Zip on Linux
|
|
@ -1,155 +0,0 @@
|
|||
#include "RunTestSuite2.h"
|
||||
#include "../TestSuite2/BaseTest.h"
|
||||
#include "../TestSuite2/JSON_Base64/json_decode64.h"
|
||||
#include "../TestSuite2/JSON_Base64/json_encode64.h"
|
||||
#include "../TestSuite2/JSONDebug/JSON_ASSERT.h"
|
||||
#include "../TestSuite2/JSONDebug/JSON_ASSERT_SAFE.h"
|
||||
#include "../TestSuite2/JSONDebug/JSON_FAIL.h"
|
||||
#include "../TestSuite2/JSONDebug/JSON_FAIL_SAFE.h"
|
||||
#include "../TestSuite2/JSONGlobals/jsonSingleton.h"
|
||||
#include "../TestSuite2/JSONValidator/isValidArray.h"
|
||||
#include "../TestSuite2/JSONValidator/isValidMember.h"
|
||||
#include "../TestSuite2/JSONValidator/isValidNamedObject.h"
|
||||
#include "../TestSuite2/JSONValidator/isValidNumber.h"
|
||||
#include "../TestSuite2/JSONValidator/isValidObject.h"
|
||||
#include "../TestSuite2/JSONValidator/isValidPartialRoot.h"
|
||||
#include "../TestSuite2/JSONValidator/isValidRoot.h"
|
||||
#include "../TestSuite2/JSONValidator/isValidString.h"
|
||||
#include "../TestSuite2/JSONValidator/Resources/validyMacros.h"
|
||||
#include "../TestSuite2/JSONValidator/securityTest.h"
|
||||
#include "../TestSuite2/NumberToString/_areFloatsEqual.h"
|
||||
#include "../TestSuite2/NumberToString/_atof.h"
|
||||
#include "../TestSuite2/NumberToString/_ftoa.h"
|
||||
#include "../TestSuite2/NumberToString/_itoa.h"
|
||||
#include "../TestSuite2/NumberToString/_uitoa.h"
|
||||
#include "../TestSuite2/NumberToString/getLenSize.h"
|
||||
#include "../TestSuite2/NumberToString/isNumeric.h"
|
||||
|
||||
#define RUNTEST(name) ttt.setUp(#name); ttt.name(); ttt.tearDown()
|
||||
|
||||
void RunTestSuite2::RunTests(void){
|
||||
{
|
||||
testJSON_Base64__json_decode64 ttt("testJSON_Base64__json_decode64");
|
||||
RUNTEST(testNotBase64);
|
||||
}
|
||||
{
|
||||
testJSON_Base64__json_encode64 ttt("testJSON_Base64__json_encode64");
|
||||
RUNTEST(testReverseEachOther);
|
||||
RUNTEST(testAllChars);
|
||||
}
|
||||
{
|
||||
testJSONDebug_JSON_ASSERT ttt("testJSONDebug_JSON_ASSERT");
|
||||
RUNTEST(testPass);
|
||||
RUNTEST(testFail);
|
||||
}
|
||||
{
|
||||
testJSONDebug_JSON_ASSERT_SAFE ttt("testJSONDebug_JSON_ASSERT_SAFE");
|
||||
RUNTEST(testPass);
|
||||
RUNTEST(testFail);
|
||||
}
|
||||
{
|
||||
testJSONDebug_JSON_FAIL ttt("testJSONDebug_JSON_FAIL");
|
||||
RUNTEST(testFail);
|
||||
}
|
||||
{
|
||||
testJSONDebug_JSON_FAIL_SAFE ttt("testJSONDebug_JSON_FAIL_SAFE");
|
||||
RUNTEST(testFail);
|
||||
}
|
||||
{
|
||||
testJSONGlobals__jsonSingleton ttt("testJSONGlobals__jsonSingleton");
|
||||
RUNTEST(testValue);
|
||||
RUNTEST(testNoValue);
|
||||
}
|
||||
{
|
||||
testJSONValidator__isValidMember ttt("testJSONValidator__isValidMember");
|
||||
RUNTEST(testMembers);
|
||||
RUNTEST(testStrict);
|
||||
RUNTEST(testNotStrict);
|
||||
RUNTEST(testNotMembers);
|
||||
RUNTEST(testSuddenEnd);
|
||||
}
|
||||
{
|
||||
testJSONValidator__isValidNumber ttt("testJSONValidator__isValidNumber");
|
||||
RUNTEST(testPositive);
|
||||
RUNTEST(testNegative);
|
||||
RUNTEST(testPositive_ScientificNotation);
|
||||
RUNTEST(testNegative_ScientificNotation);
|
||||
RUNTEST(testPositive_SignedScientificNotation);
|
||||
RUNTEST(testNegative_SignedScientificNotation);
|
||||
RUNTEST(testSuddenEnd);
|
||||
}
|
||||
{
|
||||
testJSONValidator__isValidRoot ttt("testJSONValidator__isValidRoot");
|
||||
RUNTEST(testRoots);
|
||||
RUNTEST(testNotRoots);
|
||||
RUNTEST(testSuddenEnd);
|
||||
}
|
||||
{
|
||||
testJSONValidator__isValidString ttt("testJSONValidator__isValidString");
|
||||
RUNTEST(testNormal);
|
||||
RUNTEST(testUnicode);
|
||||
RUNTEST(testStrict);
|
||||
RUNTEST(testNotStrict);
|
||||
RUNTEST(testNotString);
|
||||
RUNTEST(testSuddenEnd);
|
||||
}
|
||||
{
|
||||
testJSONValidator__securityTest ttt("testJSONValidator__securityTest");
|
||||
RUNTEST(testsecurity);
|
||||
}
|
||||
{
|
||||
testNumberToString__areFloatsEqual ttt("testNumberToString__areFloatsEqual");
|
||||
RUNTEST(testEqual);
|
||||
RUNTEST(testNotEqual);
|
||||
RUNTEST(testCloseEnough);
|
||||
}
|
||||
|
||||
{
|
||||
testNumberToString__atof ttt("testNumberToString__atof");
|
||||
RUNTEST(testPositive);
|
||||
RUNTEST(testNegative);
|
||||
RUNTEST(testPositive_ScientificNotation);
|
||||
RUNTEST(testNegative_ScientificNotation);
|
||||
RUNTEST(testPositive_SignedScientificNotation);
|
||||
RUNTEST(testNegative_SignedScientificNotation);
|
||||
RUNTEST(testStrict);
|
||||
RUNTEST(testNotNumbers);
|
||||
}
|
||||
|
||||
{
|
||||
testNumberToString__ftoa ttt("testNumberToString__ftoa");
|
||||
RUNTEST(testRandomNumbers);
|
||||
RUNTEST(testSpecializedInts);
|
||||
}
|
||||
{
|
||||
testNumberToString__itoa ttt("testNumberToString__itoa");
|
||||
RUNTEST(testChar);
|
||||
RUNTEST(testShort);
|
||||
RUNTEST(testInt);
|
||||
RUNTEST(testLong);
|
||||
RUNTEST(testLongLong);
|
||||
}
|
||||
{
|
||||
testNumberToString__uitoa ttt("testNumberToString__uitoa");
|
||||
RUNTEST(testChar);
|
||||
RUNTEST(testShort);
|
||||
RUNTEST(testInt);
|
||||
RUNTEST(testLong);
|
||||
RUNTEST(testLongLong);
|
||||
}
|
||||
{
|
||||
testNumberToString__getLenSize ttt("testNumberToString__getLenSize");
|
||||
RUNTEST(testStruct);
|
||||
}
|
||||
{
|
||||
testNumberToString__isNumeric ttt("testNumberToString__isNumeric");
|
||||
RUNTEST(testPositive);
|
||||
RUNTEST(testNegative);
|
||||
RUNTEST(testPositive_ScientificNotation);
|
||||
RUNTEST(testNegative_ScientificNotation);
|
||||
RUNTEST(testPositive_SignedScientificNotation);
|
||||
RUNTEST(testNegative_SignedScientificNotation);
|
||||
RUNTEST(testNotNumbers);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
#ifndef RUN_TEST_SUITE2_H
|
||||
#define RUN_TEST_SUITE2_H
|
||||
|
||||
class RunTestSuite2 {
|
||||
public:
|
||||
static void RunTests(void);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,297 +0,0 @@
|
|||
#ifndef STRING_TEST_H
|
||||
#define STRING_TEST_H
|
||||
|
||||
/*
|
||||
* Developer note: This is not a fully functionaly string and is not meant to be used as such.
|
||||
* It is merely to serve as a testing module
|
||||
*/
|
||||
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
|
||||
typedef char mychar;
|
||||
|
||||
static size_t mystrlen(const mychar * str){
|
||||
unsigned int i = 0;
|
||||
for(const mychar * it = str; *it; ++it, ++i){
|
||||
//dummy
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
class json_string {
|
||||
public:
|
||||
struct const_iterator {
|
||||
inline const_iterator& operator ++(void) { ++it; return *this; }
|
||||
inline const_iterator& operator --(void) { --it; return *this; }
|
||||
inline const_iterator& operator +=(long i) { it += i; return *this; }
|
||||
inline const_iterator& operator -=(long i) { it -= i; return *this; }
|
||||
inline const_iterator operator ++(int) {
|
||||
const_iterator result(*this);
|
||||
++it;
|
||||
return result;
|
||||
}
|
||||
inline const_iterator operator --(int) {
|
||||
const_iterator result(*this);
|
||||
--it;
|
||||
return result;
|
||||
}
|
||||
inline const_iterator operator +(long i) const {
|
||||
const_iterator result(*this);
|
||||
result.it += i;
|
||||
return result;
|
||||
}
|
||||
inline const_iterator operator -(long i) const {
|
||||
const_iterator result(*this);
|
||||
result.it -= i;
|
||||
return result;
|
||||
}
|
||||
inline size_t operator -(const_iterator other) const {
|
||||
return it - other.it;
|
||||
}
|
||||
inline mychar & operator [](size_t pos) const { return it[pos]; };
|
||||
inline mychar & operator *(void) const { return *it; }
|
||||
inline bool operator == (const const_iterator & other) const { return it == other.it; }
|
||||
inline bool operator != (const const_iterator & other) const { return it != other.it; }
|
||||
inline bool operator > (const const_iterator & other) const { return it > other.it; }
|
||||
inline bool operator >= (const const_iterator & other) const { return it >= other.it; }
|
||||
inline bool operator < (const const_iterator & other) const { return it < other.it; }
|
||||
inline bool operator <= (const const_iterator & other) const { return it <= other.it; }
|
||||
inline const_iterator & operator = (const const_iterator & orig) { it = orig.it; return *this; }
|
||||
const_iterator (const const_iterator & orig) : it(orig.it) {}
|
||||
const_iterator (const mychar * place) : it((mychar*)place) {}
|
||||
const_iterator(void) : it(0) {};
|
||||
|
||||
mychar * it;
|
||||
};
|
||||
|
||||
struct iterator {
|
||||
inline iterator& operator ++(void) { ++it; return *this; }
|
||||
inline iterator& operator --(void) { --it; return *this; }
|
||||
inline iterator& operator +=(long i) { it += i; return *this; }
|
||||
inline iterator& operator -=(long i) { it -= i; return *this; }
|
||||
inline iterator operator ++(int) {
|
||||
iterator result(*this);
|
||||
++it;
|
||||
return result;
|
||||
}
|
||||
inline iterator operator --(int) {
|
||||
iterator result(*this);
|
||||
--it;
|
||||
return result;
|
||||
}
|
||||
inline iterator operator +(long i) const {
|
||||
iterator result(*this);
|
||||
result.it += i;
|
||||
return result;
|
||||
}
|
||||
inline iterator operator -(long i) const {
|
||||
iterator result(*this);
|
||||
result.it -= i;
|
||||
return result;
|
||||
}
|
||||
inline mychar & operator [](size_t pos) const { return it[pos]; };
|
||||
inline mychar & operator *(void) const { return *it; }
|
||||
inline bool operator == (const iterator & other) const { return it == other.it; }
|
||||
inline bool operator != (const iterator & other) const { return it != other.it; }
|
||||
inline bool operator > (const iterator & other) const { return it > other.it; }
|
||||
inline bool operator >= (const iterator & other) const { return it >= other.it; }
|
||||
inline bool operator < (const iterator & other) const { return it < other.it; }
|
||||
inline bool operator <= (const iterator & other) const { return it <= other.it; }
|
||||
inline iterator & operator = (const iterator & orig) { it = orig.it; return *this; }
|
||||
inline operator const_iterator() const json_nothrow { return const_iterator(it); }
|
||||
iterator (const iterator & orig) : it(orig.it) {}
|
||||
iterator (const mychar * place) : it((mychar*)place) {}
|
||||
|
||||
mychar * it;
|
||||
};
|
||||
|
||||
|
||||
|
||||
const static size_t npos = 0xFFFFFFFF;
|
||||
json_string(void) : len(0), str(0){
|
||||
setToCStr("", 0);
|
||||
}
|
||||
|
||||
json_string(const mychar * meh) : len(0), str(0){
|
||||
setToCStr(meh, mystrlen(meh));
|
||||
}
|
||||
|
||||
json_string(const mychar * meh, size_t l) : len(l), str(0){
|
||||
setToCStr(meh, l);
|
||||
str[len] = '\0';
|
||||
}
|
||||
|
||||
json_string(const iterator & beg, const iterator & en) : len(0), str(0){
|
||||
setToCStr(beg.it, en.it - beg.it);
|
||||
str[len] = '\0';
|
||||
}
|
||||
|
||||
json_string(const const_iterator & beg, const const_iterator & en) : len(0), str(0){
|
||||
setToCStr(beg.it, en.it - beg.it);
|
||||
str[len] = '\0';
|
||||
}
|
||||
|
||||
json_string(const json_string & meh) : len(0), str(0){
|
||||
setToCStr(meh.c_str(), meh.len);
|
||||
}
|
||||
|
||||
~json_string(void){ std::free(str); };
|
||||
|
||||
json_string(unsigned int l, mychar meh) : len(0), str(0){
|
||||
str = (mychar*)std::malloc((l + 1) * sizeof(mychar));
|
||||
len = l;
|
||||
for (unsigned int i = 0; i < l; ++i){
|
||||
str[i] = meh;
|
||||
}
|
||||
str[l] = '\0';
|
||||
}
|
||||
|
||||
void swap(json_string & meh){
|
||||
size_t _len = len;
|
||||
mychar * _str = str;
|
||||
len = meh.len;
|
||||
str = meh.str;
|
||||
meh.len = _len;
|
||||
meh.str = _str;
|
||||
}
|
||||
|
||||
iterator begin(void){ return iterator(str); };
|
||||
iterator end(void){ return iterator(str + length()); };
|
||||
const iterator begin(void) const { return iterator(str); };
|
||||
const iterator end(void) const { return iterator(str + length()); };
|
||||
void assign(const iterator & beg, const iterator & en){
|
||||
json_string(beg, en).swap(*this);
|
||||
}
|
||||
json_string & append(const iterator & beg, const iterator & en){
|
||||
json_string temp(beg, en);
|
||||
return *this += temp;
|
||||
}
|
||||
|
||||
const mychar * c_str(void) const { return str; };
|
||||
const mychar * data(void) const { return str; };
|
||||
size_t length(void) const { return len; };
|
||||
size_t capacity(void) const { return len; };
|
||||
bool empty(void) const { return len == 0; };
|
||||
|
||||
bool operator ==(const json_string & other) const {
|
||||
if (len != other.len) return false;
|
||||
return memcmp(str, other.str, len * sizeof(mychar)) == 0;
|
||||
}
|
||||
|
||||
bool operator !=(const json_string & other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
const char & operator[] (size_t pos) const { return str[pos]; }
|
||||
char & operator[] ( size_t pos ){ return str[pos]; }
|
||||
|
||||
json_string & operator = (const json_string & meh) {
|
||||
std::free(str);
|
||||
setToCStr(meh.c_str(), meh.len);
|
||||
return *this;
|
||||
}
|
||||
|
||||
json_string & operator = (const mychar * meh) {
|
||||
std::free(str);
|
||||
setToCStr(meh, mystrlen(meh));
|
||||
return *this;
|
||||
}
|
||||
|
||||
json_string & operator += (const json_string & other) {
|
||||
size_t newlen = len + other.len;
|
||||
mychar * newstr = (mychar*)std::malloc((newlen + 1) * sizeof(mychar));
|
||||
std::memcpy(newstr, str, len * sizeof(mychar));
|
||||
std::memcpy(newstr + len, other.str, (other.len + 1) * sizeof(mychar));
|
||||
len = newlen;
|
||||
std::free(str);
|
||||
str = newstr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const json_string operator + (const json_string & other) const {
|
||||
json_string result = *this;
|
||||
result += other;
|
||||
return result;
|
||||
}
|
||||
|
||||
json_string & operator += (const mychar other) {
|
||||
mychar temp[2] = {other, '\0'};
|
||||
json_string temp_s(temp);
|
||||
return (*this) += temp_s;
|
||||
}
|
||||
|
||||
const json_string operator + (const mychar other) const {
|
||||
json_string result = *this;
|
||||
result += other;
|
||||
return result;
|
||||
}
|
||||
|
||||
void reserve(size_t){}; //noop, its just a test
|
||||
void clear(void){setToCStr("", 0);}
|
||||
|
||||
json_string substr(size_t pos = 0, size_t n = npos) const {
|
||||
json_string res(false, false, false);
|
||||
if (n > len) n = len;
|
||||
if (n + pos > len) n = len - pos;
|
||||
res.setToCStr(str + pos, n);
|
||||
res.str[n] = L'\0';
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
size_t find ( mychar c, size_t pos = 0 ) const {
|
||||
if (pos > len) return npos;
|
||||
for(mychar * i = str + pos; *i; ++i){
|
||||
if (*i == c) return i - str;
|
||||
}
|
||||
return npos;
|
||||
}
|
||||
|
||||
size_t find_first_not_of ( const mychar* s, size_t pos = 0 ) const {
|
||||
if (pos > len) return npos;
|
||||
for(mychar * i = str + pos; *i; ++i){
|
||||
bool found = false;
|
||||
for(const mychar * k = s; *k; ++k){
|
||||
if (*i == *k){
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) return i - str;
|
||||
}
|
||||
return npos;
|
||||
}
|
||||
|
||||
size_t find_first_of ( const mychar* s, size_t pos = 0 ) const {
|
||||
if (pos > len) return npos;
|
||||
for(mychar * i = str + pos; *i; ++i){
|
||||
for(const mychar * k = s; *k; ++k){
|
||||
if (*i == *k){
|
||||
return i - str;
|
||||
}
|
||||
}
|
||||
}
|
||||
return npos;
|
||||
}
|
||||
|
||||
iterator erase(iterator it, iterator it2){
|
||||
size_t mov = it2.it - it.it;
|
||||
std::memmove(str, it2.it, (len - mov + 1) * sizeof(mychar)); //+1 for null terminator
|
||||
len -= mov;
|
||||
return it;
|
||||
}
|
||||
private:
|
||||
json_string(bool, bool, bool) : len(0), str(0){};
|
||||
|
||||
void setToCStr(const mychar * st, size_t l){
|
||||
len = l;
|
||||
str = (mychar*)std::memcpy(std::malloc((len + 1) * sizeof(mychar)), st, (len + 1) * sizeof(mychar));
|
||||
}
|
||||
|
||||
size_t len;
|
||||
mychar * str;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,155 +0,0 @@
|
|||
#include "TestSuite.h"
|
||||
#include "../Source/JSONNode.h"
|
||||
|
||||
void TestSuite::TestAssigning(void){
|
||||
UnitTest::SetPrefix("TestAssign.cpp - Assigning");
|
||||
#ifdef JSON_LIBRARY
|
||||
//check names
|
||||
JSONNODE * test1 = json_new(JSON_NODE);
|
||||
json_set_name(test1, JSON_TEXT("hello world"));
|
||||
json_char * res = json_name(test1);
|
||||
assertCStringSame(res, JSON_TEXT("hello world"));
|
||||
json_free(res);
|
||||
|
||||
//check strings
|
||||
json_set_a(test1, JSON_TEXT("Hello world"));
|
||||
assertEquals(json_type(test1), JSON_STRING);
|
||||
res = json_as_string(test1);
|
||||
assertCStringSame(res, JSON_TEXT("Hello world"));
|
||||
json_free(res);
|
||||
|
||||
//check ints
|
||||
json_set_i(test1, 13);
|
||||
assertEquals(json_type(test1), JSON_NUMBER);
|
||||
res = json_as_string(test1);
|
||||
#ifdef JSON_CASTABLE
|
||||
assertCStringSame(res, JSON_TEXT("13"));
|
||||
#endif
|
||||
json_free(res);
|
||||
assertEquals(json_as_int(test1), 13);
|
||||
assertEquals(json_as_float(test1), 13.0f);
|
||||
|
||||
//check doubles work
|
||||
json_set_f(test1, 13.7f);
|
||||
assertEquals(json_type(test1), JSON_NUMBER);
|
||||
res = json_as_string(test1);
|
||||
#ifdef JSON_CASTABLE
|
||||
assertCStringSame(res, JSON_TEXT("13.7"));
|
||||
#endif
|
||||
json_free(res);
|
||||
assertEquals(json_as_int(test1), 13);
|
||||
assertEquals(json_as_float(test1), 13.7f);
|
||||
|
||||
//test making sure stripping the trailing period works
|
||||
json_set_f(test1, 13.0f);
|
||||
assertEquals(json_type(test1), JSON_NUMBER);
|
||||
res = json_as_string(test1);
|
||||
#ifdef JSON_CASTABLE
|
||||
assertCStringSame(res, JSON_TEXT("13"));
|
||||
#endif
|
||||
json_free(res);
|
||||
assertEquals(json_as_int(test1), 13);
|
||||
assertEquals(json_as_float(test1), 13.0f);
|
||||
|
||||
//check boolean
|
||||
json_set_b(test1, (int)true);
|
||||
assertEquals(json_type(test1), JSON_BOOL);
|
||||
res = json_as_string(test1);
|
||||
#ifdef JSON_CASTABLE
|
||||
assertCStringSame(res, JSON_TEXT("true"));
|
||||
#endif
|
||||
json_free(res);
|
||||
assertEquals(json_as_bool(test1), true);
|
||||
|
||||
//check boolean
|
||||
json_set_b(test1, false);
|
||||
assertEquals(json_type(test1), JSON_BOOL);
|
||||
res = json_as_string(test1);
|
||||
#ifdef JSON_CASTABLE
|
||||
assertCStringSame(res, JSON_TEXT("false"));
|
||||
#endif
|
||||
json_free(res);
|
||||
assertEquals(json_as_bool(test1), false);
|
||||
|
||||
//check null
|
||||
json_nullify(test1);
|
||||
assertEquals(json_type(test1), JSON_NULL);
|
||||
res = json_as_string(test1);
|
||||
#ifdef JSON_CASTABLE
|
||||
assertCStringSame(res, JSON_TEXT("null"));
|
||||
#endif
|
||||
json_free(res);
|
||||
|
||||
json_delete(test1);
|
||||
|
||||
#else
|
||||
//check names
|
||||
JSONNode test1;
|
||||
test1.set_name(JSON_TEXT("hello world"));
|
||||
assertEquals(test1.name(), JSON_TEXT("hello world"));
|
||||
|
||||
//check strings
|
||||
test1 = JSON_TEXT("Hello world");
|
||||
assertEquals(test1.type(), JSON_STRING);
|
||||
assertEquals(test1.as_string(), JSON_TEXT("Hello world"));
|
||||
|
||||
//test chars
|
||||
test1 = JSON_TEXT('\0');
|
||||
assertEquals(test1.type(), JSON_NUMBER);
|
||||
#ifdef JSON_CASTABLE
|
||||
assertEquals(test1.as_string(), JSON_TEXT("0"));
|
||||
#endif
|
||||
assertEquals(test1.as_int(), 0);
|
||||
assertEquals(test1.as_float(), 0.0f);
|
||||
|
||||
//check ints
|
||||
test1 = 13;
|
||||
assertEquals(test1.type(), JSON_NUMBER);
|
||||
#ifdef JSON_CASTABLE
|
||||
assertEquals(test1.as_string(), JSON_TEXT("13"));
|
||||
#endif
|
||||
assertEquals(test1.as_int(), 13);
|
||||
assertEquals(test1.as_float(), 13.0f);
|
||||
|
||||
//check doubles work
|
||||
test1 = 13.7f;
|
||||
assertEquals(test1.type(), JSON_NUMBER);
|
||||
#ifdef JSON_CASTABLE
|
||||
assertEquals(test1.as_string(), JSON_TEXT("13.7"));
|
||||
#endif
|
||||
assertEquals(test1.as_int(), 13);
|
||||
assertEquals(test1.as_float(), 13.7f);
|
||||
|
||||
//test making sure stripping hte trailing period works
|
||||
test1 = 13.0f;
|
||||
assertEquals(test1.type(), JSON_NUMBER);
|
||||
#ifdef JSON_CASTABLE
|
||||
assertEquals(test1.as_string(), JSON_TEXT("13"));
|
||||
#endif
|
||||
assertEquals(test1.as_int(), 13);
|
||||
assertEquals(test1.as_float(), 13.0f);
|
||||
|
||||
//check boolean
|
||||
test1 = true;
|
||||
assertEquals(test1.type(), JSON_BOOL);
|
||||
#ifdef JSON_CASTABLE
|
||||
assertEquals(test1.as_string(), JSON_TEXT("true"));
|
||||
#endif
|
||||
assertEquals(test1.as_bool(), true);
|
||||
|
||||
//check boolean
|
||||
test1 = false;
|
||||
assertEquals(test1.type(), JSON_BOOL);
|
||||
#ifdef JSON_CASTABLE
|
||||
assertEquals(test1.as_string(), JSON_TEXT("false"));
|
||||
#endif
|
||||
assertEquals(test1.as_bool(), false);
|
||||
|
||||
//check null
|
||||
test1.nullify();
|
||||
assertEquals(test1.type(), JSON_NULL);
|
||||
#ifdef JSON_CASTABLE
|
||||
assertEquals(test1.as_string(), JSON_TEXT("null"));
|
||||
#endif
|
||||
#endif
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
#include "TestSuite.h"
|
||||
#include "../Source/JSON_Base64.h"
|
||||
|
||||
#if defined(JSON_BINARY) || defined(JSON_EXPOSE_BASE64)
|
||||
void TestSuite::TestBase64(void){
|
||||
UnitTest::SetPrefix("TestBinary.cpp - Base 64");
|
||||
|
||||
assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"A", 1)), "A");
|
||||
assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"AB", 2)), "AB");
|
||||
assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"ABC", 3)), "ABC");
|
||||
assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"ABCD", 4)), "ABCD");
|
||||
#ifdef JSON_SAFE
|
||||
assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"", 0)), "");
|
||||
assertEquals(JSONBase64::json_decode64(JSON_TEXT("123!abc")), "");
|
||||
assertEquals(JSONBase64::json_decode64(JSON_TEXT("123=abc")), "");
|
||||
assertEquals(JSONBase64::json_decode64(JSON_TEXT("123abc===")), "");
|
||||
#endif
|
||||
|
||||
unsigned char temp[255];
|
||||
for(unsigned int i = 0; i < 255; ++i){
|
||||
temp[i] = (unsigned char)i;
|
||||
}
|
||||
json_string ts = JSONBase64::json_encode64(temp, 255);
|
||||
std::string rs = JSONBase64::json_decode64(ts);
|
||||
assertEquals(rs.size(), 255);
|
||||
assertEquals(memcmp(rs.data(), temp, 255), 0);
|
||||
|
||||
#if defined(JSON_LIBRARY) && defined(JSON_EXPOSE_BASE64)
|
||||
json_char * test = json_encode64(temp, 255);
|
||||
assertNotNull(test);
|
||||
unsigned long _size;
|
||||
void * bin = json_decode64(test, & _size);
|
||||
assertNotNull(bin);
|
||||
assertEquals(_size, 255);
|
||||
assertEquals(memcmp(bin, temp, 255), 0);
|
||||
json_free(test);
|
||||
json_free(bin);
|
||||
#endif
|
||||
}
|
||||
#endif
|
|
@ -1,340 +0,0 @@
|
|||
#include "TestSuite.h"
|
||||
#include "../Source/JSONNode.h"
|
||||
|
||||
void TestSuite::TestChildren(void){
|
||||
UnitTest::SetPrefix("TestChildren.cpp - Children");
|
||||
#ifdef JSON_LIBRARY
|
||||
#define assertChild(node, index, func, value)\
|
||||
if (JSONNODE * blabla = json_at(node, index)){\
|
||||
assertEquals(func(blabla), value);\
|
||||
} else {\
|
||||
FAIL("no child");\
|
||||
}
|
||||
|
||||
JSONNODE * test1 = json_new(JSON_NODE);
|
||||
JSONNODE * test2 = json_new(JSON_NODE);
|
||||
|
||||
|
||||
TestSuite::testParsingItself(test1);
|
||||
TestSuite::testParsingItself(test2);
|
||||
|
||||
assertEquals(json_type(test1), JSON_NODE);
|
||||
assertEquals(json_type(test2), JSON_NODE);
|
||||
assertEquals(json_size(test1), 0);
|
||||
assertEquals(json_size(test2), 0);
|
||||
assertTrue(json_equal(test1, test2));
|
||||
|
||||
|
||||
json_push_back(test1, json_new_a(JSON_TEXT("hi"), JSON_TEXT("world")));
|
||||
assertEquals(json_size(test1), 1);
|
||||
assertFalse(json_equal(test1, test2));
|
||||
json_push_back(test2, json_new_a(JSON_TEXT("hi"), JSON_TEXT("world")));
|
||||
assertEquals(json_size(test2), 1);
|
||||
assertTrue(json_equal(test1, test2));
|
||||
|
||||
TestSuite::testParsingItself(test1);
|
||||
TestSuite::testParsingItself(test2);
|
||||
|
||||
json_merge(test1, test2);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
#ifdef JSON_REF_COUNT
|
||||
assertEquals(((JSONNode*)test1) -> internal, ((JSONNode*)test2) -> internal);
|
||||
#else
|
||||
assertNotEquals(((JSONNode*)test1) -> internal, ((JSONNode*)test2) -> internal);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
UnitTest::SetPrefix("TestChildren.cpp - Children 2");
|
||||
|
||||
if (JSONNODE * temp = json_at(test1, 0)){
|
||||
json_char * str = json_as_string(temp);
|
||||
assertCStringSame(str, JSON_TEXT("world"));
|
||||
json_free(str);
|
||||
str = json_name(temp);
|
||||
assertCStringSame(str, JSON_TEXT("hi"));
|
||||
json_free(str);
|
||||
} else {
|
||||
FAIL("at failed");
|
||||
}
|
||||
|
||||
TestSuite::testParsingItself(test1);
|
||||
TestSuite::testParsingItself(test2);
|
||||
|
||||
assertEquals(json_size(test1), 1);
|
||||
if (JSONNODE * temp = json_pop_back_at(test1, 0)){
|
||||
json_char * str = json_as_string(temp);
|
||||
assertCStringSame(str, JSON_TEXT("world"));
|
||||
json_free(str);
|
||||
assertEquals(json_size(test1), 0);
|
||||
json_delete(temp);
|
||||
} else {
|
||||
FAIL("POP FAILED");
|
||||
}
|
||||
|
||||
UnitTest::SetPrefix("TestChildren.cpp - Children 3");
|
||||
|
||||
json_push_back(test1, json_new_a(JSON_TEXT("hi"), JSON_TEXT("world")));
|
||||
if (JSONNODE * temp = json_pop_back(test1, JSON_TEXT("hi"))){
|
||||
json_char * str = json_as_string(temp);
|
||||
assertCStringSame(str, JSON_TEXT("world"));
|
||||
json_free(str);
|
||||
assertEquals(json_size(test1), 0);
|
||||
json_delete(temp);
|
||||
} else {
|
||||
FAIL("POP name FAILED");
|
||||
}
|
||||
|
||||
#ifdef JSON_CASE_INSENSITIVE_FUNCTIONS
|
||||
json_push_back(test1, json_new_a(JSON_TEXT("hi"), JSON_TEXT("world")));
|
||||
if (JSONNODE * temp = json_pop_back_nocase(test1, JSON_TEXT("HI"))){
|
||||
json_char * str = json_as_string(temp);
|
||||
assertCStringSame(str, JSON_TEXT("world"));
|
||||
json_free(str);
|
||||
assertEquals(json_size(test1), 0);
|
||||
json_delete(temp);
|
||||
} else {
|
||||
FAIL("POP name FAILED");
|
||||
}
|
||||
#endif
|
||||
|
||||
TestSuite::testParsingItself(test1);
|
||||
TestSuite::testParsingItself(test2);
|
||||
|
||||
UnitTest::SetPrefix("TestChildren.cpp - Children 4");
|
||||
|
||||
|
||||
assertEquals(json_size(test1), 0);
|
||||
json_push_back(test1, json_new_i(JSON_TEXT("one"), 1));
|
||||
json_push_back(test1, json_new_i(JSON_TEXT("two"), 2));
|
||||
json_push_back(test1, json_new_i(JSON_TEXT("three"), 3));
|
||||
json_push_back(test1, json_new_i(JSON_TEXT("four"), 4));
|
||||
json_push_back(test1, json_new_i(JSON_TEXT("five"), 5));
|
||||
json_push_back(test1, json_new_i(JSON_TEXT("six"), 6));
|
||||
assertEquals(json_size(test1), 6);
|
||||
|
||||
TestSuite::testParsingItself(test1);
|
||||
TestSuite::testParsingItself(test2);
|
||||
|
||||
|
||||
if (JSONNODE * temp = json_pop_back(test1, JSON_TEXT("four"))){
|
||||
assertEquals(json_as_int(temp), 4);
|
||||
assertChild(test1, 0, json_as_int, 1);
|
||||
assertChild(test1, 1, json_as_int, 2);
|
||||
assertChild(test1, 2, json_as_int, 3);
|
||||
assertChild(test1, 3, json_as_int, 5);
|
||||
assertChild(test1, 4, json_as_int, 6);
|
||||
assertEquals(json_size(test1), 5);
|
||||
|
||||
TestSuite::testParsingItself(test1);
|
||||
TestSuite::testParsingItself(test2);
|
||||
json_delete(temp);
|
||||
} else {
|
||||
FAIL("no pop");
|
||||
}
|
||||
|
||||
UnitTest::SetPrefix("TestChildren.cpp - Children 5");
|
||||
|
||||
#ifdef JSON_CASE_INSENSITIVE_FUNCTIONS
|
||||
if (JSONNODE * temp = json_pop_back_nocase(test1, JSON_TEXT("SIX"))){
|
||||
#else
|
||||
if (JSONNODE * temp = json_pop_back(test1, JSON_TEXT("six"))){
|
||||
#endif
|
||||
assertEquals(json_as_int(temp), 6);
|
||||
assertChild(test1, 0, json_as_int, 1);
|
||||
assertChild(test1, 1, json_as_int, 2);
|
||||
assertChild(test1, 2, json_as_int, 3);
|
||||
assertChild(test1, 3, json_as_int, 5);
|
||||
assertEquals(json_size(test1), 4);
|
||||
|
||||
TestSuite::testParsingItself(test1);
|
||||
TestSuite::testParsingItself(test2);
|
||||
json_delete(temp);
|
||||
} else {
|
||||
FAIL("no pop_nocase");
|
||||
}
|
||||
|
||||
UnitTest::SetPrefix("TestChildren.cpp - Children 6");
|
||||
|
||||
if (JSONNODE * temp = json_pop_back_at(test1, 2)){
|
||||
assertEquals(json_as_int(temp), 3);
|
||||
assertChild(test1, 0, json_as_int, 1);
|
||||
assertChild(test1, 1, json_as_int, 2);
|
||||
assertChild(test1, 2, json_as_int, 5);
|
||||
assertEquals(json_size(test1), 3);
|
||||
|
||||
TestSuite::testParsingItself(test1);
|
||||
TestSuite::testParsingItself(test2);
|
||||
json_delete(temp);
|
||||
} else {
|
||||
FAIL("no pop 2");
|
||||
}
|
||||
|
||||
json_delete(test1);
|
||||
json_delete(test2);
|
||||
|
||||
#ifdef JSON_UNIT_TEST
|
||||
JSONNODE * fresh = json_new(JSON_NODE);
|
||||
json_reserve(fresh, 3);
|
||||
assertEquals(((JSONNode*)fresh) -> internal -> CHILDREN -> mycapacity, 3);
|
||||
assertEquals(((JSONNode*)fresh) -> internal -> CHILDREN -> mysize, 0);
|
||||
json_push_back(fresh, json_new(JSON_NULL));
|
||||
assertEquals(((JSONNode*)fresh) -> internal -> CHILDREN -> mycapacity, 3);
|
||||
assertEquals(((JSONNode*)fresh) -> internal -> CHILDREN -> mysize, 1);
|
||||
json_push_back(fresh, json_new(JSON_NULL));
|
||||
assertEquals(((JSONNode*)fresh) -> internal -> CHILDREN -> mycapacity, 3);
|
||||
assertEquals(((JSONNode*)fresh) -> internal -> CHILDREN -> mysize, 2);
|
||||
json_push_back(fresh, json_new(JSON_NULL));
|
||||
assertEquals(((JSONNode*)fresh) -> internal -> CHILDREN -> mycapacity, 3);
|
||||
assertEquals(((JSONNode*)fresh) -> internal -> CHILDREN -> mysize, 3);
|
||||
json_delete(fresh);
|
||||
#endif
|
||||
|
||||
|
||||
#else
|
||||
JSONNode test1;
|
||||
JSONNode test2;
|
||||
TestSuite::testParsingItself(test1);
|
||||
TestSuite::testParsingItself(test2);
|
||||
|
||||
assertEquals(test1.type(), JSON_NODE);
|
||||
assertEquals(test2.type(), JSON_NODE);
|
||||
assertEquals(test1.size(), 0);
|
||||
assertEquals(test2.size(), 0);
|
||||
assertEquals(test1, test2);
|
||||
test1.push_back(JSONNode(JSON_TEXT("hi"), JSON_TEXT("world")));
|
||||
assertEquals(test1.size(), 1);
|
||||
assertNotEquals(test1, test2);
|
||||
test2.push_back(JSONNode(JSON_TEXT("hi"), JSON_TEXT("world")));
|
||||
assertEquals(test2.size(), 1);
|
||||
assertEquals(test1, test2);
|
||||
|
||||
TestSuite::testParsingItself(test1);
|
||||
TestSuite::testParsingItself(test2);
|
||||
|
||||
test1.merge(test2);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
#ifdef JSON_REF_COUNT
|
||||
assertEquals(test1.internal, test2.internal);
|
||||
#else
|
||||
assertNotEquals(test1.internal, test2.internal);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
try {
|
||||
assertEquals(test1.at(0), JSON_TEXT("world"));
|
||||
assertEquals(test1.at(0).name(), JSON_TEXT("hi"));
|
||||
} catch (std::out_of_range){
|
||||
FAIL("exception caught");
|
||||
}
|
||||
|
||||
TestSuite::testParsingItself(test1);
|
||||
TestSuite::testParsingItself(test2);
|
||||
|
||||
assertEquals(test1.size(), 1);
|
||||
try {
|
||||
JSONNode res = test1.pop_back(0);
|
||||
assertEquals(res, JSON_TEXT("world"));
|
||||
assertEquals(test1.size(), 0);
|
||||
test1.push_back(JSONNode(JSON_TEXT("hi"), JSON_TEXT("world")));
|
||||
res = test1.pop_back(JSON_TEXT("hi"));
|
||||
assertEquals(res, JSON_TEXT("world"));
|
||||
assertEquals(test1.size(), 0);
|
||||
#ifdef JSON_CASE_INSENSITIVE_FUNCTIONS
|
||||
test1.push_back(JSONNode(JSON_TEXT("hi"), JSON_TEXT("world")));
|
||||
res = test1.pop_back_nocase(JSON_TEXT("HI"));
|
||||
assertEquals(res, JSON_TEXT("world"));
|
||||
assertEquals(test1.size(), 0);
|
||||
#endif
|
||||
} catch (std::out_of_range){
|
||||
FAIL("exception caught 2");
|
||||
}
|
||||
|
||||
TestSuite::testParsingItself(test1);
|
||||
TestSuite::testParsingItself(test2);
|
||||
|
||||
|
||||
assertEquals(test1.size(), 0);
|
||||
test1.push_back(JSONNode(JSON_TEXT("one"), 1));
|
||||
test1.push_back(JSONNode(JSON_TEXT("two"), 2));
|
||||
test1.push_back(JSONNode(JSON_TEXT("three"), 3));
|
||||
test1.push_back(JSONNode(JSON_TEXT("four"), 4));
|
||||
test1.push_back(JSONNode(JSON_TEXT("five"), 5));
|
||||
test1.push_back(JSONNode(JSON_TEXT("six"), 6));
|
||||
assertEquals(test1.size(), 6);
|
||||
|
||||
TestSuite::testParsingItself(test1);
|
||||
TestSuite::testParsingItself(test2);
|
||||
|
||||
//echo(test1.dump().write_formatted());
|
||||
|
||||
JSONNode res;
|
||||
|
||||
try {
|
||||
res = test1.pop_back(JSON_TEXT("four"));
|
||||
assertEquals(res, 4);
|
||||
assertEquals(test1[0], 1);
|
||||
assertEquals(test1[1], 2);
|
||||
assertEquals(test1[2], 3);
|
||||
assertEquals(test1[3], 5);
|
||||
assertEquals(test1[4], 6);
|
||||
assertEquals(test1.size(), 5);
|
||||
|
||||
TestSuite::testParsingItself(test1);
|
||||
TestSuite::testParsingItself(test2);
|
||||
} catch (std::out_of_range){
|
||||
FAIL("exception caught pop");
|
||||
}
|
||||
|
||||
try {
|
||||
#ifdef JSON_CASE_INSENSITIVE_FUNCTIONS
|
||||
res = test1.pop_back_nocase(JSON_TEXT("SIX"));
|
||||
#else
|
||||
res = test1.pop_back(JSON_TEXT("six"));
|
||||
#endif
|
||||
assertEquals(res, 6);
|
||||
assertEquals(test1[0], 1);
|
||||
assertEquals(test1[1], 2);
|
||||
assertEquals(test1[2], 3);
|
||||
assertEquals(test1[3], 5);
|
||||
assertEquals(test1.size(), 4);
|
||||
|
||||
TestSuite::testParsingItself(test1);
|
||||
TestSuite::testParsingItself(test2);
|
||||
} catch (std::out_of_range){
|
||||
FAIL("exception caught pop_nocase");
|
||||
}
|
||||
|
||||
try {
|
||||
res = test1.pop_back(2);
|
||||
assertEquals(res, 3);
|
||||
assertEquals(test1[0], 1);
|
||||
assertEquals(test1[1], 2);
|
||||
assertEquals(test1[2], 5);
|
||||
assertEquals(test1.size(), 3);
|
||||
|
||||
TestSuite::testParsingItself(test1);
|
||||
TestSuite::testParsingItself(test2);
|
||||
} catch (std::out_of_range){
|
||||
FAIL("exception caught pop 2");
|
||||
}
|
||||
|
||||
|
||||
#ifdef JSON_UNIT_TEST
|
||||
JSONNode fresh(JSON_NODE);
|
||||
fresh.reserve(3);
|
||||
assertEquals(fresh.internal -> CHILDREN -> mycapacity, 3);
|
||||
|
||||
assertEquals(fresh.internal -> CHILDREN -> mysize, 0);
|
||||
fresh.push_back(JSONNode(JSON_NULL));
|
||||
assertEquals(fresh.internal -> CHILDREN -> mycapacity, 3);
|
||||
|
||||
assertEquals(fresh.internal -> CHILDREN -> mysize, 1);
|
||||
fresh.push_back(JSONNode(JSON_NULL));
|
||||
assertEquals(fresh.internal -> CHILDREN -> mycapacity, 3);
|
||||
assertEquals(fresh.internal -> CHILDREN -> mysize, 2);
|
||||
fresh.push_back(JSONNode(JSON_NULL));
|
||||
assertEquals(fresh.internal -> CHILDREN -> mycapacity, 3);
|
||||
assertEquals(fresh.internal -> CHILDREN -> mysize, 3);
|
||||
#endif
|
||||
#endif
|
||||
}
|
|
@ -1,435 +0,0 @@
|
|||
#include "TestSuite.h"
|
||||
#include "../Source/JSONNode.h"
|
||||
|
||||
#ifdef JSON_COMMENTS
|
||||
void TestSuite::TestComments(void){
|
||||
UnitTest::SetPrefix("TestComments.cpp - Comments");
|
||||
#ifdef JSON_READ_PRIORITY
|
||||
#ifdef JSON_LIBRARY
|
||||
|
||||
JSONNODE * one = json_new(JSON_NULL);
|
||||
json_set_i(one, 15);
|
||||
JSONNODE * two = json_new(JSON_NULL);
|
||||
json_set_i(two, 15);
|
||||
assertTrue(json_equal(one, two));
|
||||
json_set_comment(one, JSON_TEXT("Number"));
|
||||
assertTrue(json_equal(one, two));
|
||||
json_delete(one);
|
||||
json_delete(two);
|
||||
|
||||
JSONNODE * test = json_parse(JSON_TEXT("#one line comment\n{\"hello\":\"world\"}"));
|
||||
assertEquals(json_type(test), JSON_NODE);
|
||||
assertEquals(json_size(test), 1);
|
||||
json_char * res = json_as_string(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("world"));
|
||||
json_free(res);
|
||||
res = json_name(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("hello"));
|
||||
json_free(res);
|
||||
res = json_get_comment(test);
|
||||
assertCStringSame(res, JSON_TEXT("one line comment"));
|
||||
json_free(res);
|
||||
json_delete(test);
|
||||
|
||||
test = json_parse(JSON_TEXT("//one line comment\n{\"hello\":\"world\"}"));
|
||||
assertEquals(json_type(test), JSON_NODE);
|
||||
assertEquals(json_size(test), 1);
|
||||
res = json_as_string(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("world"));
|
||||
json_free(res);
|
||||
res = json_name(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("hello"));
|
||||
json_free(res);
|
||||
res = json_get_comment(test);
|
||||
assertCStringSame(res, JSON_TEXT("one line comment"));
|
||||
json_free(res);
|
||||
json_delete(test);
|
||||
|
||||
test = json_parse(JSON_TEXT("/*one line comment*/{\"hello\":\"world\"}"));
|
||||
assertEquals(json_type(test), JSON_NODE);
|
||||
assertEquals(json_size(test), 1);
|
||||
res = json_as_string(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("world"));
|
||||
json_free(res);
|
||||
res = json_name(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("hello"));
|
||||
json_free(res);
|
||||
res = json_get_comment(test);
|
||||
assertCStringSame(res, JSON_TEXT("one line comment"));
|
||||
json_free(res);
|
||||
json_delete(test);
|
||||
|
||||
test = json_parse(JSON_TEXT("#one line comment\n#another\n{\"hello\":\"world\"}"));
|
||||
assertEquals(json_type(test), JSON_NODE);
|
||||
assertEquals(json_size(test), 1);
|
||||
res = json_as_string(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("world"));
|
||||
json_free(res);
|
||||
res = json_name(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("hello"));
|
||||
json_free(res);
|
||||
res = json_get_comment(test);
|
||||
assertCStringSame(res, JSON_TEXT("one line comment\nanother"));
|
||||
json_free(res);
|
||||
json_delete(test);
|
||||
|
||||
test = json_parse(JSON_TEXT("//one line comment\n//another\n{\"hello\":\"world\"}"));
|
||||
assertEquals(json_type(test), JSON_NODE);
|
||||
assertEquals(json_size(test), 1);
|
||||
res = json_as_string(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("world"));
|
||||
json_free(res);
|
||||
res = json_name(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("hello"));
|
||||
json_free(res);
|
||||
res = json_get_comment(test);
|
||||
assertCStringSame(res, JSON_TEXT("one line comment\nanother"));
|
||||
json_free(res);
|
||||
json_delete(test);
|
||||
|
||||
test = json_parse(JSON_TEXT("/*one line comment*//*another*/{\"hello\":\"world\"}"));
|
||||
assertEquals(json_type(test), JSON_NODE);
|
||||
assertEquals(json_size(test), 1);
|
||||
res = json_as_string(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("world"));
|
||||
json_free(res);
|
||||
res = json_name(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("hello"));
|
||||
json_free(res);
|
||||
res = json_get_comment(test);
|
||||
assertCStringSame(res, JSON_TEXT("one line comment\nanother"));
|
||||
json_free(res);
|
||||
json_delete(test);
|
||||
|
||||
test = json_parse(JSON_TEXT("#one line comment\n{#comment\n\"hello\":\"world\"}"));
|
||||
assertEquals(json_type(test), JSON_NODE);
|
||||
assertEquals(json_size(test), 1);
|
||||
res = json_get_comment(test);
|
||||
assertCStringSame(res, JSON_TEXT("one line comment"));
|
||||
json_free(res);
|
||||
res = json_as_string(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("world"));
|
||||
json_free(res);
|
||||
res = json_name(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("hello"));
|
||||
json_free(res);
|
||||
res = json_get_comment(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("comment"));
|
||||
json_free(res);
|
||||
json_delete(test);
|
||||
|
||||
test = json_parse(JSON_TEXT("//one line comment\n{//comment\n\"hello\":\"world\"}"));
|
||||
assertEquals(json_type(test), JSON_NODE);
|
||||
assertEquals(json_size(test), 1);
|
||||
res = json_get_comment(test);
|
||||
assertCStringSame(res, JSON_TEXT("one line comment"));
|
||||
json_free(res);
|
||||
res = json_as_string(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("world"));
|
||||
json_free(res);
|
||||
res = json_name(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("hello"));
|
||||
json_free(res);
|
||||
res = json_get_comment(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("comment"));
|
||||
json_free(res);
|
||||
json_delete(test);
|
||||
|
||||
test = json_parse(JSON_TEXT("/*one line comment*/{/*comment*/\"hello\":\"world\"}"));
|
||||
assertEquals(json_type(test), JSON_NODE);
|
||||
assertEquals(json_size(test), 1);
|
||||
res = json_get_comment(test);
|
||||
assertCStringSame(res, JSON_TEXT("one line comment"));
|
||||
json_free(res);
|
||||
res = json_as_string(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("world"));
|
||||
json_free(res);
|
||||
res = json_name(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("hello"));
|
||||
json_free(res);
|
||||
res = json_get_comment(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("comment"));
|
||||
json_free(res);
|
||||
json_delete(test);
|
||||
|
||||
|
||||
test = json_parse(JSON_TEXT("#one line comment\n#another\n{#comment\n#comment2\n\"hello\":\"world\"}"));
|
||||
assertEquals(json_type(test), JSON_NODE);
|
||||
assertEquals(json_size(test), 1);
|
||||
res = json_get_comment(test);
|
||||
assertCStringSame(res, JSON_TEXT("one line comment\nanother"));
|
||||
json_free(res);
|
||||
res = json_as_string(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("world"));
|
||||
json_free(res);
|
||||
res = json_name(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("hello"));
|
||||
json_free(res);
|
||||
res = json_get_comment(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("comment\ncomment2"));
|
||||
json_free(res);
|
||||
json_delete(test);
|
||||
|
||||
test = json_parse(JSON_TEXT("//one line comment\n//another\n{//comment\n//comment2\n\"hello\":\"world\"}"));
|
||||
assertEquals(json_type(test), JSON_NODE);
|
||||
assertEquals(json_size(test), 1);
|
||||
res = json_get_comment(test);
|
||||
assertCStringSame(res, JSON_TEXT("one line comment\nanother"));
|
||||
json_free(res);
|
||||
res = json_as_string(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("world"));
|
||||
json_free(res);
|
||||
res = json_name(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("hello"));
|
||||
json_free(res);
|
||||
res = json_get_comment(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("comment\ncomment2"));
|
||||
json_free(res);
|
||||
json_delete(test);
|
||||
|
||||
test = json_parse(JSON_TEXT("/*one line comment*//*another*/{/*comment*//*comment2*/\"hello\":\"world\"}"));
|
||||
assertEquals(json_type(test), JSON_NODE);
|
||||
assertEquals(json_size(test), 1);
|
||||
res = json_get_comment(test);
|
||||
assertCStringSame(res, JSON_TEXT("one line comment\nanother"));
|
||||
json_free(res);
|
||||
res = json_as_string(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("world"));
|
||||
json_free(res);
|
||||
res = json_name(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("hello"));
|
||||
json_free(res);
|
||||
res = json_get_comment(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("comment\ncomment2"));
|
||||
json_free(res);
|
||||
json_delete(test);
|
||||
|
||||
test = json_parse(JSON_TEXT("/*one line comment*//*another*/{/*comment*//*comment2*/\"hello\":\"world\", #comment\n\"hi\" : \"mars\"}"));
|
||||
assertEquals(json_type(test), JSON_NODE);
|
||||
assertEquals(json_size(test), 2);
|
||||
res = json_get_comment(test);
|
||||
assertCStringSame(res, JSON_TEXT("one line comment\nanother"));
|
||||
json_free(res);
|
||||
res = json_as_string(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("world"));
|
||||
json_free(res);
|
||||
res = json_name(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("hello"));
|
||||
json_free(res);
|
||||
res = json_get_comment(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("comment\ncomment2"));
|
||||
json_free(res);
|
||||
res = json_as_string(json_at(test, 1));
|
||||
assertCStringSame(res, JSON_TEXT("mars"));
|
||||
json_free(res);
|
||||
res = json_name(json_at(test, 1));
|
||||
assertCStringSame(res, JSON_TEXT("hi"));
|
||||
json_free(res);
|
||||
res = json_get_comment(json_at(test, 1));
|
||||
assertCStringSame(res, JSON_TEXT("comment"));
|
||||
json_free(res);
|
||||
json_delete(test);
|
||||
|
||||
|
||||
test = json_parse(JSON_TEXT("/*one line comment*//*another*/{/*comment*//*comment2*/\"hello\":\"world\", #comment\n\"hi\" : \"mars\", //comment 2\n\"and\" : \"pluto\"}"));
|
||||
assertEquals(json_type(test), JSON_NODE);
|
||||
assertEquals(json_size(test), 3);
|
||||
res = json_get_comment(test);
|
||||
assertCStringSame(res, JSON_TEXT("one line comment\nanother"));
|
||||
json_free(res);
|
||||
res = json_as_string(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("world"));
|
||||
json_free(res);
|
||||
res = json_name(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("hello"));
|
||||
json_free(res);
|
||||
res = json_get_comment(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("comment\ncomment2"));
|
||||
json_free(res);
|
||||
res = json_as_string(json_at(test, 1));
|
||||
assertCStringSame(res, JSON_TEXT("mars"));
|
||||
json_free(res);
|
||||
res = json_name(json_at(test, 1));
|
||||
assertCStringSame(res, JSON_TEXT("hi"));
|
||||
json_free(res);
|
||||
res = json_get_comment(json_at(test, 1));
|
||||
assertCStringSame(res, JSON_TEXT("comment"));
|
||||
json_free(res);
|
||||
res = json_as_string(json_at(test, 2));
|
||||
assertCStringSame(res, JSON_TEXT("pluto"));
|
||||
json_free(res);
|
||||
res = json_name(json_at(test, 2));
|
||||
assertCStringSame(res, JSON_TEXT("and"));
|
||||
json_free(res);
|
||||
res = json_get_comment(json_at(test, 2));
|
||||
assertCStringSame(res, JSON_TEXT("comment 2"));
|
||||
json_free(res);
|
||||
json_delete(test);
|
||||
|
||||
test = json_parse(JSON_TEXT("#array\n [#one\n\"hello\", //two\n\"world\", /*three*/\"mars\"]\r\n"));
|
||||
assertEquals(json_type(test), JSON_ARRAY);
|
||||
assertEquals(json_size(test), 3);
|
||||
res = json_get_comment(test);
|
||||
assertCStringSame(res, JSON_TEXT("array"));
|
||||
json_free(res);
|
||||
res = json_as_string(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("hello"));
|
||||
json_free(res);
|
||||
res = json_get_comment(json_at(test, 0));
|
||||
assertCStringSame(res, JSON_TEXT("one"));
|
||||
json_free(res);
|
||||
res = json_as_string(json_at(test, 1));
|
||||
assertCStringSame(res, JSON_TEXT("world"));
|
||||
json_free(res);
|
||||
res = json_get_comment(json_at(test, 1));
|
||||
assertCStringSame(res, JSON_TEXT("two"));
|
||||
json_free(res);
|
||||
res = json_as_string(json_at(test, 2));
|
||||
assertCStringSame(res, JSON_TEXT("mars"));
|
||||
json_free(res);
|
||||
res = json_get_comment(json_at(test, 2));
|
||||
assertCStringSame(res, JSON_TEXT("three"));
|
||||
json_free(res);
|
||||
json_delete(test);
|
||||
|
||||
|
||||
#else
|
||||
JSONNode one;
|
||||
one = 15;
|
||||
JSONNode two;
|
||||
two = 15;
|
||||
assertEquals(one, two);
|
||||
one.set_comment(JSON_TEXT("Number"));
|
||||
assertEquals(one, two);
|
||||
|
||||
JSONNode test = libjson::parse(JSON_TEXT("#one line comment\n{\"hello\":\"world\"}"));
|
||||
assertEquals(test.type(), JSON_NODE);
|
||||
assertEquals(test.size(), 1);
|
||||
assertEquals(test[0], JSON_TEXT("world"));
|
||||
assertEquals(test[0].name(), JSON_TEXT("hello"));
|
||||
assertEquals(test.get_comment(), JSON_TEXT("one line comment"));
|
||||
|
||||
test = libjson::parse(JSON_TEXT("//one line comment\n{\"hello\":\"world\"}"));
|
||||
assertEquals(test.type(), JSON_NODE);
|
||||
assertEquals(test.size(), 1);
|
||||
assertEquals(test[0], JSON_TEXT("world"));
|
||||
assertEquals(test[0].name(), JSON_TEXT("hello"));
|
||||
assertEquals(test.get_comment(), JSON_TEXT("one line comment"));
|
||||
|
||||
test = libjson::parse(JSON_TEXT("/*one line comment*/{\"hello\":\"world\"}"));
|
||||
assertEquals(test.type(), JSON_NODE);
|
||||
assertEquals(test.size(), 1);
|
||||
assertEquals(test[0], JSON_TEXT("world"));
|
||||
assertEquals(test[0].name(), JSON_TEXT("hello"));
|
||||
assertEquals(test.get_comment(), JSON_TEXT("one line comment"));
|
||||
|
||||
test = libjson::parse(JSON_TEXT("#one line comment\n#another\n{\"hello\":\"world\"}"));
|
||||
assertEquals(test.type(), JSON_NODE);
|
||||
assertEquals(test.size(), 1);
|
||||
assertEquals(test[0], JSON_TEXT("world"));
|
||||
assertEquals(test[0].name(), JSON_TEXT("hello"));
|
||||
assertEquals(test.get_comment(), JSON_TEXT("one line comment\nanother"));
|
||||
|
||||
test = libjson::parse(JSON_TEXT("//one line comment\n//another\n{\"hello\":\"world\"}"));
|
||||
assertEquals(test.type(), JSON_NODE);
|
||||
assertEquals(test.size(), 1);
|
||||
assertEquals(test[0], JSON_TEXT("world"));
|
||||
assertEquals(test[0].name(), JSON_TEXT("hello"));
|
||||
assertEquals(test.get_comment(), JSON_TEXT("one line comment\nanother"));
|
||||
|
||||
test = libjson::parse(JSON_TEXT("/*one line comment*//*another*/{\"hello\":\"world\"}"));
|
||||
assertEquals(test.type(), JSON_NODE);
|
||||
assertEquals(test.size(), 1);
|
||||
assertEquals(test[0], JSON_TEXT("world"));
|
||||
assertEquals(test[0].name(), JSON_TEXT("hello"));
|
||||
assertEquals(test.get_comment(), JSON_TEXT("one line comment\nanother"));
|
||||
|
||||
|
||||
test = libjson::parse(JSON_TEXT("#one line comment\n{#comment\n\"hello\":\"world\"}"));
|
||||
assertEquals(test.type(), JSON_NODE);
|
||||
assertEquals(test.size(), 1);
|
||||
assertEquals(test.get_comment(), JSON_TEXT("one line comment"));
|
||||
assertEquals(test[0], JSON_TEXT("world"));
|
||||
assertEquals(test[0].name(), JSON_TEXT("hello"));
|
||||
assertEquals(test[0].get_comment(), JSON_TEXT("comment"));
|
||||
|
||||
test = libjson::parse(JSON_TEXT("//one line comment\n{//comment\n\"hello\":\"world\"}"));
|
||||
assertEquals(test.type(), JSON_NODE);
|
||||
assertEquals(test.size(), 1);
|
||||
assertEquals(test.get_comment(), JSON_TEXT("one line comment"));
|
||||
assertEquals(test[0], JSON_TEXT("world"));
|
||||
assertEquals(test[0].name(), JSON_TEXT("hello"));
|
||||
assertEquals(test[0].get_comment(), JSON_TEXT("comment"));
|
||||
|
||||
test = libjson::parse(JSON_TEXT("/*one line comment*/{/*comment*/\"hello\":\"world\"}"));
|
||||
assertEquals(test.type(), JSON_NODE);
|
||||
assertEquals(test.size(), 1);
|
||||
assertEquals(test.get_comment(), JSON_TEXT("one line comment"));
|
||||
assertEquals(test[0], JSON_TEXT("world"));
|
||||
assertEquals(test[0].name(), JSON_TEXT("hello"));
|
||||
assertEquals(test[0].get_comment(), JSON_TEXT("comment"));
|
||||
|
||||
test = libjson::parse(JSON_TEXT("#one line comment\n#another\n{#comment\n#comment2\n\"hello\":\"world\"}"));
|
||||
assertEquals(test.type(), JSON_NODE);
|
||||
assertEquals(test.size(), 1);
|
||||
assertEquals(test[0].name(), JSON_TEXT("hello"));
|
||||
assertEquals(test[0], JSON_TEXT("world"));
|
||||
assertEquals(test.get_comment(), JSON_TEXT("one line comment\nanother"));
|
||||
assertEquals(test[0].get_comment(), JSON_TEXT("comment\ncomment2"));
|
||||
|
||||
test = libjson::parse(JSON_TEXT("//one line comment\n//another\n{//comment\n//comment2\n\"hello\":\"world\"}"));
|
||||
assertEquals(test.type(), JSON_NODE);
|
||||
assertEquals(test.size(), 1);
|
||||
assertEquals(test[0].name(), JSON_TEXT("hello"));
|
||||
assertEquals(test[0], JSON_TEXT("world"));
|
||||
assertEquals(test.get_comment(), JSON_TEXT("one line comment\nanother"));
|
||||
assertEquals(test[0].get_comment(), JSON_TEXT("comment\ncomment2"));
|
||||
|
||||
test = libjson::parse(JSON_TEXT("/*one line comment*//*another*/{/*comment*//*comment2*/\"hello\":\"world\"}"));
|
||||
assertEquals(test.type(), JSON_NODE);
|
||||
assertEquals(test.size(), 1);
|
||||
assertEquals(test[0].name(), JSON_TEXT("hello"));
|
||||
assertEquals(test[0], JSON_TEXT("world"));
|
||||
assertEquals(test.get_comment(), JSON_TEXT("one line comment\nanother"));
|
||||
assertEquals(test[0].get_comment(), JSON_TEXT("comment\ncomment2"));
|
||||
|
||||
|
||||
test = libjson::parse(JSON_TEXT("/*one line comment*//*another*/{/*comment*//*comment2*/\"hello\":\"world\", #comment\n\"hi\" : \"mars\"}"));
|
||||
assertEquals(test.type(), JSON_NODE);
|
||||
assertEquals(test.size(), 2);
|
||||
assertEquals(test[0].name(), JSON_TEXT("hello"));
|
||||
assertEquals(test[1].name(), JSON_TEXT("hi"));
|
||||
assertEquals(test[0], JSON_TEXT("world"));
|
||||
assertEquals(test[1], JSON_TEXT("mars"));
|
||||
assertEquals(test.get_comment(), JSON_TEXT("one line comment\nanother"));
|
||||
assertEquals(test[0].get_comment(), JSON_TEXT("comment\ncomment2"));
|
||||
assertEquals(test[1].get_comment(), JSON_TEXT("comment"));
|
||||
|
||||
test = libjson::parse(JSON_TEXT("/*one line comment*//*another*/{/*comment*//*comment2*/\"hello\":\"world\", #comment\n\"hi\" : \"mars\", //comment 2\n\"and\" : \"pluto\"}"));
|
||||
assertEquals(test.type(), JSON_NODE);
|
||||
assertEquals(test.size(), 3);
|
||||
assertEquals(test[0].name(), JSON_TEXT("hello"));
|
||||
assertEquals(test[1].name(), JSON_TEXT("hi"));
|
||||
assertEquals(test[2].name(), JSON_TEXT("and"));
|
||||
assertEquals(test[0], JSON_TEXT("world"));
|
||||
assertEquals(test[1], JSON_TEXT("mars"));
|
||||
assertEquals(test[2], JSON_TEXT("pluto"));
|
||||
assertEquals(test.get_comment(), JSON_TEXT("one line comment\nanother"));
|
||||
assertEquals(test[0].get_comment(), JSON_TEXT("comment\ncomment2"));
|
||||
assertEquals(test[1].get_comment(), JSON_TEXT("comment"));
|
||||
assertEquals(test[2].get_comment(), JSON_TEXT("comment 2"));
|
||||
|
||||
test = libjson::parse(JSON_TEXT("#array\n [#one\n\"hello\", //two\n\"world\", /*three*/\"mars\"]\r\n"));
|
||||
assertEquals(test.type(), JSON_ARRAY);
|
||||
assertEquals(test.get_comment(), JSON_TEXT("array"));
|
||||
assertEquals(test.size(), 3);
|
||||
assertEquals(test[0], JSON_TEXT("hello"));
|
||||
assertEquals(test[0].get_comment(), JSON_TEXT("one"));
|
||||
assertEquals(test[1], JSON_TEXT("world"));
|
||||
assertEquals(test[1].get_comment(), JSON_TEXT("two"));
|
||||
assertEquals(test[2], JSON_TEXT("mars"));
|
||||
assertEquals(test[2].get_comment(), JSON_TEXT("three"));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#endif
|
|
@ -1,204 +0,0 @@
|
|||
#include "TestSuite.h"
|
||||
#include "../Source/NumberToString.h"
|
||||
#include "../Source/JSONNode.h"
|
||||
|
||||
void TestSuite::TestConverters(void){
|
||||
UnitTest::SetPrefix("TestConverters.cpp - Converters");
|
||||
|
||||
assertEquals(sizeof(char), 1);
|
||||
assertEquals(NumberToString::_itoa<char>((char)127), JSON_TEXT("127"));
|
||||
assertEquals(NumberToString::_itoa<char>((char)15), JSON_TEXT("15"));
|
||||
assertEquals(NumberToString::_itoa<char>((char)0), JSON_TEXT("0"));
|
||||
assertEquals(NumberToString::_itoa<char>((char)-15), JSON_TEXT("-15"));
|
||||
assertEquals(NumberToString::_itoa<char>((char)-127), JSON_TEXT("-127"));
|
||||
|
||||
assertEquals(sizeof(short), 2);
|
||||
assertEquals(NumberToString::_itoa<short>((short)32767), JSON_TEXT("32767"));
|
||||
assertEquals(NumberToString::_itoa<short>((short)15), JSON_TEXT("15"));
|
||||
assertEquals(NumberToString::_itoa<short>((short)0), JSON_TEXT("0"));
|
||||
assertEquals(NumberToString::_itoa<short>((short)-15), JSON_TEXT("-15"));
|
||||
assertEquals(NumberToString::_itoa<short>((short)-32767), JSON_TEXT("-32767"));
|
||||
|
||||
assertEquals(sizeof(int), 4);
|
||||
assertEquals(NumberToString::_itoa<int>(2147483647), JSON_TEXT("2147483647"));
|
||||
assertEquals(NumberToString::_itoa<int>(15), JSON_TEXT("15"));
|
||||
assertEquals(NumberToString::_itoa<int>(0), JSON_TEXT("0"));
|
||||
assertEquals(NumberToString::_itoa<int>(-15), JSON_TEXT("-15"));
|
||||
assertEquals(NumberToString::_itoa<int>(-2147483647), JSON_TEXT("-2147483647"));
|
||||
|
||||
#ifdef TEST_LONG_EXTREMES
|
||||
assertEquals(NumberToString::_itoa<long>(9223372036854775807L), JSON_TEXT("9223372036854775807"));
|
||||
assertEquals(NumberToString::_itoa<long>(-9223372036854775807L), JSON_TEXT("-9223372036854775807"));
|
||||
#ifndef JSON_LIBRARY
|
||||
assertEquals(NumberToString::_uitoa<unsigned long>(18446744073709551615UL), JSON_TEXT("18446744073709551615"));
|
||||
#endif
|
||||
#endif
|
||||
assertEquals(NumberToString::_itoa<long>(15), JSON_TEXT("15"));
|
||||
assertEquals(NumberToString::_itoa<long>(0), JSON_TEXT("0"));
|
||||
assertEquals(NumberToString::_itoa<long>(-15), JSON_TEXT("-15"));
|
||||
|
||||
#ifndef JSON_LIBRARY
|
||||
assertEquals(NumberToString::_uitoa<unsigned char>(255), JSON_TEXT("255"));
|
||||
assertEquals(NumberToString::_uitoa<unsigned char>(15), JSON_TEXT("15"));
|
||||
assertEquals(NumberToString::_uitoa<unsigned char>(0), JSON_TEXT("0"));
|
||||
|
||||
assertEquals(NumberToString::_uitoa<unsigned short>(65535), JSON_TEXT("65535"));
|
||||
assertEquals(NumberToString::_uitoa<unsigned short>(15), JSON_TEXT("15"));
|
||||
assertEquals(NumberToString::_uitoa<unsigned short>(0), JSON_TEXT("0"));
|
||||
|
||||
assertEquals(NumberToString::_uitoa<unsigned int>(4294967295u), JSON_TEXT("4294967295"));
|
||||
assertEquals(NumberToString::_uitoa<unsigned int>(15), JSON_TEXT("15"));
|
||||
assertEquals(NumberToString::_uitoa<unsigned int>(0), JSON_TEXT("0"));
|
||||
|
||||
assertEquals(NumberToString::_uitoa<unsigned long>(15), JSON_TEXT("15"));
|
||||
assertEquals(NumberToString::_uitoa<unsigned long>(0), JSON_TEXT("0"));
|
||||
#endif
|
||||
|
||||
assertEquals(NumberToString::_ftoa((json_number)1.0), JSON_TEXT("1"));
|
||||
assertEquals(NumberToString::_ftoa((json_number)1.002), JSON_TEXT("1.002"));
|
||||
assertEquals(NumberToString::_ftoa((json_number)10.0), JSON_TEXT("10"));
|
||||
assertEquals(NumberToString::_ftoa((json_number)-1.0), JSON_TEXT("-1"));
|
||||
assertEquals(NumberToString::_ftoa((json_number)-1.002), JSON_TEXT("-1.002"));
|
||||
assertEquals(NumberToString::_ftoa((json_number)-10.0), JSON_TEXT("-10"));
|
||||
assertEquals(NumberToString::_ftoa((json_number)0.0), JSON_TEXT("0"));
|
||||
|
||||
assertTrue(_floatsAreEqual(1.1, 1.1));
|
||||
assertTrue(_floatsAreEqual(1.000000001, 1.0));
|
||||
assertTrue(_floatsAreEqual(1.0, 1.000000001));
|
||||
assertFalse(_floatsAreEqual(1.0, 1.0001));
|
||||
assertFalse(_floatsAreEqual(1.0001, 1.0));
|
||||
|
||||
#ifdef JSON_CASE_INSENSITIVE_FUNCTIONS
|
||||
#ifdef JSON_UNIT_TEST
|
||||
UnitTest::SetPrefix("TestConverters.cpp - Checking case-insensitive");
|
||||
assertTrue(internalJSONNode::AreEqualNoCase(JSON_TEXT("hello"), JSON_TEXT("HeLLo")));
|
||||
assertTrue(internalJSONNode::AreEqualNoCase(JSON_TEXT("hell5o"), JSON_TEXT("HELL5O")));
|
||||
assertTrue(internalJSONNode::AreEqualNoCase(JSON_TEXT("HeLLo"), JSON_TEXT("hello")));
|
||||
assertTrue(internalJSONNode::AreEqualNoCase(JSON_TEXT("HELL5O"), JSON_TEXT("hell5o")));
|
||||
|
||||
assertFalse(internalJSONNode::AreEqualNoCase(JSON_TEXT("hello"), JSON_TEXT("Hello ")));
|
||||
assertFalse(internalJSONNode::AreEqualNoCase(JSON_TEXT("hello"), JSON_TEXT("hi")));
|
||||
assertFalse(internalJSONNode::AreEqualNoCase(JSON_TEXT("hello"), JSON_TEXT("55555")));
|
||||
assertFalse(internalJSONNode::AreEqualNoCase(JSON_TEXT("hello"), JSON_TEXT("jonny")));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef JSON_SAFE
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("0")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("1")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("0.")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("1.")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("0.0")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("1.0")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("0e2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("1e2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("0.e2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("1.e2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("0.0e2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("1.0e2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("0e-2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("1e-2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("0.e-2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("1.e-2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("0.0e-2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("1.0e-2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("0e+2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("1e+2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("0.e+2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("1.e+2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("0.0e+2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("1.0e+2")));
|
||||
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("-0")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("-1")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("-0.")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("-1.")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("-0.0")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("-1.0")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("-0e2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("-1e2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("-0.e2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("-1.e2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("-0.0e2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("-1.0e2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("-0e-2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("-1e-2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("-0.e-2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("-1.e-2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("-0.0e-2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("-1.0e-2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("-0e+2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("-1e+2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("-0.e+2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("-1.e+2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("-0.0e+2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("-1.0e+2")));
|
||||
|
||||
|
||||
#ifdef JSON_STRICT
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("0xABCD")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("0124")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("+0")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("+1")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("+0.")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("+0.0")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.0")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("+0e2")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("+1e2")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("+0.e2")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.e2")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("+0.0e2")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.0e2")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("+0e-2")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("+1e-2")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("+0.e-2")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.e-2")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("+0.0e-2")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.0e-2")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("+0e+2")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("+1e+2")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("+0.e+2")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.e+2")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("+0.0e+2")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("+1.0e+2")));
|
||||
#else
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("0xABCD")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("0124")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("+0")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("+1")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("+0.")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("+1.")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("+0.0")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("+1.0")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("+0e2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("+1e2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("+0.e2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("+1.e2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("+0.0e2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("+1.0e2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("+0e-2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("+1e-2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("+0.e-2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("+1.e-2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("+0.0e-2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("+1.0e-2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("+0e+2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("+1e+2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("+0.e+2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("+1.e+2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("+0.0e+2")));
|
||||
assertTrue(NumberToString::isNumeric(JSON_TEXT("+1.0e+2")));
|
||||
#endif
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("0xABCDv")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("00124")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("09124")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("0no")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("no")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("n1234")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("12no")));
|
||||
assertFalse(NumberToString::isNumeric(JSON_TEXT("0en5")));
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
@ -1,115 +0,0 @@
|
|||
#include "TestSuite.h"
|
||||
#include "../Source/JSONNode.h"
|
||||
|
||||
void TestSuite::TestConstructors(void){
|
||||
UnitTest::SetPrefix("TestCtor.cpp - Constructors");
|
||||
#ifdef JSON_LIBRARY
|
||||
JSONNODE * test = json_new(JSON_NULL);
|
||||
assertEquals(json_type(test), JSON_NULL);
|
||||
json_delete(test);
|
||||
|
||||
test = json_new_a(JSON_TEXT("hello"), JSON_TEXT("world"));
|
||||
json_char * res = json_as_string(test);
|
||||
assertCStringSame(res, JSON_TEXT("world"));
|
||||
json_free(res);
|
||||
res = json_name(test);
|
||||
assertCStringSame(res, JSON_TEXT("hello"));
|
||||
json_free(res);
|
||||
assertEquals(json_type(test), JSON_STRING);
|
||||
json_delete(test);
|
||||
|
||||
test = json_new_i(JSON_TEXT("hello"), 15);
|
||||
#ifdef JSON_CASTABLE
|
||||
res = json_as_string(test);
|
||||
assertCStringSame(res, JSON_TEXT("15"));
|
||||
json_free(res);
|
||||
#endif
|
||||
assertEquals_Primitive(json_as_int(test), 15);
|
||||
assertEquals_Primitive(json_as_float(test), 15.0f);
|
||||
res = json_name(test);
|
||||
assertCStringSame(res, JSON_TEXT("hello"));
|
||||
json_free(res);
|
||||
assertEquals(json_type(test), JSON_NUMBER);
|
||||
json_delete(test);
|
||||
|
||||
test = json_new_f(JSON_TEXT("hello"), 15.5f);
|
||||
assertEquals_Primitive(json_as_int(test), 15);
|
||||
assertEquals_Primitive(json_as_float(test), 15.5f);
|
||||
#ifdef JSON_CASTABLE
|
||||
res = json_as_string(test);
|
||||
assertCStringSame(res, JSON_TEXT("15.5"));
|
||||
json_free(res);
|
||||
#endif
|
||||
res = json_name(test);
|
||||
assertCStringSame(res, JSON_TEXT("hello"));
|
||||
json_free(res);
|
||||
assertEquals(json_type(test), JSON_NUMBER);
|
||||
json_delete(test);
|
||||
|
||||
test = json_new_b(JSON_TEXT("hello"), (int)true);
|
||||
#ifdef JSON_CASTABLE
|
||||
res = json_as_string(test);
|
||||
assertCStringSame(res, JSON_TEXT("true"));
|
||||
json_free(res);
|
||||
#endif
|
||||
assertEquals(json_as_bool(test), (int)true);
|
||||
res = json_name(test);
|
||||
assertCStringSame(res, JSON_TEXT("hello"));
|
||||
json_free(res);
|
||||
assertEquals(json_type(test), JSON_BOOL);
|
||||
|
||||
JSONNODE * cpy = json_copy(test);
|
||||
assertTrue(json_equal(cpy, test));
|
||||
json_delete(cpy);
|
||||
|
||||
json_delete(test);
|
||||
#else
|
||||
JSONNode test = JSONNode(JSON_NULL);
|
||||
assertEquals(test.type(), JSON_NULL);
|
||||
|
||||
test = JSONNode(JSON_TEXT("hello"), JSON_TEXT("world"));
|
||||
assertEquals(test, JSON_TEXT("world"));
|
||||
assertEquals(test.as_string(), JSON_TEXT("world"));
|
||||
assertEquals(test.name(), JSON_TEXT("hello"));
|
||||
assertEquals(test.type(), JSON_STRING);
|
||||
|
||||
test = JSONNode(JSON_TEXT("hello"), 15);
|
||||
assertEquals(test, 15);
|
||||
#ifdef JSON_CASTABLE
|
||||
assertEquals(test.as_string(), JSON_TEXT("15"));
|
||||
#endif
|
||||
assertEquals(test.as_int(), 15);
|
||||
assertEquals(test.as_float(), 15.0f);
|
||||
assertEquals(test.name(), JSON_TEXT("hello"));
|
||||
assertEquals(test.type(), JSON_NUMBER);
|
||||
|
||||
test = JSONNode(JSON_TEXT("hello"), 15.5f);
|
||||
assertEquals(test, 15.5f);
|
||||
assertEquals(test.as_int(), 15);
|
||||
assertEquals(test.as_float(), 15.5f);
|
||||
#ifdef JSON_CASTABLE
|
||||
assertEquals(test.as_string(), JSON_TEXT("15.5"));
|
||||
#endif
|
||||
assertEquals(test.name(), JSON_TEXT("hello"));
|
||||
assertEquals(test.type(), JSON_NUMBER);
|
||||
|
||||
test = JSONNode(JSON_TEXT("hello"), true);
|
||||
assertEquals(test, true);
|
||||
#ifdef JSON_CASTABLE
|
||||
assertEquals(test.as_string(), JSON_TEXT("true"));
|
||||
#endif
|
||||
assertEquals(test.as_bool(), true);
|
||||
assertEquals(test.name(), JSON_TEXT("hello"));
|
||||
assertEquals(test.type(), JSON_BOOL);
|
||||
|
||||
test = JSONNode(json_string(JSON_TEXT("hello")), JSON_TEXT('\0'));
|
||||
assertEquals(test, 0);
|
||||
#ifdef JSON_CASTABLE
|
||||
assertEquals(test.as_string(), JSON_TEXT("0"));
|
||||
#endif
|
||||
assertEquals(test.as_int(), 0);
|
||||
assertEquals(test.as_float(), 0.0f);
|
||||
assertEquals(test.name(), JSON_TEXT("hello"));
|
||||
assertEquals(test.type(), JSON_NUMBER);
|
||||
#endif
|
||||
}
|
|
@ -1,101 +0,0 @@
|
|||
#include "TestSuite.h"
|
||||
#include "../Source/JSONNode.h"
|
||||
|
||||
void TestSuite::TestEquality(void){
|
||||
UnitTest::SetPrefix("TestEquality.cpp - Equality");
|
||||
#ifdef JSON_LIBRARY
|
||||
JSONNODE * test1 = json_new(JSON_NODE);
|
||||
JSONNODE * test2 = json_new(JSON_NODE);
|
||||
assertTrue(json_equal(test1, test2));
|
||||
|
||||
//check literally the same internal pointer
|
||||
json_set_n(test2, test1);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
#ifdef JSON_REF_COUNT
|
||||
assertEquals(((JSONNode*)test1) -> internal, ((JSONNode*)test2) -> internal);
|
||||
#else
|
||||
assertNotEquals(((JSONNode*)test1) -> internal, ((JSONNode*)test2) -> internal);
|
||||
#endif
|
||||
#endif
|
||||
assertTrue(json_equal(test1, test2));
|
||||
|
||||
json_set_a(test1, JSON_TEXT("hello"));
|
||||
json_set_a(test2, JSON_TEXT("hello"));
|
||||
assertTrue(json_equal(test1, test2));
|
||||
|
||||
json_set_f(test1, 13.5f);
|
||||
json_set_f(test2, 13.5f);
|
||||
assertTrue(json_equal(test1, test2));
|
||||
|
||||
json_set_i(test1, 13);
|
||||
json_set_f(test2, 13.0f);
|
||||
assertTrue(json_equal(test1, test2));
|
||||
|
||||
json_set_b(test1, true);
|
||||
json_set_b(test2, (int)true);
|
||||
assertTrue(json_equal(test1, test2));
|
||||
|
||||
json_set_b(test1, false);
|
||||
json_set_b(test2, (int)false);
|
||||
assertTrue(json_equal(test1, test2));
|
||||
|
||||
json_nullify(test1);
|
||||
json_nullify(test2);
|
||||
assertTrue(json_equal(test1, test2));
|
||||
JSONNODE * test3 = json_new(JSON_NULL);
|
||||
assertTrue(json_equal(test1, test3));
|
||||
assertTrue(json_equal(test3, test3));
|
||||
|
||||
json_delete(test1);
|
||||
json_delete(test2);
|
||||
json_delete(test3);
|
||||
#else
|
||||
JSONNode test1;
|
||||
JSONNode test2;
|
||||
assertEquals(test1, test2);
|
||||
|
||||
//check literally the same internal pointer
|
||||
test2 = test1;
|
||||
#ifdef JSON_UNIT_TEST
|
||||
#ifdef JSON_REF_COUNT
|
||||
assertEquals(test1.internal, test2.internal);
|
||||
#else
|
||||
assertNotEquals(test1.internal, test2.internal);
|
||||
#endif
|
||||
#endif
|
||||
assertEquals(test1, test2);
|
||||
|
||||
test1 = JSON_TEXT("hello");
|
||||
test2 = JSON_TEXT("hello");
|
||||
assertEquals(test1, JSON_TEXT("hello"));
|
||||
assertEquals(test1, test2);
|
||||
|
||||
test1 = 13.5f;
|
||||
test2 = 13.5f;
|
||||
assertEquals(test1, 13.5f);
|
||||
assertEquals(test1, test2);
|
||||
|
||||
test1 = 13;
|
||||
test2 = 13.0f;
|
||||
assertEquals(test1, 13.0f);
|
||||
assertEquals(test1, 13);
|
||||
assertEquals(test1, test2);
|
||||
|
||||
test1 = true;
|
||||
test2 = true;
|
||||
assertEquals(test1, true);
|
||||
assertEquals(test1, test2);
|
||||
|
||||
test1 = false;
|
||||
test2 = false;
|
||||
assertEquals(test1, false);
|
||||
assertEquals(test1, test2);
|
||||
|
||||
test1.nullify();
|
||||
test2.nullify();
|
||||
assertEquals(test1, test2);
|
||||
JSONNode test3 = JSONNode(JSON_NULL);
|
||||
assertEquals(test1, test3);
|
||||
assertEquals(test2, test3);
|
||||
#endif
|
||||
}
|
|
@ -1,257 +0,0 @@
|
|||
#include "TestSuite.h"
|
||||
#include "../Source/JSONNode.h"
|
||||
|
||||
void TestSuite::TestFunctions(void){
|
||||
UnitTest::SetPrefix("TestFunctions.cpp - Swap");
|
||||
#ifdef JSON_LIBRARY
|
||||
JSONNODE * test1 = json_new(JSON_NODE);
|
||||
JSONNODE * test2 = json_new(JSON_NODE);
|
||||
json_set_i(test1, 14);
|
||||
json_set_i(test2, 35);
|
||||
json_swap(test1, test2);
|
||||
assertEquals_Primitive(json_as_int(test1), 35);
|
||||
assertEquals_Primitive(json_as_int(test2), 14);
|
||||
|
||||
UnitTest::SetPrefix("TestFunctions.cpp - Duplicate");
|
||||
json_delete(test1);
|
||||
test1 = json_duplicate(test2);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertNotEquals(((JSONNode*)test1) -> internal, ((JSONNode*)test2) -> internal);
|
||||
#endif
|
||||
assertTrue(json_equal(test1, test2));
|
||||
|
||||
|
||||
UnitTest::SetPrefix("TestFunctions.cpp - Duplicate with children");
|
||||
JSONNODE * node = json_new(JSON_NODE);
|
||||
json_push_back(node, json_new_i(JSON_TEXT(""), 15));
|
||||
json_push_back(node, json_new_f(JSON_TEXT(""), 27.4f));
|
||||
json_push_back(node, json_new_b(JSON_TEXT(""), true));
|
||||
|
||||
TestSuite::testParsingItself(node);
|
||||
|
||||
JSONNODE * dup = json_duplicate(node);
|
||||
assertEquals(json_size(dup), 3);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertNotEquals(((JSONNode*)node) -> internal, ((JSONNode*)dup) -> internal);
|
||||
#endif
|
||||
assertEquals(json_type(dup), JSON_NODE);
|
||||
|
||||
TestSuite::testParsingItself(node);
|
||||
TestSuite::testParsingItself(dup);
|
||||
|
||||
assertEquals_Primitive(json_as_int(json_at(dup, 0)), 15);
|
||||
assertEquals_Primitive(json_as_float(json_at(dup, 1)), 27.4f);
|
||||
assertEquals(json_as_bool(json_at(dup, 2)), true);
|
||||
assertTrue(json_equal(json_at(dup, 0), json_at(node, 0)));
|
||||
assertTrue(json_equal(json_at(dup, 1), json_at(node, 1)));
|
||||
assertTrue(json_equal(json_at(dup, 2), json_at(node, 2)));
|
||||
|
||||
|
||||
TestSuite::testParsingItself(dup);
|
||||
|
||||
#ifdef JSON_ITERATORS
|
||||
for(JSONNODE_ITERATOR it = json_begin(node), end = json_end(node), dup_it = json_begin(dup);
|
||||
it != end;
|
||||
++it, ++dup_it){
|
||||
assertTrue(json_equal(*it, *dup_it));
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertNotEquals(((JSONNode*)(*it)) -> internal, ((JSONNode*)(*dup_it)) -> internal);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
UnitTest::SetPrefix("TestFunctions.cpp - Nullify");
|
||||
json_nullify(test1);
|
||||
assertEquals(json_type(test1), JSON_NULL);
|
||||
json_char * res = json_name(test1);
|
||||
assertCStringSame(res, JSON_TEXT(""));
|
||||
json_free(res);
|
||||
|
||||
#ifdef JSON_CASTABLE
|
||||
UnitTest::SetPrefix("TestFunctions.cpp - Cast");
|
||||
json_cast(test1, JSON_NULL);
|
||||
json_set_i(test2, 1);
|
||||
json_cast(test2, JSON_BOOL);
|
||||
assertEquals(json_type(test1), JSON_NULL);
|
||||
assertEquals(json_type(test2), JSON_BOOL);
|
||||
assertEquals(json_as_bool(test2), true);
|
||||
json_set_b(test2, true);
|
||||
assertEquals(json_as_bool(test2), true);
|
||||
|
||||
json_cast(test2, JSON_NUMBER);
|
||||
assertEquals_Primitive(json_as_float(test2), 1.0f);
|
||||
json_set_f(test2, 0.0f);
|
||||
assertEquals_Primitive(json_as_float(test2), 0.0f);
|
||||
json_cast(test2, JSON_BOOL);
|
||||
assertEquals(json_as_bool(test2), false);
|
||||
#endif
|
||||
|
||||
UnitTest::SetPrefix("TestFunctions.cpp - Merge");
|
||||
json_set_a(test1, JSON_TEXT("hello"));
|
||||
json_set_a(test2, JSON_TEXT("hello"));
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertNotEquals(((JSONNode*)test1) -> internal, ((JSONNode*)test2) -> internal);
|
||||
#endif
|
||||
assertTrue(json_equal(test1, test2));
|
||||
json_merge(test1, test2);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
#ifdef JSON_REF_COUNT
|
||||
assertEquals(((JSONNode*)test1) -> internal, ((JSONNode*)test2) -> internal);
|
||||
#else
|
||||
assertNotEquals(((JSONNode*)test1) -> internal, ((JSONNode*)test2) -> internal);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef JSON_CASTABLE
|
||||
json_cast(test1, JSON_NODE);
|
||||
json_cast(test2, JSON_NODE);
|
||||
assertEquals(json_type(test1), JSON_NODE);
|
||||
assertEquals(json_type(test2), JSON_NODE);
|
||||
json_push_back(test1, json_new_a(JSON_TEXT("hi"), JSON_TEXT("world")));
|
||||
json_push_back(test2, json_new_a(JSON_TEXT("hi"), JSON_TEXT("world")));
|
||||
|
||||
TestSuite::testParsingItself(test1);
|
||||
TestSuite::testParsingItself(test2);
|
||||
|
||||
json_merge(test1, test2);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
#ifdef JSON_REF_COUNT
|
||||
assertEquals(((JSONNode*)test1) -> internal, ((JSONNode*)test2) -> internal);
|
||||
#else
|
||||
assertNotEquals(((JSONNode*)test1) -> internal, ((JSONNode*)test2) -> internal);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
TestSuite::testParsingItself(test1);
|
||||
TestSuite::testParsingItself(test2);
|
||||
#endif
|
||||
|
||||
json_delete(test1);
|
||||
json_delete(test2);
|
||||
json_delete(node);
|
||||
json_delete(dup);
|
||||
#else
|
||||
JSONNode test1;
|
||||
JSONNode test2;
|
||||
test1 = JSON_TEXT("hello");
|
||||
test2 = JSON_TEXT("world");
|
||||
test1.swap(test2);
|
||||
assertEquals(test1, JSON_TEXT("world"));
|
||||
assertEquals(test2, JSON_TEXT("hello"));
|
||||
|
||||
UnitTest::SetPrefix("TestFunctions.cpp - Duplicate");
|
||||
test1 = test2.duplicate();
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertNotEquals(test1.internal, test2.internal);
|
||||
#endif
|
||||
assertEquals(test1, test2);
|
||||
|
||||
UnitTest::SetPrefix("TestFunctions.cpp - Duplicate with children");
|
||||
JSONNode node = JSONNode(JSON_NODE);
|
||||
node.push_back(JSONNode(JSON_TEXT(""), 15));
|
||||
node.push_back(JSONNode(JSON_TEXT(""), JSON_TEXT("hello world")));
|
||||
node.push_back(JSONNode(JSON_TEXT(""), true));
|
||||
|
||||
TestSuite::testParsingItself(node);
|
||||
|
||||
JSONNode dup = node.duplicate();
|
||||
assertEquals(dup.size(), 3);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertNotEquals(node.internal, dup.internal);
|
||||
#endif
|
||||
assertEquals(dup.type(), JSON_NODE);
|
||||
|
||||
TestSuite::testParsingItself(node);
|
||||
TestSuite::testParsingItself(dup);
|
||||
|
||||
try {
|
||||
assertEquals(dup.at(0), 15);
|
||||
assertEquals(dup.at(1), JSON_TEXT("hello world"));
|
||||
assertEquals(dup.at(2), true);
|
||||
assertEquals(dup.at(0), node.at(0));
|
||||
assertEquals(dup.at(1), node.at(1));
|
||||
assertEquals(dup.at(2), node.at(2));
|
||||
} catch (std::out_of_range){
|
||||
FAIL("exception caught");
|
||||
}
|
||||
|
||||
TestSuite::testParsingItself(dup);
|
||||
|
||||
#ifdef JSON_ITERATORS
|
||||
for(JSONNode::iterator it = node.begin(), end = node.end(), dup_it = dup.begin();
|
||||
it != end;
|
||||
++it, ++dup_it){
|
||||
assertEquals(*it, *dup_it);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertNotEquals((*it).internal, (*dup_it).internal);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
UnitTest::SetPrefix("TestFunctions.cpp - Nullify");
|
||||
test1.nullify();
|
||||
assertEquals(test1.type(), JSON_NULL);
|
||||
assertEquals(test1.name(), JSON_TEXT(""));
|
||||
|
||||
#ifdef JSON_CASTABLE
|
||||
UnitTest::SetPrefix("TestFunctions.cpp - Cast");
|
||||
test1.cast(JSON_NULL);
|
||||
test2 = 1;
|
||||
test2.cast(JSON_BOOL);
|
||||
assertEquals(test1.type(), JSON_NULL);
|
||||
assertEquals(test2.type(), JSON_BOOL);
|
||||
assertEquals(test2, true);
|
||||
test2 = true;
|
||||
assertEquals(test2, true);
|
||||
test2.cast(JSON_NUMBER);
|
||||
assertEquals(test2, 1.0f);
|
||||
test2 = 0.0f;
|
||||
assertEquals(test2, 0.0f);
|
||||
test2.cast(JSON_BOOL);
|
||||
assertEquals(test2, false);
|
||||
#endif
|
||||
|
||||
UnitTest::SetPrefix("TestFunctions.cpp - Merge");
|
||||
test1 = JSON_TEXT("hello");
|
||||
test2 = JSON_TEXT("hello");
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertNotEquals(test1.internal, test2.internal);
|
||||
#endif
|
||||
assertEquals(test1, test2);
|
||||
test1.merge(test2);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
#ifdef JSON_REF_COUNT
|
||||
assertEquals(test1.internal, test2.internal);
|
||||
#else
|
||||
assertNotEquals(test1.internal, test2.internal);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef JSON_CASTABLE
|
||||
test1.cast(JSON_NODE);
|
||||
test2.cast(JSON_NODE);
|
||||
#else
|
||||
test1 = JSONNode(JSON_NODE);
|
||||
test2 = JSONNode(JSON_NODE);
|
||||
#endif
|
||||
assertEquals(test1.type(), JSON_NODE);
|
||||
assertEquals(test2.type(), JSON_NODE);
|
||||
test1.push_back(JSONNode(JSON_TEXT("hi"), JSON_TEXT("world")));
|
||||
test2.push_back(JSONNode(JSON_TEXT("hi"), JSON_TEXT("world")));
|
||||
|
||||
TestSuite::testParsingItself(test1);
|
||||
TestSuite::testParsingItself(test2);
|
||||
|
||||
test1.merge(test2);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
#ifdef JSON_REF_COUNT
|
||||
assertEquals(test1.internal, test2.internal);
|
||||
#else
|
||||
assertNotEquals(test1.internal, test2.internal);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
TestSuite::testParsingItself(test1);
|
||||
TestSuite::testParsingItself(test2);
|
||||
#endif
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
#include "TestSuite.h"
|
||||
|
||||
void TestSuite::TestInequality(void){
|
||||
UnitTest::SetPrefix("TestInequality.cpp - Inequality");
|
||||
#ifdef JSON_LIBRARY
|
||||
JSONNODE * test1 = json_new(JSON_NODE);
|
||||
JSONNODE * test2 = json_new(JSON_NODE);
|
||||
json_set_a(test1, JSON_TEXT("hello"));
|
||||
json_set_a(test2, JSON_TEXT("world"));
|
||||
assertFalse(json_equal(test1, test2));
|
||||
|
||||
json_set_i(test2,13);
|
||||
assertFalse(json_equal(test1, test2));
|
||||
|
||||
json_set_f(test2, 13.5f);
|
||||
assertFalse(json_equal(test1, test2));
|
||||
|
||||
json_set_b(test2, true);
|
||||
assertFalse(json_equal(test1, test2));
|
||||
|
||||
json_set_b(test2, false);
|
||||
assertFalse(json_equal(test1, test2));
|
||||
|
||||
json_nullify(test2);
|
||||
assertFalse(json_equal(test1, test2));
|
||||
json_delete(test1);
|
||||
json_delete(test2);
|
||||
#else
|
||||
JSONNode test1;
|
||||
JSONNode test2;
|
||||
test1 = JSON_TEXT("hello");
|
||||
test2 = JSON_TEXT("world");
|
||||
assertNotEquals(test1, test2);
|
||||
assertNotEquals(test1, JSON_TEXT("hi"));
|
||||
assertNotEquals(test2, 13.5f);
|
||||
assertNotEquals(test2, 14);
|
||||
assertNotEquals(test2, true);
|
||||
assertNotEquals(test2, false);
|
||||
|
||||
test2 = 13;
|
||||
assertNotEquals(test1, test2);
|
||||
assertNotEquals(test2, 13.5f);
|
||||
assertNotEquals(test2, 14);
|
||||
assertNotEquals(test2, true);
|
||||
assertNotEquals(test2, false);
|
||||
assertNotEquals(test2, JSON_TEXT("13")); //not the same type
|
||||
|
||||
test2 = 13.5f;
|
||||
assertNotEquals(test1, test2);
|
||||
assertNotEquals(test2, 13);
|
||||
assertNotEquals(test2, 14);
|
||||
assertNotEquals(test2, true);
|
||||
assertNotEquals(test2, false);
|
||||
assertNotEquals(test2, JSON_TEXT("13.5")); //not the same type
|
||||
|
||||
test2 = true;
|
||||
assertNotEquals(test1, test2);
|
||||
assertNotEquals(test2, 13.5f);
|
||||
assertNotEquals(test2, 14);
|
||||
assertNotEquals(test2, false);
|
||||
assertNotEquals(test2, JSON_TEXT("true")); //not the same type
|
||||
|
||||
test2 = false;
|
||||
assertNotEquals(test1, test2);
|
||||
assertNotEquals(test2, 13.5f);
|
||||
assertNotEquals(test2, 14);
|
||||
assertNotEquals(test2, true);
|
||||
assertNotEquals(test2, JSON_TEXT("false")); //not the same type
|
||||
|
||||
test2.nullify();
|
||||
assertNotEquals(test1, test2);
|
||||
assertNotEquals(test2, 13.5f);
|
||||
assertNotEquals(test2, 14);
|
||||
assertNotEquals(test2, true);
|
||||
assertNotEquals(test2, false);
|
||||
assertNotEquals(test2, "null"); //not the same type
|
||||
#endif
|
||||
}
|
|
@ -1,363 +0,0 @@
|
|||
#include "TestSuite.h"
|
||||
#include "../Source/JSONNode.h"
|
||||
#include <cstdlib>
|
||||
|
||||
void TestSuite::TestInspectors(void){
|
||||
UnitTest::SetPrefix("TestInspectors.cpp - Inspectors");
|
||||
#ifdef JSON_LIBRARY
|
||||
JSONNODE * test = json_new(JSON_NULL);
|
||||
assertEquals(json_type(test), JSON_NULL);
|
||||
json_char * res = json_as_string(test);
|
||||
assertCStringSame(res, JSON_TEXT(""));
|
||||
json_free(res);
|
||||
assertEquals_Primitive(json_as_int(test), 0);
|
||||
assertEquals_Primitive(json_as_float(test), 0.0f);
|
||||
assertEquals(json_as_bool(test), false);
|
||||
|
||||
json_set_f(test, 15.5f);
|
||||
assertEquals(json_type(test), JSON_NUMBER);
|
||||
#ifdef JSON_CASTABLE
|
||||
res = json_as_string(test);
|
||||
assertCStringSame(res, JSON_TEXT("15.5"));
|
||||
json_free(res);
|
||||
#endif
|
||||
assertEquals_Primitive(json_as_int(test), 15);
|
||||
assertEquals_Primitive(json_as_float(test), 15.5f);
|
||||
#ifdef JSON_CASTABLE
|
||||
assertEquals(json_as_bool(test), true);
|
||||
#endif
|
||||
|
||||
json_set_f(test, 0.0f);
|
||||
assertEquals(json_type(test), JSON_NUMBER);
|
||||
#ifdef JSON_CASTABLE
|
||||
res = json_as_string(test);
|
||||
assertCStringSame(res, JSON_TEXT("0"));
|
||||
json_free(res);
|
||||
#endif
|
||||
assertEquals_Primitive(json_as_int(test), 0);
|
||||
assertEquals_Primitive(json_as_float(test), 0.0f);
|
||||
#ifdef JSON_CASTABLE
|
||||
assertEquals(json_as_bool(test), false);
|
||||
#endif
|
||||
|
||||
json_set_b(test, true);
|
||||
assertEquals(json_type(test), JSON_BOOL);
|
||||
#ifdef JSON_CASTABLE
|
||||
res = json_as_string(test);
|
||||
assertCStringSame(res, JSON_TEXT("true"));
|
||||
json_free(res);
|
||||
assertEquals_Primitive(json_as_int(test), 1);
|
||||
assertEquals_Primitive(json_as_float(test), 1.0f);
|
||||
#endif
|
||||
assertEquals(json_as_bool(test), true);
|
||||
|
||||
json_set_b(test, false);
|
||||
assertEquals(json_type(test), JSON_BOOL);
|
||||
#ifdef JSON_CASTABLE
|
||||
res = json_as_string(test);
|
||||
assertCStringSame(res, JSON_TEXT("false"));
|
||||
json_free(res);
|
||||
assertEquals_Primitive(json_as_int(test), 0);
|
||||
assertEquals_Primitive(json_as_float(test), 0.0f);
|
||||
#endif
|
||||
assertEquals(json_as_bool(test), false);
|
||||
#ifdef JSON_CASTABLE
|
||||
json_cast(test, JSON_NODE);
|
||||
assertEquals(json_type(test), JSON_NODE);
|
||||
assertEquals(json_size(test), 0);
|
||||
json_push_back(test, json_new_a(JSON_TEXT("hi"), JSON_TEXT("world")));
|
||||
json_push_back(test, json_new_a(JSON_TEXT("hello"), JSON_TEXT("mars")));
|
||||
json_push_back(test, json_new_a(JSON_TEXT("salut"), JSON_TEXT("france")));
|
||||
assertEquals(json_size(test), 3);
|
||||
TestSuite::testParsingItself(test);
|
||||
|
||||
JSONNODE * casted = json_as_array(test);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertNotEquals(((JSONNode*)casted) -> internal, ((JSONNode*)test) -> internal);
|
||||
#endif
|
||||
assertEquals(json_type(casted), JSON_ARRAY);
|
||||
assertEquals(json_type(test), JSON_NODE);
|
||||
assertEquals(json_size(test), 3);
|
||||
assertEquals(json_size(casted), 3);
|
||||
TestSuite::testParsingItself(casted);
|
||||
#endif
|
||||
UnitTest::SetPrefix("TestInspectors.cpp - Location");
|
||||
|
||||
#ifdef JSON_CASTABLE
|
||||
#define CheckAt(parent, locale, text)\
|
||||
if(JSONNODE * temp = json_at(parent, locale)){\
|
||||
json_char * _res = json_as_string(temp);\
|
||||
assertCStringSame(_res, text);\
|
||||
json_free(_res);\
|
||||
} else {\
|
||||
FAIL(std::string("CheckAt: ") + #parent + "[" + #locale + "]");\
|
||||
}
|
||||
|
||||
#define CheckNameAt(parent, locale, text)\
|
||||
if(JSONNODE * temp = json_at(parent, locale)){\
|
||||
json_char * _res = json_name(temp);\
|
||||
assertCStringSame(_res, text);\
|
||||
json_free(_res);\
|
||||
} else {\
|
||||
FAIL(std::string("CheckNameAt: ") + #parent + "[" + #locale + "]");\
|
||||
}
|
||||
|
||||
CheckAt(casted, 0, JSON_TEXT("world"));
|
||||
CheckAt(casted, 1, JSON_TEXT("mars"));
|
||||
CheckAt(casted, 2, JSON_TEXT("france"));
|
||||
CheckNameAt(casted, 0, JSON_TEXT(""));
|
||||
CheckNameAt(casted, 1, JSON_TEXT(""));
|
||||
CheckNameAt(casted, 2, JSON_TEXT(""));
|
||||
|
||||
CheckAt(test, 0, JSON_TEXT("world"));
|
||||
CheckAt(test, 1, JSON_TEXT("mars"));
|
||||
CheckAt(test, 2, JSON_TEXT("france"));
|
||||
CheckNameAt(test, 0, JSON_TEXT("hi"));
|
||||
CheckNameAt(test, 1, JSON_TEXT("hello"));
|
||||
CheckNameAt(test, 2, JSON_TEXT("salut"));
|
||||
|
||||
|
||||
#define CheckGet(parent, locale, text)\
|
||||
if(JSONNODE * temp = json_get(parent, locale)){\
|
||||
json_char * _res = json_as_string(temp);\
|
||||
assertCStringSame(_res, text);\
|
||||
json_free(_res);\
|
||||
} else {\
|
||||
FAIL(std::string("CheckGet: ") + #parent + "[" + #locale + "]");\
|
||||
}
|
||||
|
||||
#ifdef JSON_CASE_INSENSITIVE_FUNCTIONS
|
||||
#define CheckGetNoCase(parent, locale, text)\
|
||||
if(JSONNODE * temp = json_get_nocase(parent, locale)){\
|
||||
json_char * _res = json_as_string(temp);\
|
||||
assertCStringSame(_res, text);\
|
||||
json_free(_res);\
|
||||
} else {\
|
||||
FAIL(std::string("CheckGetNoCase: ") + #parent + "[" + #locale + "]");\
|
||||
}
|
||||
#else
|
||||
#define CheckGetNoCase(parent, locale, text)
|
||||
#endif
|
||||
|
||||
CheckGet(test, JSON_TEXT("hi"), JSON_TEXT("world"));
|
||||
CheckGetNoCase(test, JSON_TEXT("HI"), JSON_TEXT("world"));
|
||||
CheckGet(test, JSON_TEXT("hello"), JSON_TEXT("mars"));
|
||||
CheckGetNoCase(test, JSON_TEXT("HELLO"), JSON_TEXT("mars"));
|
||||
CheckGet(test, JSON_TEXT("salut"), JSON_TEXT("france"));
|
||||
CheckGetNoCase(test, JSON_TEXT("SALUT"), JSON_TEXT("france"));
|
||||
|
||||
assertNull(json_get(test, JSON_TEXT("meh")));
|
||||
#ifdef JSON_CASE_INSENSITIVE_FUNCTIONS
|
||||
assertNull(json_get_nocase(test, JSON_TEXT("meh")));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef JSON_ITERATORS
|
||||
#ifdef JSON_CASTABLE
|
||||
UnitTest::SetPrefix("TestInspectors.cpp - Iterators");
|
||||
for(JSONNODE_ITERATOR it = json_begin(casted), end = json_end(casted); it != end; ++it){
|
||||
json_char * _res = json_name(*it);
|
||||
assertCStringSame(_res, JSON_TEXT(""));
|
||||
json_free(_res);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef JSON_BINARY
|
||||
UnitTest::SetPrefix("TestInspectors.cpp - Binary");
|
||||
json_set_binary(test, (const unsigned char *)"Hello World", 11);
|
||||
assertEquals(json_type(test), JSON_STRING);
|
||||
json_char * _res = json_as_string(test);
|
||||
assertCStringSame(_res, JSON_TEXT("SGVsbG8gV29ybGQ="));
|
||||
json_free(_res);
|
||||
|
||||
unsigned long i;
|
||||
if(char * bin = (char*)json_as_binary(test, &i)){
|
||||
assertEquals(i, 11);
|
||||
char * terminated = (char*)std::memcpy(std::malloc(i + 1), bin, i);
|
||||
terminated[i] = '\0';
|
||||
assertCStringEquals(terminated, "Hello World");
|
||||
json_free(bin);
|
||||
std::free(terminated);
|
||||
} else {
|
||||
FAIL("as_binary failed");
|
||||
}
|
||||
|
||||
json_set_a(test, JSON_TEXT("Hello World"));
|
||||
assertEquals(json_type(test), JSON_STRING);
|
||||
_res = json_as_string(test);
|
||||
assertCStringSame(_res, JSON_TEXT("Hello World"));
|
||||
json_free(_res);
|
||||
|
||||
#ifdef JSON_SAFE
|
||||
assertEquals(json_as_binary(test, &i), 0);
|
||||
assertEquals(i, 0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
json_delete(test);
|
||||
#ifdef JSON_CASTABLE
|
||||
json_delete(casted);
|
||||
#endif
|
||||
#else
|
||||
JSONNode test = JSONNode(JSON_NULL);
|
||||
#ifdef JSON_CASTABLE
|
||||
assertEquals(test.as_string(), JSON_TEXT(""));
|
||||
assertEquals(test.as_int(), 0);
|
||||
assertEquals(test.as_float(), 0.0f);
|
||||
assertEquals(test.as_bool(), false);
|
||||
#endif
|
||||
|
||||
test = 15.5f;
|
||||
assertEquals(test.type(), JSON_NUMBER);
|
||||
#ifdef JSON_CASTABLE
|
||||
assertEquals(test.as_string(), JSON_TEXT("15.5"));
|
||||
#endif
|
||||
assertEquals(test.as_int(), 15);
|
||||
assertEquals(test.as_float(), 15.5f);
|
||||
#ifdef JSON_CASTABLE
|
||||
assertEquals(test.as_bool(), true);
|
||||
#endif
|
||||
|
||||
test = 0.0f;
|
||||
assertEquals(test.type(), JSON_NUMBER);
|
||||
#ifdef JSON_CASTABLE
|
||||
assertEquals(test.as_string(), JSON_TEXT("0"));
|
||||
#endif
|
||||
assertEquals(test.as_int(), 0);
|
||||
assertEquals(test.as_float(), 0.0f);
|
||||
#ifdef JSON_CASTABLE
|
||||
assertEquals(test.as_bool(), false);
|
||||
#endif
|
||||
|
||||
test = true;
|
||||
assertEquals(test.type(), JSON_BOOL);
|
||||
#ifdef JSON_CASTABLE
|
||||
assertEquals(test.as_string(), JSON_TEXT("true"));
|
||||
assertEquals(test.as_int(), 1);
|
||||
assertEquals(test.as_float(), 1.0f);
|
||||
#endif
|
||||
assertEquals(test.as_bool(), true);
|
||||
|
||||
test = false;
|
||||
assertEquals(test.type(), JSON_BOOL);
|
||||
#ifdef JSON_CASTABLE
|
||||
assertEquals(test.as_string(), JSON_TEXT("false"));
|
||||
assertEquals(test.as_int(), 0);
|
||||
assertEquals(test.as_float(), 0.0f);
|
||||
#endif
|
||||
assertEquals(test.as_bool(), false);
|
||||
|
||||
#ifdef JSON_CASTABLE
|
||||
test.cast(JSON_NODE);
|
||||
#else
|
||||
test = JSONNode(JSON_NODE);
|
||||
#endif
|
||||
assertEquals(test.type(), JSON_NODE);
|
||||
assertEquals(test.size(), 0);
|
||||
test.push_back(JSONNode(JSON_TEXT("hi"), JSON_TEXT("world")));
|
||||
test.push_back(JSONNode(JSON_TEXT("hello"), JSON_TEXT("mars")));
|
||||
test.push_back(JSONNode(JSON_TEXT("salut"), JSON_TEXT("france")));
|
||||
assertEquals(test.size(), 3);
|
||||
TestSuite::testParsingItself(test);
|
||||
|
||||
#ifdef JSON_CASTABLE
|
||||
JSONNode casted = test.as_array();
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertNotEquals(casted.internal, test.internal);
|
||||
#endif
|
||||
assertEquals(casted.type(), JSON_ARRAY);
|
||||
assertEquals(test.type(), JSON_NODE);
|
||||
assertEquals(test.size(), 3);
|
||||
assertEquals(casted.size(), 3);
|
||||
TestSuite::testParsingItself(casted);
|
||||
#endif
|
||||
|
||||
UnitTest::SetPrefix("TestInspectors.cpp - Location");
|
||||
|
||||
try {
|
||||
#ifdef JSON_CASTABLE
|
||||
assertEquals(casted.at(0), JSON_TEXT("world"));
|
||||
assertEquals(casted.at(1), JSON_TEXT("mars"));
|
||||
assertEquals(casted.at(2), JSON_TEXT("france"));
|
||||
assertEquals(casted.at(0).name(), JSON_TEXT(""));
|
||||
assertEquals(casted.at(1).name(), JSON_TEXT(""));
|
||||
assertEquals(casted.at(2).name(), JSON_TEXT(""));
|
||||
#endif
|
||||
assertEquals(test.at(0), JSON_TEXT("world"));
|
||||
assertEquals(test.at(1), JSON_TEXT("mars"));
|
||||
assertEquals(test.at(2), JSON_TEXT("france"));
|
||||
assertEquals(test.at(0).name(), JSON_TEXT("hi"));
|
||||
assertEquals(test.at(1).name(), JSON_TEXT("hello"));
|
||||
assertEquals(test.at(2).name(), JSON_TEXT("salut"));
|
||||
} catch (std::out_of_range){
|
||||
FAIL("exception caught");
|
||||
}
|
||||
|
||||
try {
|
||||
assertEquals(test.at(JSON_TEXT("hi")), JSON_TEXT("world"));
|
||||
assertEquals(test.at(JSON_TEXT("hello")), JSON_TEXT("mars"));
|
||||
assertEquals(test.at(JSON_TEXT("salut")), JSON_TEXT("france"));
|
||||
#ifdef JSON_CASE_INSENSITIVE_FUNCTIONS
|
||||
assertEquals(test.at_nocase(JSON_TEXT("SALUT")), JSON_TEXT("france"));
|
||||
assertEquals(test.at_nocase(JSON_TEXT("HELLO")), JSON_TEXT("mars"));
|
||||
assertEquals(test.at_nocase(JSON_TEXT("HI")), JSON_TEXT("world"));
|
||||
#endif
|
||||
} catch (std::out_of_range){
|
||||
FAIL("exception caught");
|
||||
}
|
||||
|
||||
assertException(test.at(JSON_TEXT("meh")), std::out_of_range);
|
||||
#ifdef JSON_CASE_INSENSITIVE_FUNCTIONS
|
||||
assertException(test.at_nocase(JSON_TEXT("meh")), std::out_of_range);
|
||||
#endif
|
||||
|
||||
assertEquals(test[JSON_TEXT("hi")], json_string(JSON_TEXT("world")));
|
||||
assertEquals(test[JSON_TEXT("hello")], json_string(JSON_TEXT("mars")));
|
||||
assertEquals(test[JSON_TEXT("salut")], json_string(JSON_TEXT("france")));
|
||||
assertEquals(test[0], JSON_TEXT("world"));
|
||||
assertEquals(test[1], JSON_TEXT("mars"));
|
||||
assertEquals(test[2], JSON_TEXT("france"));
|
||||
|
||||
#ifdef JSON_ITERATORS
|
||||
#ifdef JSON_CASTABLE
|
||||
UnitTest::SetPrefix("TestInspectors.cpp - Iterators");
|
||||
for(JSONNode::iterator it = casted.begin(), end = casted.end(); it != end; ++it){
|
||||
assertEquals((*it).name(), JSON_TEXT(""));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef JSON_BINARY
|
||||
UnitTest::SetPrefix("TestInspectors.cpp - Binary");
|
||||
test.set_binary((const unsigned char *)"Hello World", 11);
|
||||
assertEquals(test.type(), JSON_STRING);
|
||||
assertEquals(test.as_string(), JSON_TEXT("SGVsbG8gV29ybGQ="));
|
||||
assertEquals(test.as_binary(), "Hello World");
|
||||
assertEquals(test.as_binary().size(), 11);
|
||||
|
||||
test = JSON_TEXT("Hello World");
|
||||
assertEquals(test.type(), JSON_STRING);
|
||||
assertEquals(test.as_string(), JSON_TEXT("Hello World"));
|
||||
#ifdef JSON_SAFE
|
||||
assertEquals(test.as_binary(), "");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef JSON_READ_PRIORITY
|
||||
//This is a regression test for a bug in at()
|
||||
json_string buffer(JSON_TEXT("{ \"myValue1\" : \"foo\", \"myValue2\" : \"bar\"}"));
|
||||
JSONNode current = libjson::parse(buffer);
|
||||
try {
|
||||
JSONNode & value1 = current[JSON_TEXT("myValue1")];
|
||||
assertEquals(value1.as_string(), JSON_TEXT("foo"));
|
||||
JSONNode & value2 = current[JSON_TEXT("myValue2")];
|
||||
assertEquals(value2.as_string(), JSON_TEXT("bar"));
|
||||
} catch (...){
|
||||
assertTrue(false);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
|
@ -1,838 +0,0 @@
|
|||
#include "TestSuite.h"
|
||||
|
||||
#ifdef JSON_LIBRARY
|
||||
void CreateTest(JSONNODE * test); //suppress warnings that it wasnt defined
|
||||
void CreateTest(JSONNODE * test){
|
||||
json_push_back(test, json_new_a(JSON_TEXT("Hi"), JSON_TEXT("World")));
|
||||
json_push_back(test, json_new_a(JSON_TEXT("Hello"), JSON_TEXT("There")));
|
||||
json_push_back(test, json_new_a(JSON_TEXT("Hai"), JSON_TEXT("Mars")));
|
||||
json_push_back(test, json_new_a(JSON_TEXT("Hia"), JSON_TEXT("Earth")));
|
||||
json_push_back(test, json_new_a(JSON_TEXT("Hey"), JSON_TEXT("Jude")));
|
||||
}
|
||||
#else
|
||||
void CreateTest(JSONNode & test); //suppress warnings that it wasnt defined
|
||||
void CreateTest(JSONNode & test){
|
||||
test.push_back(JSONNode(JSON_TEXT("Hi"), JSON_TEXT("World")));
|
||||
test.push_back(JSONNode(JSON_TEXT("Hello"), JSON_TEXT("There")));
|
||||
test.push_back(JSONNode(JSON_TEXT("Hai"), JSON_TEXT("Mars")));
|
||||
test.push_back(JSONNode(JSON_TEXT("Hia"), JSON_TEXT("Earth")));
|
||||
test.push_back(JSONNode(JSON_TEXT("Hey"), JSON_TEXT("Jude")));
|
||||
}
|
||||
#endif
|
||||
|
||||
void TestSuite::TestIterators(void){
|
||||
#ifdef JSON_ITERATORS
|
||||
#define assertAutoCString(cone, ctwo)\
|
||||
{\
|
||||
json_char * _res = cone;\
|
||||
assertCStringSame(_res, ctwo);\
|
||||
json_free(_res);\
|
||||
}
|
||||
|
||||
UnitTest::SetPrefix("TestIterators.cpp - Iterator");
|
||||
#ifdef JSON_LIBRARY
|
||||
JSONNODE * empty = json_new(JSON_NODE);
|
||||
assertEquals(json_begin(empty), json_end(empty));
|
||||
TestSuite::testParsingItself(empty);
|
||||
|
||||
assertNull(json_at(empty, 15));
|
||||
assertNull(json_get(empty, JSON_TEXT("hello")));
|
||||
|
||||
JSONNODE * test = json_new(JSON_NODE);
|
||||
json_push_back(test, json_new_i(JSON_TEXT(""), 15));
|
||||
json_push_back(test, json_new_a(JSON_TEXT(""), JSON_TEXT("hello world")));
|
||||
json_push_back(test, json_new_b(JSON_TEXT(""), true));
|
||||
assertEquals(json_size(test), 3);
|
||||
TestSuite::testParsingItself(test);
|
||||
|
||||
JSONNODE_ITERATOR it_test = json_begin(test);
|
||||
assertEquals(json_as_int(*it_test), 15);
|
||||
++it_test;
|
||||
assertAutoCString(json_as_string(*it_test), JSON_TEXT("hello world"));
|
||||
it_test++;
|
||||
assertEquals(json_as_bool(*it_test++), true);
|
||||
assertEquals(it_test, json_end(test));
|
||||
|
||||
unsigned int i = 0;
|
||||
for(JSONNODE_ITERATOR it = json_begin(test), end = json_end(test); it != end; ++it){
|
||||
++i;
|
||||
}
|
||||
assertEquals(i, 3);
|
||||
|
||||
UnitTest::SetPrefix("TestIterators.cpp - Iterator Find");
|
||||
json_delete(test);
|
||||
test = json_new(JSON_NODE);
|
||||
CreateTest(test);
|
||||
|
||||
JSONNODE_ITERATOR ti = json_find(test, JSON_TEXT("bye"));
|
||||
assertEquals(ti, json_end(test));
|
||||
|
||||
ti = json_find(test, JSON_TEXT("Hai"));
|
||||
assertNotEquals(ti, json_end(test));
|
||||
assertAutoCString(json_as_string(*ti), JSON_TEXT("Mars"));
|
||||
ti = json_find(test, JSON_TEXT("Hey"));
|
||||
assertNotEquals(ti, json_end(test));
|
||||
assertAutoCString(json_as_string(*ti), JSON_TEXT("Jude"));
|
||||
ti = json_find(test, JSON_TEXT("Hi"));
|
||||
assertNotEquals(ti, json_end(test));
|
||||
assertAutoCString(json_as_string(*ti), JSON_TEXT("World"));
|
||||
|
||||
#ifdef JSON_CASE_INSENSITIVE_FUNCTIONS
|
||||
ti = json_find_nocase(test, JSON_TEXT("BYE"));
|
||||
assertEquals(ti, json_end(test));
|
||||
ti = json_find_nocase(test, JSON_TEXT("HAI"));
|
||||
assertNotEquals(ti, json_end(test));
|
||||
assertAutoCString(json_as_string(*ti), JSON_TEXT("Mars"));
|
||||
ti = json_find_nocase(test, JSON_TEXT("HEY"));
|
||||
assertNotEquals(ti, json_end(test));
|
||||
assertAutoCString(json_as_string(*ti), JSON_TEXT("Jude"));
|
||||
ti = json_find_nocase(test, JSON_TEXT("HI"));
|
||||
assertNotEquals(ti, json_end(test));
|
||||
assertAutoCString(json_as_string(*ti), JSON_TEXT("World"));
|
||||
#endif
|
||||
UnitTest::SetPrefix("TestIterators.cpp - Iterator Erase");
|
||||
|
||||
ti = json_erase(test, json_begin(test) + 3);
|
||||
assertEquals(json_size(test), 4);
|
||||
assertAutoCString(json_as_string(json_at(test, 0)), JSON_TEXT("World"));
|
||||
assertAutoCString(json_as_string(json_at(test, 1)), JSON_TEXT("There"));
|
||||
assertAutoCString(json_as_string(json_at(test, 2)), JSON_TEXT("Mars"));
|
||||
assertAutoCString(json_as_string(json_at(test, 3)), JSON_TEXT("Jude"));
|
||||
assertAutoCString(json_as_string(*ti), JSON_TEXT("Jude"));
|
||||
ti = json_erase(test, json_begin(test));
|
||||
assertEquals(json_size(test), 3);
|
||||
assertAutoCString(json_as_string(json_at(test, 0)), JSON_TEXT("There"));
|
||||
assertAutoCString(json_as_string(json_at(test, 1)), JSON_TEXT("Mars"));
|
||||
assertAutoCString(json_as_string(json_at(test, 2)), JSON_TEXT("Jude"));
|
||||
assertAutoCString(json_as_string(*ti), JSON_TEXT("There"));
|
||||
|
||||
#ifdef JSON_SAFE
|
||||
ti = json_erase(test, json_end(test));
|
||||
assertEquals(json_size(test), 3);
|
||||
assertAutoCString(json_as_string(json_at(test, 0)), JSON_TEXT("There"));
|
||||
assertAutoCString(json_as_string(json_at(test, 1)), JSON_TEXT("Mars"));
|
||||
assertAutoCString(json_as_string(json_at(test, 2)), JSON_TEXT("Jude"));
|
||||
assertEquals(ti, json_end(test));
|
||||
#endif
|
||||
|
||||
ti = json_erase(test, json_begin(test));
|
||||
assertEquals(json_size(test), 2);
|
||||
assertAutoCString(json_as_string(json_at(test, 0)), JSON_TEXT("Mars"));
|
||||
assertAutoCString(json_as_string(json_at(test, 1)), JSON_TEXT("Jude"));
|
||||
assertAutoCString(json_as_string(*ti), JSON_TEXT("Mars"));
|
||||
|
||||
ti = json_erase(test, json_begin(test));
|
||||
assertEquals(json_size(test), 1);
|
||||
assertAutoCString(json_as_string(json_at(test, 0)), JSON_TEXT("Jude"));
|
||||
assertAutoCString(json_as_string(*ti), JSON_TEXT("Jude"));
|
||||
|
||||
ti = json_erase(test, json_begin(test));
|
||||
assertEquals(json_size(test), 0);
|
||||
assertEquals(ti, json_end(test));
|
||||
|
||||
CreateTest(test);
|
||||
i = 0;
|
||||
for (JSONNODE_ITERATOR it = json_begin(test); it != json_end(test); it = json_erase(test, it)){
|
||||
++i;
|
||||
}
|
||||
assertEquals(json_size(test), 0);
|
||||
assertEquals(i, 5);
|
||||
|
||||
|
||||
UnitTest::SetPrefix("TestIterators.cpp - Iterator Bulk Erase");
|
||||
CreateTest(test);
|
||||
|
||||
ti = json_erase_multi(test, json_begin(test), json_begin(test));
|
||||
assertEquals(json_size(test), 5);
|
||||
assertAutoCString(json_as_string(json_at(test, 0)), JSON_TEXT("World"));
|
||||
assertAutoCString(json_as_string(json_at(test, 1)), JSON_TEXT("There"));
|
||||
assertAutoCString(json_as_string(json_at(test, 2)), JSON_TEXT("Mars"));
|
||||
assertAutoCString(json_as_string(json_at(test, 3)), JSON_TEXT("Earth"));
|
||||
assertAutoCString(json_as_string(json_at(test, 4)), JSON_TEXT("Jude"));
|
||||
assertEquals(ti, json_begin(test));
|
||||
|
||||
json_erase_multi(test, json_begin(test), json_end(test));
|
||||
assertEquals(json_size(test), 0);
|
||||
CreateTest(test);
|
||||
|
||||
ti = json_erase_multi(test, json_begin(test), json_begin(test) + 1);
|
||||
assertEquals(json_size(test), 4);
|
||||
assertAutoCString(json_as_string(json_at(test, 0)), JSON_TEXT("There"));
|
||||
assertAutoCString(json_as_string(json_at(test, 1)), JSON_TEXT("Mars"));
|
||||
assertAutoCString(json_as_string(json_at(test, 2)), JSON_TEXT("Earth"));
|
||||
assertAutoCString(json_as_string(json_at(test, 3)), JSON_TEXT("Jude"));
|
||||
assertEquals(ti, json_begin(test));
|
||||
|
||||
ti = json_erase_multi(test, json_begin(test), json_begin(test) + 2);
|
||||
assertEquals(json_size(test), 2);
|
||||
assertAutoCString(json_as_string(json_at(test, 0)), JSON_TEXT("Earth"));
|
||||
assertAutoCString(json_as_string(json_at(test, 1)), JSON_TEXT("Jude"));
|
||||
assertEquals(ti, json_begin(test));
|
||||
|
||||
ti = json_erase_multi(test, json_begin(test), json_end(test) - 1);
|
||||
assertEquals(json_size(test), 1);
|
||||
assertAutoCString(json_as_string(json_at(test, 0)), JSON_TEXT("Jude"));
|
||||
assertEquals(ti, json_begin(test));
|
||||
json_clear(test);
|
||||
|
||||
|
||||
|
||||
UnitTest::SetPrefix("TestIterators.cpp - Iterator Insert");
|
||||
CreateTest(test);
|
||||
ti = json_insert(test, json_begin(test) + 3, json_new_a(JSON_TEXT("olah"), JSON_TEXT("Pluto")));
|
||||
assertEquals(json_size(test), 6);
|
||||
assertAutoCString(json_as_string(json_at(test, 0)), JSON_TEXT("World"));
|
||||
assertAutoCString(json_as_string(json_at(test, 1)), JSON_TEXT("There"));
|
||||
assertAutoCString(json_as_string(json_at(test, 2)), JSON_TEXT("Mars"));
|
||||
assertAutoCString(json_as_string(json_at(test, 3)), JSON_TEXT("Pluto"));
|
||||
assertAutoCString(json_as_string(json_at(test, 4)), JSON_TEXT("Earth"));
|
||||
assertAutoCString(json_as_string(json_at(test, 5)), JSON_TEXT("Jude"));
|
||||
assertAutoCString(json_as_string(*ti), JSON_TEXT("Pluto"));
|
||||
assertEquals(ti, json_begin(test) + 3);
|
||||
json_clear(test);
|
||||
|
||||
CreateTest(test);
|
||||
ti = json_insert(test, json_begin(test), json_new_a(JSON_TEXT("olah"), JSON_TEXT("Pluto")));
|
||||
assertEquals(json_size(test), 6);
|
||||
assertAutoCString(json_as_string(json_at(test, 0)), JSON_TEXT("Pluto"));
|
||||
assertAutoCString(json_as_string(json_at(test, 1)), JSON_TEXT("World"));
|
||||
assertAutoCString(json_as_string(json_at(test, 2)), JSON_TEXT("There"));
|
||||
assertAutoCString(json_as_string(json_at(test, 3)), JSON_TEXT("Mars"));
|
||||
assertAutoCString(json_as_string(json_at(test, 4)), JSON_TEXT("Earth"));
|
||||
assertAutoCString(json_as_string(json_at(test, 5)), JSON_TEXT("Jude"));
|
||||
assertAutoCString(json_as_string(*ti), JSON_TEXT("Pluto"));
|
||||
assertEquals(ti, json_begin(test));
|
||||
json_clear(test);
|
||||
|
||||
CreateTest(test);
|
||||
ti = json_insert(test, json_begin(test) + 5, json_new_a(JSON_TEXT("olah"), JSON_TEXT("Pluto")));
|
||||
assertEquals(json_size(test), 6);
|
||||
assertAutoCString(json_as_string(json_at(test, 0)), JSON_TEXT("World"));
|
||||
assertAutoCString(json_as_string(json_at(test, 1)), JSON_TEXT("There"));
|
||||
assertAutoCString(json_as_string(json_at(test, 2)), JSON_TEXT("Mars"));
|
||||
assertAutoCString(json_as_string(json_at(test, 3)), JSON_TEXT("Earth"));
|
||||
assertAutoCString(json_as_string(json_at(test, 4)), JSON_TEXT("Jude"));
|
||||
assertAutoCString(json_as_string(json_at(test, 5)), JSON_TEXT("Pluto"));
|
||||
assertAutoCString(json_as_string(*ti), JSON_TEXT("Pluto"));
|
||||
assertEquals(ti, json_begin(test) + 5);
|
||||
json_clear(test);
|
||||
|
||||
UnitTest::SetPrefix("TestIterators.cpp - Iterator Bulk Insert");
|
||||
|
||||
|
||||
|
||||
|
||||
JSONNODE * test3 = json_new(JSON_NODE);
|
||||
|
||||
CreateTest(test);
|
||||
CreateTest(test3);
|
||||
ti = json_insert_multi(test3, json_begin(test3) + 3, json_begin(test) + 1, json_begin(test) + 3);
|
||||
assertEquals(json_size(test3), 7);
|
||||
assertAutoCString(json_as_string(json_at(test3, 0)), JSON_TEXT("World"));
|
||||
assertAutoCString(json_as_string(json_at(test3, 1)), JSON_TEXT("There"));
|
||||
assertAutoCString(json_as_string(json_at(test3, 2)), JSON_TEXT("Mars"));
|
||||
assertAutoCString(json_as_string(json_at(test3, 3)), JSON_TEXT("There"));
|
||||
assertAutoCString(json_as_string(json_at(test3, 4)), JSON_TEXT("Mars"));
|
||||
assertAutoCString(json_as_string(json_at(test3, 5)), JSON_TEXT("Earth"));
|
||||
assertAutoCString(json_as_string(json_at(test3, 6)), JSON_TEXT("Jude"));
|
||||
assertAutoCString(json_as_string(*ti), JSON_TEXT("There"));
|
||||
assertEquals(ti, json_begin(test3) + 3);
|
||||
json_clear(test);
|
||||
json_clear(test3);
|
||||
|
||||
CreateTest(test);
|
||||
CreateTest(test3);
|
||||
ti = json_insert_multi(test3, json_begin(test3), json_begin(test) + 1, json_begin(test) + 3);
|
||||
assertEquals(json_size(test3), 7);
|
||||
assertAutoCString(json_as_string(json_at(test3, 0)), JSON_TEXT("There"));
|
||||
assertAutoCString(json_as_string(json_at(test3, 1)), JSON_TEXT("Mars"));
|
||||
assertAutoCString(json_as_string(json_at(test3, 2)), JSON_TEXT("World"));
|
||||
assertAutoCString(json_as_string(json_at(test3, 3)), JSON_TEXT("There"));
|
||||
assertAutoCString(json_as_string(json_at(test3, 4)), JSON_TEXT("Mars"));
|
||||
assertAutoCString(json_as_string(json_at(test3, 5)), JSON_TEXT("Earth"));
|
||||
assertAutoCString(json_as_string(json_at(test3, 6)), JSON_TEXT("Jude"));
|
||||
assertAutoCString(json_as_string(*ti), JSON_TEXT("There"));
|
||||
assertEquals(ti, json_begin(test3));
|
||||
json_clear(test);
|
||||
json_clear(test3);
|
||||
|
||||
CreateTest(test);
|
||||
CreateTest(test3);
|
||||
json_set_a(json_at(test3, 2), JSON_TEXT("lol"));
|
||||
json_set_a(json_at(test3, 3), JSON_TEXT("lul"));
|
||||
ti = json_insert_multi(test3, json_begin(test3) + 5, json_begin(test) + 1, json_begin(test) + 3);
|
||||
assertEquals(json_size(test3), 7);
|
||||
assertAutoCString(json_as_string(json_at(test3, 0)), JSON_TEXT("World"));
|
||||
assertAutoCString(json_as_string(json_at(test3, 1)), JSON_TEXT("There"));
|
||||
assertAutoCString(json_as_string(json_at(test3, 2)), JSON_TEXT("lol"));
|
||||
assertAutoCString(json_as_string(json_at(test3, 3)), JSON_TEXT("lul"));
|
||||
assertAutoCString(json_as_string(json_at(test3, 4)), JSON_TEXT("Jude"));
|
||||
assertAutoCString(json_as_string(json_at(test3, 5)), JSON_TEXT("There"));
|
||||
assertAutoCString(json_as_string(json_at(test3, 6)), JSON_TEXT("Mars"));
|
||||
assertAutoCString(json_as_string(*ti), JSON_TEXT("There"));
|
||||
assertEquals(ti, json_begin(test3) + 5);
|
||||
|
||||
json_delete(empty);
|
||||
json_delete(test);
|
||||
json_delete(test3);
|
||||
#else
|
||||
JSONNode empty = JSONNode(JSON_NODE);
|
||||
assertEquals(empty.begin(), empty.end());
|
||||
assertEquals(empty.rbegin(), empty.rend());
|
||||
TestSuite::testParsingItself(empty);
|
||||
|
||||
assertException(empty.at(15), std::out_of_range);
|
||||
assertException(empty.at(JSON_TEXT("hello")), std::out_of_range);
|
||||
|
||||
JSONNode test = JSONNode(JSON_NODE);
|
||||
test.push_back(JSONNode(JSON_TEXT(""), 15));
|
||||
test.push_back(JSONNode(JSON_TEXT(""), JSON_TEXT("hello world")));
|
||||
test.push_back(JSONNode(JSON_TEXT(""), true));
|
||||
assertEquals(test.size(), 3);
|
||||
TestSuite::testParsingItself(test);
|
||||
|
||||
JSONNode::iterator it_test = test.begin();
|
||||
assertEquals(*it_test, 15);
|
||||
++it_test;
|
||||
assertEquals(*it_test, JSON_TEXT("hello world"));
|
||||
it_test++;
|
||||
assertEquals(*it_test++, true);
|
||||
assertEquals(it_test, test.end());
|
||||
|
||||
unsigned int i = 0;
|
||||
for(JSONNode::iterator it = test.begin(), end = test.end(); it != end; ++it){
|
||||
++i;
|
||||
}
|
||||
assertEquals(i, 3);
|
||||
|
||||
|
||||
|
||||
UnitTest::SetPrefix("TestIterators.cpp - Const Iterator");
|
||||
const JSONNode test2 = test;
|
||||
assertEquals(test2.size(), 3);
|
||||
|
||||
JSONNode::const_iterator cit_test = test2.begin();
|
||||
assertEquals(*cit_test, 15);
|
||||
++cit_test;
|
||||
assertEquals(*cit_test, JSON_TEXT("hello world"));
|
||||
cit_test++;
|
||||
assertEquals(*cit_test++, true);
|
||||
assertEquals(cit_test, test2.end());
|
||||
i = 0;
|
||||
for(JSONNode::const_iterator it = test2.begin(), end = test2.end(); it != end; ++it){
|
||||
++i;
|
||||
}
|
||||
assertEquals(i, 3);
|
||||
|
||||
|
||||
|
||||
UnitTest::SetPrefix("TestIterators.cpp - Reverse Iterator");
|
||||
assertEquals(test.size(), 3);
|
||||
|
||||
JSONNode::reverse_iterator rit_test = test.rbegin();
|
||||
assertEquals(*rit_test, true);
|
||||
++rit_test;
|
||||
assertEquals(*rit_test, JSON_TEXT("hello world"));
|
||||
rit_test++;
|
||||
assertEquals(*rit_test++, 15);
|
||||
assertEquals(rit_test, test.rend());
|
||||
i = 0;
|
||||
for(JSONNode::reverse_iterator it = test.rbegin(), end = test.rend(); it != end; ++it){
|
||||
++i;
|
||||
}
|
||||
assertEquals(i, 3);
|
||||
|
||||
|
||||
|
||||
UnitTest::SetPrefix("TestIterators.cpp - Reverse Const Iterator");
|
||||
assertEquals(test2.size(), 3);
|
||||
|
||||
JSONNode::reverse_const_iterator rcit_test = test2.rbegin();
|
||||
assertEquals(*rcit_test, true);
|
||||
++rcit_test;
|
||||
assertEquals(*rcit_test, JSON_TEXT("hello world"));
|
||||
rcit_test++;
|
||||
assertEquals(*rcit_test++, 15);
|
||||
assertEquals(rcit_test, test2.rend());
|
||||
i = 0;
|
||||
for(JSONNode::reverse_const_iterator it = test2.rbegin(), end = test2.rend(); it != end; ++it){
|
||||
++i;
|
||||
}
|
||||
assertEquals(i, 3);
|
||||
|
||||
|
||||
UnitTest::SetPrefix("TestIterators.cpp - Iterator Find");
|
||||
test = JSONNode();
|
||||
CreateTest(test);
|
||||
|
||||
JSONNode::iterator ti = test.find(JSON_TEXT("bye"));
|
||||
assertEquals(ti, test.end());
|
||||
ti = test.find(JSON_TEXT("Hai"));
|
||||
assertNotEquals(ti, test.end());
|
||||
assertEquals(*ti, JSON_TEXT("Mars"));
|
||||
ti = test.find(JSON_TEXT("Hey"));
|
||||
assertNotEquals(ti, test.end());
|
||||
assertEquals(*ti, JSON_TEXT("Jude"));
|
||||
ti = test.find(JSON_TEXT("Hi"));
|
||||
assertNotEquals(ti, test.end());
|
||||
assertEquals(*ti, JSON_TEXT("World"));
|
||||
|
||||
#ifdef JSON_CASE_INSENSITIVE_FUNCTIONS
|
||||
ti = test.find_nocase(JSON_TEXT("BYE"));
|
||||
assertEquals(ti, test.end());
|
||||
ti = test.find_nocase(JSON_TEXT("HAI"));
|
||||
assertNotEquals(ti, test.end());
|
||||
assertEquals(*ti, JSON_TEXT("Mars"));
|
||||
ti = test.find_nocase(JSON_TEXT("HEY"));
|
||||
assertNotEquals(ti, test.end());
|
||||
assertEquals(*ti, JSON_TEXT("Jude"));
|
||||
ti = test.find_nocase(JSON_TEXT("HI"));
|
||||
assertNotEquals(ti, test.end());
|
||||
assertEquals(*ti, JSON_TEXT("World"));
|
||||
#endif
|
||||
UnitTest::SetPrefix("TestIterators.cpp - Iterator Erase");
|
||||
|
||||
ti = test.erase(test.begin() + 3);
|
||||
assertEquals(test.size(), 4);
|
||||
assertEquals(test[0], JSON_TEXT("World"));
|
||||
assertEquals(test[1], JSON_TEXT("There"));
|
||||
assertEquals(test[2], JSON_TEXT("Mars"));
|
||||
assertEquals(test[3], JSON_TEXT("Jude"));
|
||||
assertEquals(*ti, JSON_TEXT("Jude"));
|
||||
ti = test.erase(test.begin());
|
||||
assertEquals(test.size(), 3);
|
||||
assertEquals(test[0], JSON_TEXT("There"));
|
||||
assertEquals(test[1], JSON_TEXT("Mars"));
|
||||
assertEquals(test[2], JSON_TEXT("Jude"));
|
||||
assertEquals(*ti, JSON_TEXT("There"));
|
||||
|
||||
JSONNode::reverse_iterator rti = test.rbegin();
|
||||
assertEquals(*rti, JSON_TEXT("Jude"));
|
||||
#ifdef JSON_SAFE
|
||||
rti = test.erase(test.rend());
|
||||
assertEquals(test.size(), 3);
|
||||
assertEquals(test[0], JSON_TEXT("There"));
|
||||
assertEquals(test[1], JSON_TEXT("Mars"));
|
||||
assertEquals(test[2], JSON_TEXT("Jude"));
|
||||
assertEquals(rti, test.rend());
|
||||
ti = test.erase(test.end());
|
||||
assertEquals(test.size(), 3);
|
||||
assertEquals(test[0], JSON_TEXT("There"));
|
||||
assertEquals(test[1], JSON_TEXT("Mars"));
|
||||
assertEquals(test[2], JSON_TEXT("Jude"));
|
||||
assertEquals(ti, test.end());
|
||||
#endif
|
||||
rti = test.erase(test.rbegin());
|
||||
assertEquals(test.size(), 2);
|
||||
assertEquals(test[0], JSON_TEXT("There"));
|
||||
assertEquals(test[1], JSON_TEXT("Mars"));
|
||||
assertEquals(*rti, JSON_TEXT("Mars"));
|
||||
|
||||
rti = test.erase(test.rbegin());
|
||||
assertEquals(test.size(), 1);
|
||||
assertEquals(test[0], JSON_TEXT("There"));
|
||||
assertEquals(*rti, JSON_TEXT("There"));
|
||||
|
||||
test.erase(test.rbegin());
|
||||
assertEquals(test.size(), 0);
|
||||
#ifdef JSON_SAFE
|
||||
test.erase(test.rend());
|
||||
assertEquals(test.size(), 0);
|
||||
test.erase(test.end());
|
||||
assertEquals(test.size(), 0);
|
||||
#endif
|
||||
|
||||
CreateTest(test);
|
||||
i = 0;
|
||||
for (JSONNode::iterator it = test.begin(); it != test.end(); it = test.erase(it)){
|
||||
++i;
|
||||
}
|
||||
assertEquals(test.size(), 0);
|
||||
assertEquals(i, 5);
|
||||
|
||||
CreateTest(test);
|
||||
i = 0;
|
||||
for (JSONNode::reverse_iterator it = test.rbegin(); it != test.rend(); it = test.erase(it)){
|
||||
++i;
|
||||
}
|
||||
assertEquals(test.size(), 0);
|
||||
assertEquals(i, 5);
|
||||
|
||||
UnitTest::SetPrefix("TestIterators.cpp - Iterator Bulk Erase");
|
||||
CreateTest(test);
|
||||
|
||||
ti = test.erase(test.begin(), test.begin());
|
||||
assertEquals(test.size(), 5);
|
||||
assertEquals(test[0], JSON_TEXT("World"));
|
||||
assertEquals(test[1], JSON_TEXT("There"));
|
||||
assertEquals(test[2], JSON_TEXT("Mars"));
|
||||
assertEquals(test[3], JSON_TEXT("Earth"));
|
||||
assertEquals(test[4], JSON_TEXT("Jude"));
|
||||
assertEquals(ti, test.begin());
|
||||
|
||||
test.erase(test.begin(), test.end());
|
||||
assertEquals(test.size(), 0);
|
||||
CreateTest(test);
|
||||
|
||||
ti = test.erase(test.begin(), test.begin() + 1);
|
||||
assertEquals(test.size(), 4);
|
||||
assertEquals(test[0], JSON_TEXT("There"));
|
||||
assertEquals(test[1], JSON_TEXT("Mars"));
|
||||
assertEquals(test[2], JSON_TEXT("Earth"));
|
||||
assertEquals(test[3], JSON_TEXT("Jude"));
|
||||
assertEquals(ti, test.begin());
|
||||
|
||||
ti = test.erase(test.begin(), test.begin() + 2);
|
||||
assertEquals(test.size(), 2);
|
||||
assertEquals(test[0], JSON_TEXT("Earth"));
|
||||
assertEquals(test[1], JSON_TEXT("Jude"));
|
||||
assertEquals(ti, test.begin());
|
||||
|
||||
ti = test.erase(test.begin(), test.end() - 1);
|
||||
assertEquals(test.size(), 1);
|
||||
assertEquals(test[0], JSON_TEXT("Jude"));
|
||||
assertEquals(ti, test.begin());
|
||||
test.clear();
|
||||
|
||||
UnitTest::SetPrefix("TestIterators.cpp - Iterator Bulk Reverse Erase");
|
||||
CreateTest(test);
|
||||
|
||||
rti = test.erase(test.rbegin(), test.rbegin());
|
||||
assertEquals(test.size(), 5);
|
||||
assertEquals(test[0], JSON_TEXT("World"));
|
||||
assertEquals(test[1], JSON_TEXT("There"));
|
||||
assertEquals(test[2], JSON_TEXT("Mars"));
|
||||
assertEquals(test[3], JSON_TEXT("Earth"));
|
||||
assertEquals(test[4], JSON_TEXT("Jude"));
|
||||
assertEquals(rti, test.rbegin());
|
||||
|
||||
rti = test.erase(test.rbegin(), test.rend());
|
||||
assertEquals(test.size(), 0);
|
||||
assertEquals(rti, test.rbegin());
|
||||
assertEquals(rti, test.rend());
|
||||
CreateTest(test);
|
||||
|
||||
rti = test.erase(test.rbegin(), test.rbegin() + 1);
|
||||
assertEquals(test.size(), 4);
|
||||
assertEquals(test[0], JSON_TEXT("World"));
|
||||
assertEquals(test[1], JSON_TEXT("There"));
|
||||
assertEquals(test[2], JSON_TEXT("Mars"));
|
||||
assertEquals(test[3], JSON_TEXT("Earth"));
|
||||
assertEquals(rti, test.rbegin());
|
||||
|
||||
rti = test.erase(test.rbegin(), test.rbegin() + 2);
|
||||
assertEquals(rti, test.rbegin());
|
||||
assertEquals(test.size(), 2);
|
||||
assertEquals(test[0], JSON_TEXT("World"));
|
||||
assertEquals(test[1], JSON_TEXT("There"));
|
||||
assertEquals(rti, test.rbegin());
|
||||
|
||||
rti = test.erase(test.rbegin(), test.rend() - 1);
|
||||
assertEquals(test.size(), 1);
|
||||
assertEquals(test[0], JSON_TEXT("World"));
|
||||
assertEquals(rti, test.rbegin());
|
||||
test.clear();
|
||||
|
||||
UnitTest::SetPrefix("TestIterators.cpp - Iterator Insert");
|
||||
CreateTest(test);
|
||||
ti = test.insert(test.begin() + 3, JSONNode(JSON_TEXT("olah"), JSON_TEXT("Pluto")));
|
||||
assertEquals(test.size(), 6);
|
||||
assertEquals(test[0], JSON_TEXT("World"));
|
||||
assertEquals(test[1], JSON_TEXT("There"));
|
||||
assertEquals(test[2], JSON_TEXT("Mars"));
|
||||
assertEquals(test[3], JSON_TEXT("Pluto"));
|
||||
assertEquals(test[4], JSON_TEXT("Earth"));
|
||||
assertEquals(test[5], JSON_TEXT("Jude"));
|
||||
assertEquals(*ti, JSON_TEXT("Pluto"));
|
||||
assertEquals(ti -> as_string(), JSON_TEXT("Pluto"));
|
||||
assertEquals(ti, test.begin() + 3);
|
||||
test.clear();
|
||||
|
||||
CreateTest(test);
|
||||
ti = test.insert(test.begin(), JSONNode(JSON_TEXT("olah"), JSON_TEXT("Pluto")));
|
||||
assertEquals(test.size(), 6);
|
||||
assertEquals(test[0], JSON_TEXT("Pluto"));
|
||||
assertEquals(test[1], JSON_TEXT("World"));
|
||||
assertEquals(test[2], JSON_TEXT("There"));
|
||||
assertEquals(test[3], JSON_TEXT("Mars"));
|
||||
assertEquals(test[4], JSON_TEXT("Earth"));
|
||||
assertEquals(test[5], JSON_TEXT("Jude"));
|
||||
assertEquals(*ti, JSON_TEXT("Pluto"));
|
||||
assertEquals(ti -> as_string(), JSON_TEXT("Pluto"));
|
||||
assertEquals(ti, test.begin());
|
||||
test.clear();
|
||||
|
||||
CreateTest(test);
|
||||
ti = test.insert(test.begin() + 5, JSONNode(JSON_TEXT("olah"), JSON_TEXT("Pluto")));
|
||||
assertEquals(test.size(), 6);
|
||||
assertEquals(test[0], JSON_TEXT("World"));
|
||||
assertEquals(test[1], JSON_TEXT("There"));
|
||||
assertEquals(test[2], JSON_TEXT("Mars"));
|
||||
assertEquals(test[3], JSON_TEXT("Earth"));
|
||||
assertEquals(test[4], JSON_TEXT("Jude"));
|
||||
assertEquals(test[5], JSON_TEXT("Pluto"));
|
||||
assertEquals(*ti, JSON_TEXT("Pluto"));
|
||||
assertEquals(ti -> as_string(), JSON_TEXT("Pluto"));
|
||||
assertEquals(ti, test.begin() + 5);
|
||||
test.clear();
|
||||
|
||||
CreateTest(test);
|
||||
rti = test.insert(test.rbegin(), JSONNode(JSON_TEXT("olah"), JSON_TEXT("Pluto")));
|
||||
assertEquals(test.size(), 6);
|
||||
assertEquals(test[0], JSON_TEXT("World"));
|
||||
assertEquals(test[1], JSON_TEXT("There"));
|
||||
assertEquals(test[2], JSON_TEXT("Mars"));
|
||||
assertEquals(test[3], JSON_TEXT("Earth"));
|
||||
assertEquals(test[4], JSON_TEXT("Jude"));
|
||||
assertEquals(test[5], JSON_TEXT("Pluto"));
|
||||
assertEquals(*rti, JSON_TEXT("Pluto"));
|
||||
assertEquals(rti, test.rbegin());
|
||||
test.clear();
|
||||
|
||||
CreateTest(test);
|
||||
rti = test.insert(test.rbegin() + 5, JSONNode(JSON_TEXT("olah"), JSON_TEXT("Pluto")));
|
||||
assertEquals(test.size(), 6);
|
||||
assertEquals(test[0], JSON_TEXT("Pluto"));
|
||||
assertEquals(test[1], JSON_TEXT("World"));
|
||||
assertEquals(test[2], JSON_TEXT("There"));
|
||||
assertEquals(test[3], JSON_TEXT("Mars"));
|
||||
assertEquals(test[4], JSON_TEXT("Earth"));
|
||||
assertEquals(test[5], JSON_TEXT("Jude"))
|
||||
assertEquals(*rti, JSON_TEXT("Pluto"));
|
||||
assertEquals(rti, test.rbegin() + 5);
|
||||
test.clear();
|
||||
|
||||
CreateTest(test);
|
||||
rti = test.insert(test.rbegin() + 2, JSONNode(JSON_TEXT("olah"), JSON_TEXT("Pluto")));
|
||||
assertEquals(test.size(), 6);
|
||||
assertEquals(test[0], JSON_TEXT("World"));
|
||||
assertEquals(test[1], JSON_TEXT("There"));
|
||||
assertEquals(test[2], JSON_TEXT("Mars"));
|
||||
assertEquals(test[3], JSON_TEXT("Pluto"));
|
||||
assertEquals(test[4], JSON_TEXT("Earth"));
|
||||
assertEquals(test[5], JSON_TEXT("Jude"));
|
||||
assertEquals(*rti, JSON_TEXT("Pluto"));
|
||||
assertEquals(rti, test.rbegin() + 2);
|
||||
test.clear();
|
||||
|
||||
JSONNode test3;
|
||||
|
||||
CreateTest(test);
|
||||
CreateTest(test3);
|
||||
ti = test3.insert(test3.begin() + 3, test.begin() + 1, test.begin() + 3);
|
||||
assertEquals(test3.size(), 7);
|
||||
assertEquals(test3[0], JSON_TEXT("World"));
|
||||
assertEquals(test3[1], JSON_TEXT("There"));
|
||||
assertEquals(test3[2], JSON_TEXT("Mars"));
|
||||
assertEquals(test3[3], JSON_TEXT("There"));
|
||||
assertEquals(test3[4], JSON_TEXT("Mars"));
|
||||
assertEquals(test3[5], JSON_TEXT("Earth"));
|
||||
assertEquals(test3[6], JSON_TEXT("Jude"));
|
||||
assertEquals(*ti, JSON_TEXT("There"));
|
||||
assertEquals(ti, test3.begin() + 3);
|
||||
test.clear();
|
||||
test3.clear();
|
||||
|
||||
CreateTest(test);
|
||||
CreateTest(test3);
|
||||
ti = test3.insert(test3.begin(), test.begin() + 1, test.begin() + 3);
|
||||
assertEquals(test3.size(), 7);
|
||||
assertEquals(test3[0], JSON_TEXT("There"));
|
||||
assertEquals(test3[1], JSON_TEXT("Mars"));
|
||||
assertEquals(test3[2], JSON_TEXT("World"));
|
||||
assertEquals(test3[3], JSON_TEXT("There"));
|
||||
assertEquals(test3[4], JSON_TEXT("Mars"));
|
||||
assertEquals(test3[5], JSON_TEXT("Earth"));
|
||||
assertEquals(test3[6], JSON_TEXT("Jude"));
|
||||
assertEquals(*ti, JSON_TEXT("There"));
|
||||
assertEquals(ti, test3.begin());
|
||||
test.clear();
|
||||
test3.clear();
|
||||
|
||||
CreateTest(test);
|
||||
CreateTest(test3);
|
||||
test3[2] = JSON_TEXT("lol");
|
||||
test3[3] = JSON_TEXT("lul");
|
||||
ti = test3.insert(test3.begin() + 5, test.begin() + 1, test.begin() + 3);
|
||||
assertEquals(test3.size(), 7);
|
||||
assertEquals(test3[0], JSON_TEXT("World"));
|
||||
assertEquals(test3[1], JSON_TEXT("There"));
|
||||
assertEquals(test3[2], JSON_TEXT("lol"));
|
||||
assertEquals(test3[3], JSON_TEXT("lul"));
|
||||
assertEquals(test3[4], JSON_TEXT("Jude"));
|
||||
assertEquals(test3[5], JSON_TEXT("There"));
|
||||
assertEquals(test3[6], JSON_TEXT("Mars"));
|
||||
assertEquals(*ti, JSON_TEXT("There"));
|
||||
assertEquals(ti, test3.begin() + 5);
|
||||
test.clear();
|
||||
test3.clear();
|
||||
|
||||
|
||||
CreateTest(test);
|
||||
CreateTest(test3);
|
||||
test3[2] = JSON_TEXT("lol");
|
||||
test3[3] = JSON_TEXT("lul");
|
||||
ti = test3.insert(test3.begin() + 3, test.rbegin() + 1, test.rbegin() + 3);
|
||||
assertEquals(test3.size(), 7);
|
||||
assertEquals(test3[0], JSON_TEXT("World"));
|
||||
assertEquals(test3[1], JSON_TEXT("There"));
|
||||
assertEquals(test3[2], JSON_TEXT("lol"));
|
||||
assertEquals(test3[3], JSON_TEXT("Earth"));
|
||||
assertEquals(test3[4], JSON_TEXT("Mars"));
|
||||
assertEquals(test3[5], JSON_TEXT("lul"));
|
||||
assertEquals(test3[6], JSON_TEXT("Jude"));
|
||||
assertEquals(*ti, JSON_TEXT("Earth"));
|
||||
assertEquals(ti, test3.begin() + 3);
|
||||
test.clear();
|
||||
test3.clear();
|
||||
|
||||
CreateTest(test);
|
||||
CreateTest(test3);
|
||||
test3[2] = JSON_TEXT("lol");
|
||||
test3[3] = JSON_TEXT("lul");
|
||||
ti = test3.insert(test3.begin(), test.rbegin() + 1, test.rbegin() + 3);
|
||||
assertEquals(test3.size(), 7);
|
||||
assertEquals(test3[0], JSON_TEXT("Earth"));
|
||||
assertEquals(test3[1], JSON_TEXT("Mars"));
|
||||
assertEquals(test3[2], JSON_TEXT("World"));
|
||||
assertEquals(test3[3], JSON_TEXT("There"));
|
||||
assertEquals(test3[4], JSON_TEXT("lol"));
|
||||
assertEquals(test3[5], JSON_TEXT("lul"));
|
||||
assertEquals(test3[6], JSON_TEXT("Jude"));
|
||||
assertEquals(*ti, JSON_TEXT("Earth"));
|
||||
assertEquals(ti, test3.begin());
|
||||
test.clear();
|
||||
test3.clear();
|
||||
|
||||
CreateTest(test);
|
||||
CreateTest(test3);
|
||||
test3[2] = JSON_TEXT("lol");
|
||||
test3[3] = JSON_TEXT("lul");
|
||||
ti = test3.insert(test3.begin() + 5, test.rbegin() + 1, test.rbegin() + 3);
|
||||
assertEquals(test3.size(), 7);
|
||||
assertEquals(test3[0], JSON_TEXT("World"));
|
||||
assertEquals(test3[1], JSON_TEXT("There"));
|
||||
assertEquals(test3[2], JSON_TEXT("lol"));
|
||||
assertEquals(test3[3], JSON_TEXT("lul"));
|
||||
assertEquals(test3[4], JSON_TEXT("Jude"));
|
||||
assertEquals(test3[5], JSON_TEXT("Earth"));
|
||||
assertEquals(test3[6], JSON_TEXT("Mars"));
|
||||
assertEquals(*ti, JSON_TEXT("Earth"));
|
||||
assertEquals(ti, test3.begin() + 5);
|
||||
test.clear();
|
||||
test3.clear();
|
||||
|
||||
|
||||
|
||||
|
||||
CreateTest(test);
|
||||
CreateTest(test3);
|
||||
test3[1] = JSON_TEXT("lol");
|
||||
test3[2] = JSON_TEXT("lul");
|
||||
rti = test3.insert(test3.rbegin(), test.begin() + 1, test.begin() + 3);
|
||||
assertEquals(test3.size(), 7);
|
||||
assertEquals(test3[0], JSON_TEXT("World"));
|
||||
assertEquals(test3[1], JSON_TEXT("lol"));
|
||||
assertEquals(test3[2], JSON_TEXT("lul"));
|
||||
assertEquals(test3[3], JSON_TEXT("Earth"));
|
||||
assertEquals(test3[4], JSON_TEXT("Jude"));
|
||||
assertEquals(test3[5], JSON_TEXT("Mars"));
|
||||
assertEquals(test3[6], JSON_TEXT("There"));
|
||||
assertEquals(*rti, JSON_TEXT("There"));
|
||||
assertEquals(rti, test3.rbegin());
|
||||
test.clear();
|
||||
test3.clear();
|
||||
|
||||
CreateTest(test);
|
||||
CreateTest(test3);
|
||||
test3[1] = JSON_TEXT("lol");
|
||||
test3[2] = JSON_TEXT("lul");
|
||||
rti = test3.insert(test3.rbegin() + 3, test.begin() + 1, test.begin() + 3);
|
||||
assertEquals(test3.size(), 7);
|
||||
assertEquals(test3[0], JSON_TEXT("World"));
|
||||
assertEquals(test3[1], JSON_TEXT("lol"));
|
||||
assertEquals(test3[2], JSON_TEXT("Mars"));
|
||||
assertEquals(test3[3], JSON_TEXT("There"));
|
||||
assertEquals(test3[4], JSON_TEXT("lul"));
|
||||
assertEquals(test3[5], JSON_TEXT("Earth"));
|
||||
assertEquals(test3[6], JSON_TEXT("Jude"));
|
||||
assertEquals(*rti, JSON_TEXT("There"));
|
||||
assertEquals(rti, test3.rbegin() + 3);
|
||||
test.clear();
|
||||
test3.clear();
|
||||
|
||||
CreateTest(test);
|
||||
CreateTest(test3);
|
||||
test3[1] = JSON_TEXT("lol");
|
||||
test3[2] = JSON_TEXT("lul");
|
||||
rti = test3.insert(test3.rbegin() + 5, test.begin() + 1, test.begin() + 3);
|
||||
assertEquals(test3.size(), 7);
|
||||
assertEquals(test3[0], JSON_TEXT("Mars"));
|
||||
assertEquals(test3[1], JSON_TEXT("There"));
|
||||
assertEquals(test3[2], JSON_TEXT("World"));
|
||||
assertEquals(test3[3], JSON_TEXT("lol"));
|
||||
assertEquals(test3[4], JSON_TEXT("lul"));
|
||||
assertEquals(test3[5], JSON_TEXT("Earth"));
|
||||
assertEquals(test3[6], JSON_TEXT("Jude"));
|
||||
assertEquals(*rti, JSON_TEXT("There"));
|
||||
assertEquals(rti, test3.rbegin() + 5);
|
||||
test.clear();
|
||||
test3.clear();
|
||||
|
||||
|
||||
CreateTest(test);
|
||||
CreateTest(test3);
|
||||
test3[2] = JSON_TEXT("lol");
|
||||
test3[3] = JSON_TEXT("lul");
|
||||
rti = test3.insert(test3.rbegin(), test.rbegin() + 1, test.rbegin() + 3);
|
||||
assertEquals(test3.size(), 7);
|
||||
assertEquals(test3[0], JSON_TEXT("World"));
|
||||
assertEquals(test3[1], JSON_TEXT("There"));
|
||||
assertEquals(test3[2], JSON_TEXT("lol"));
|
||||
assertEquals(test3[3], JSON_TEXT("lul"));
|
||||
assertEquals(test3[4], JSON_TEXT("Jude"));
|
||||
assertEquals(test3[5], JSON_TEXT("Earth"));
|
||||
assertEquals(test3[6], JSON_TEXT("Mars"));
|
||||
assertEquals(*rti, JSON_TEXT("Mars"));
|
||||
assertEquals(rti, test3.rbegin());
|
||||
test.clear();
|
||||
test3.clear();
|
||||
|
||||
CreateTest(test);
|
||||
CreateTest(test3);
|
||||
test3[2] = JSON_TEXT("lol");
|
||||
test3[3] = JSON_TEXT("lul");
|
||||
rti = test3.insert(test3.rbegin() + 3, test.rbegin() + 1, test.rbegin() + 3);
|
||||
assertEquals(test3.size(), 7);
|
||||
assertEquals(test3[0], JSON_TEXT("World"));
|
||||
assertEquals(test3[1], JSON_TEXT("There"));
|
||||
assertEquals(test3[2], JSON_TEXT("Earth"));
|
||||
assertEquals(test3[3], JSON_TEXT("Mars"));
|
||||
assertEquals(test3[4], JSON_TEXT("lol"));
|
||||
assertEquals(test3[5], JSON_TEXT("lul"));
|
||||
assertEquals(test3[6], JSON_TEXT("Jude"));
|
||||
assertEquals(*rti, JSON_TEXT("Mars"));
|
||||
assertEquals(rti, test3.rbegin() + 3);
|
||||
test.clear();
|
||||
test3.clear();
|
||||
|
||||
CreateTest(test);
|
||||
CreateTest(test3);
|
||||
test3[2] = JSON_TEXT("lol");
|
||||
test3[3] = JSON_TEXT("lul");
|
||||
rti = test3.insert(test3.rbegin() + 5, test.rbegin() + 1, test.rbegin() + 3);
|
||||
assertEquals(test3.size(), 7);
|
||||
assertEquals(test3[0], JSON_TEXT("Earth"));
|
||||
assertEquals(test3[1], JSON_TEXT("Mars"));
|
||||
assertEquals(test3[2], JSON_TEXT("World"));
|
||||
assertEquals(test3[3], JSON_TEXT("There"));
|
||||
assertEquals(test3[4], JSON_TEXT("lol"));
|
||||
assertEquals(test3[5], JSON_TEXT("lul"));
|
||||
assertEquals(test3[6], JSON_TEXT("Jude"));
|
||||
assertEquals(*rti, JSON_TEXT("Mars"));
|
||||
assertEquals(rti, test3.rbegin() + 5);
|
||||
test.clear();
|
||||
test3.clear();
|
||||
#endif
|
||||
#endif
|
||||
}
|
|
@ -1,345 +0,0 @@
|
|||
#include "TestSuite.h"
|
||||
#include "../Source/JSONNode.h"
|
||||
|
||||
|
||||
#ifdef JSON_MUTEX_CALLBACKS
|
||||
int testMutex = 0;
|
||||
bool doassert = true;
|
||||
int managerlock;
|
||||
static void lock(void * mutex){
|
||||
if (mutex == &managerlock) return;
|
||||
if (doassert) assertEquals(mutex, &testMutex);
|
||||
if (mutex != &testMutex) return; //to avoid access violations to tests fail, but don't crash
|
||||
++(*((int*)mutex));
|
||||
}
|
||||
static void unlock(void * mutex){
|
||||
if (mutex == &managerlock) return;
|
||||
if (doassert) assertEquals(mutex, &testMutex);
|
||||
if (mutex != &testMutex) return; //to avoid access violations to tests fail, but don't crash
|
||||
--(*((int*)mutex));
|
||||
}
|
||||
|
||||
void * currentMutexTest = 0;
|
||||
|
||||
#ifdef JSON_MUTEX_MANAGE
|
||||
#include "../Source/JSONGlobals.h"
|
||||
|
||||
static void destroy(void * mutex){
|
||||
assertEquals(mutex, currentMutexTest);
|
||||
assertEquals(*((int*)mutex), 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
void TestSuite::TestMutex(void){
|
||||
UnitTest::SetPrefix("TestMutex.cpp - Mutex");
|
||||
|
||||
#ifdef JSON_LIBRARY
|
||||
|
||||
|
||||
#ifdef JSON_MUTEX_MANAGE
|
||||
json_register_mutex_callbacks(lock, unlock, destroy, &managerlock);
|
||||
#else
|
||||
json_register_mutex_callbacks(lock, unlock, &managerlock);
|
||||
#endif
|
||||
|
||||
currentMutexTest = &testMutex;
|
||||
{
|
||||
JSONNODE * test1 = json_new(JSON_NODE);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertNull(((JSONNode*)test1) -> internal -> mylock);
|
||||
#endif
|
||||
|
||||
JSONNODE * test2 = json_copy(test1);
|
||||
assertNotEquals(test1, test2);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertNull(((JSONNode*)test2) -> internal -> mylock);
|
||||
#endif
|
||||
|
||||
json_set_mutex(test2, &testMutex);
|
||||
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertEquals(((JSONNode*)test2) -> internal -> mylock, &testMutex);
|
||||
assertNull(((JSONNode*)test1) -> internal -> mylock);
|
||||
#endif
|
||||
|
||||
JSONNODE * test3 = json_copy(test2);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertEquals(((JSONNode*)test3) -> internal -> mylock, &testMutex);
|
||||
assertEquals(((JSONNode*)test2) -> internal -> mylock, &testMutex);
|
||||
#endif
|
||||
json_set_a(test3, JSON_TEXT("Hello World"));
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertEquals(((JSONNode*)test3) -> internal -> mylock, &testMutex);
|
||||
#endif
|
||||
|
||||
#ifdef JSON_CASTABLE
|
||||
json_cast(test3, JSON_NODE);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertEquals(((JSONNode*)test3) -> internal -> mylock, &testMutex);
|
||||
#endif
|
||||
|
||||
JSONNODE * tree = json_new(JSON_NODE);
|
||||
json_push_back(tree, json_new_a(JSON_TEXT("Hello"), JSON_TEXT("world")));
|
||||
json_push_back(tree, json_new_a(JSON_TEXT("Hello"), JSON_TEXT("Mars")));
|
||||
json_push_back(tree, json_new_a(JSON_TEXT("Hello"), JSON_TEXT("USA")));
|
||||
json_push_back(test3, json_copy(tree));
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertEquals(((JSONNode*)test3) -> internal -> mylock, &testMutex);
|
||||
assertEquals(((JSONNode*)json_at(test3, 0)) -> internal -> mylock, &testMutex);
|
||||
assertEquals(((JSONNode*)json_at(json_at(test3, 0), 0)) -> internal -> mylock, &testMutex);
|
||||
assertEquals(((JSONNode*)json_at(json_at(test3, 0), 1)) -> internal -> mylock, &testMutex);
|
||||
assertEquals(((JSONNode*)json_at(json_at(test3, 0), 2)) -> internal -> mylock, &testMutex);
|
||||
#endif
|
||||
|
||||
json_clear(test3);
|
||||
json_set_mutex(test3, 0);
|
||||
assertEquals(json_size(test3), 0);
|
||||
assertEquals(json_size(tree), 3);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertNull(((JSONNode*)tree) -> internal -> mylock);
|
||||
assertNull(((JSONNode*)json_at(tree, 0)) -> internal -> mylock);
|
||||
assertNull(((JSONNode*)json_at(tree, 1)) -> internal -> mylock);
|
||||
assertNull(((JSONNode*)json_at(tree, 2)) -> internal -> mylock);
|
||||
#endif
|
||||
json_set_mutex(tree, &testMutex);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertEquals(((JSONNode*)tree) -> internal -> mylock, &testMutex);
|
||||
assertEquals(((JSONNode*)json_at(tree, 0)) -> internal -> mylock, &testMutex);
|
||||
assertEquals(((JSONNode*)json_at(tree, 1)) -> internal -> mylock, &testMutex);
|
||||
assertEquals(((JSONNode*)json_at(tree, 2)) -> internal -> mylock, &testMutex);
|
||||
#endif
|
||||
json_push_back(test3, tree);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertNull(((JSONNode*)test3) -> internal -> mylock);
|
||||
assertEquals(((JSONNode*)json_at(test3, 0)) -> internal -> mylock, &testMutex);
|
||||
assertEquals(((JSONNode*)json_at(json_at(test3, 0), 0)) -> internal -> mylock, &testMutex);
|
||||
assertEquals(((JSONNode*)json_at(json_at(test3, 0), 1)) -> internal -> mylock, &testMutex);
|
||||
assertEquals(((JSONNode*)json_at(json_at(test3, 0), 2)) -> internal -> mylock, &testMutex);
|
||||
#endif
|
||||
assertEquals(testMutex, 0);
|
||||
#endif
|
||||
|
||||
#ifdef JSON_MUTEX_MANAGE
|
||||
UnitTest::SetPrefix("TestMutex.cpp - Mutex Management");
|
||||
{
|
||||
JSONNODE * deleteTest = json_new(JSON_NODE);
|
||||
int i = 0;
|
||||
currentMutexTest = &i;
|
||||
json_set_mutex(deleteTest, &i);
|
||||
JSON_MAP(void *, unsigned int)::iterator it = json_global(MUTEX_MANAGER).find((void*)&i);
|
||||
assertEquals(json_global(MUTEX_MANAGER).size(), 2);
|
||||
assertNotEquals(it, json_global(MUTEX_MANAGER).end());
|
||||
assertEquals(it -> first, (void*)&i);
|
||||
assertEquals(it -> second, 1);
|
||||
|
||||
json_set_mutex(deleteTest, &testMutex);
|
||||
currentMutexTest = &testMutex;
|
||||
json_delete(deleteTest);
|
||||
}
|
||||
#endif
|
||||
|
||||
json_delete(test1);
|
||||
json_delete(test2);
|
||||
json_delete(test3);
|
||||
}
|
||||
#ifdef JSON_MUTEX_MANAGE
|
||||
JSON_MAP(void *, unsigned int)::iterator it = json_global(MUTEX_MANAGER).find((void*)&testMutex);
|
||||
assertEquals(json_global(MUTEX_MANAGER).size(), 0);
|
||||
assertEquals(it, json_global(MUTEX_MANAGER).end());
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#else
|
||||
#ifdef JSON_MUTEX_MANAGE
|
||||
libjson::register_mutex_callbacks(lock, unlock, destroy, &managerlock);
|
||||
#else
|
||||
libjson::register_mutex_callbacks(lock, unlock, &managerlock);
|
||||
#endif
|
||||
|
||||
currentMutexTest = &testMutex;
|
||||
{
|
||||
JSONNode test1;
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertNull(test1.internal -> mylock);
|
||||
#endif
|
||||
JSONNode test2 = JSONNode(test1);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertNull(test1.internal -> mylock);
|
||||
#endif
|
||||
test2.set_mutex(&testMutex);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertEquals(test2.internal -> mylock, &testMutex);
|
||||
assertNull(test1.internal -> mylock);
|
||||
#endif
|
||||
|
||||
JSONNode test3 = test2;
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertEquals(test3.internal -> mylock, &testMutex);
|
||||
assertEquals(test2.internal -> mylock, &testMutex);
|
||||
#endif
|
||||
test3 = JSON_TEXT("Hello World");
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertEquals(test3.internal -> mylock, &testMutex);
|
||||
#endif
|
||||
|
||||
#ifdef JSON_CASTABLE
|
||||
test3.cast(JSON_NODE);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertEquals(test3.internal -> mylock, &testMutex);
|
||||
#endif
|
||||
JSONNode tree = JSONNode(JSON_NODE);
|
||||
tree.push_back(JSONNode(JSON_TEXT("Hello"), JSON_TEXT("world")));
|
||||
tree.push_back(JSONNode(JSON_TEXT("Hello"), JSON_TEXT("Mars")));
|
||||
tree.push_back(JSONNode(JSON_TEXT("Hello"), JSON_TEXT("USA")));
|
||||
test3.push_back(tree);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertEquals(test3.internal -> mylock, &testMutex);
|
||||
assertEquals(test3[0].internal -> mylock, &testMutex);
|
||||
assertEquals(test3[0][0].internal -> mylock, &testMutex);
|
||||
assertEquals(test3[0][1].internal -> mylock, &testMutex);
|
||||
assertEquals(test3[0][2].internal -> mylock, &testMutex);
|
||||
#endif
|
||||
|
||||
|
||||
test3.clear();
|
||||
test3.set_mutex(0);
|
||||
assertEquals(test3.size(), 0);
|
||||
assertEquals(tree.size(), 3);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertNull(tree.internal -> mylock);
|
||||
assertNull(tree[0].internal -> mylock);
|
||||
assertNull(tree[1].internal -> mylock);
|
||||
assertNull(tree[2].internal -> mylock);
|
||||
#endif
|
||||
tree.set_mutex(&testMutex);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertEquals(tree.internal -> mylock, &testMutex);
|
||||
assertEquals(tree[0].internal -> mylock, &testMutex);
|
||||
assertEquals(tree[1].internal -> mylock, &testMutex);
|
||||
assertEquals(tree[2].internal -> mylock, &testMutex);
|
||||
#endif
|
||||
test3.push_back(tree);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertNull(test3.internal -> mylock);
|
||||
assertEquals(test3[0].internal -> mylock, &testMutex);
|
||||
assertEquals(test3[0][0].internal -> mylock, &testMutex);
|
||||
assertEquals(test3[0][1].internal -> mylock, &testMutex);
|
||||
assertEquals(test3[0][2].internal -> mylock, &testMutex);
|
||||
#endif
|
||||
#ifndef JSON_SAFE
|
||||
doassert = false;
|
||||
#endif
|
||||
{
|
||||
JSONNode::auto_lock temp1(test3, 1); //null, so it should do nothing
|
||||
JSONNode::auto_lock temp2(tree, 1);
|
||||
assertEquals(testMutex, 1);
|
||||
}
|
||||
#ifndef JSON_SAFE
|
||||
doassert = true;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
assertEquals(testMutex, 0);
|
||||
|
||||
#ifdef JSON_MUTEX_MANAGE
|
||||
UnitTest::SetPrefix("TestMutex.cpp - Mutex Management");
|
||||
{
|
||||
JSONNode deleteTest = JSONNode(JSON_NODE);
|
||||
int i = 0;
|
||||
currentMutexTest = &i;
|
||||
deleteTest.set_mutex(&i);
|
||||
JSON_MAP(void *, unsigned int)::iterator it = json_global(MUTEX_MANAGER).find((void*)&i);
|
||||
assertEquals(json_global(MUTEX_MANAGER).size(), 2);
|
||||
assertNotEquals(it, json_global(MUTEX_MANAGER).end());
|
||||
assertEquals(it -> first, (void*)&i);
|
||||
assertEquals(it -> second, 1);
|
||||
|
||||
deleteTest.set_mutex(&testMutex);
|
||||
currentMutexTest = &testMutex;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#ifdef JSON_MUTEX_MANAGE
|
||||
std::map<void *, unsigned int>::iterator it = json_global(MUTEX_MANAGER).find((void*)&testMutex);
|
||||
assertEquals(json_global(MUTEX_MANAGER).size(), 0);
|
||||
assertEquals(it, json_global(MUTEX_MANAGER).end());
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef JSON_MUTEX_CALLBACKS
|
||||
int handler = 0;
|
||||
static void lock_mutex(void * mutex){
|
||||
if (mutex == &handler) return;
|
||||
assertEquals(mutex, &testMutex);
|
||||
if (mutex != &testMutex) return; //to avoid access violations to tests fail, but don't crash
|
||||
++(*((int*)mutex));
|
||||
}
|
||||
static void unlock_mutex(void * mutex){
|
||||
if (mutex == &handler) return;
|
||||
assertEquals(mutex, &testMutex);
|
||||
if (mutex != &testMutex) return; //to avoid access violations to tests fail, but don't crash
|
||||
--(*((int*)mutex));
|
||||
}
|
||||
|
||||
static void destroy_mutex(void * ){}
|
||||
|
||||
void TestSuite::TestThreading(void){
|
||||
//going to fake two threads os that I don't need pthread to link
|
||||
UnitTest::SetPrefix("TestMutex.cpp - Threading");
|
||||
testMutex = 0;
|
||||
#ifdef JSON_LIBRARY
|
||||
//create the JSONNode
|
||||
JSONNODE * test = json_new(JSON_NODE);
|
||||
#ifdef JSON_MUTEX_MANAGE
|
||||
json_register_mutex_callbacks(lock_mutex, unlock_mutex, destroy_mutex, &handler);
|
||||
#else
|
||||
json_register_mutex_callbacks(lock_mutex, unlock_mutex, &handler);
|
||||
#endif
|
||||
json_set_mutex(test, &testMutex);
|
||||
|
||||
json_lock(test, 1);
|
||||
assertEquals(testMutex, 1);
|
||||
json_lock(test, 1);
|
||||
assertEquals(testMutex, 1);
|
||||
json_lock(test, 2);
|
||||
assertEquals(testMutex, 2);
|
||||
json_unlock(test, 1);
|
||||
assertEquals(testMutex, 2); //because this thread locked it twice
|
||||
json_unlock(test, 1);
|
||||
assertEquals(testMutex, 1);
|
||||
json_unlock(test, 2);
|
||||
assertEquals(testMutex, 0);
|
||||
|
||||
json_delete(test);
|
||||
#else
|
||||
//create the JSONNode
|
||||
JSONNode test;
|
||||
#ifdef JSON_MUTEX_MANAGE
|
||||
libjson::register_mutex_callbacks(lock_mutex, unlock_mutex, destroy_mutex, &handler);
|
||||
#else
|
||||
libjson::register_mutex_callbacks(lock_mutex, unlock_mutex, &handler);
|
||||
#endif
|
||||
|
||||
test.set_mutex(&testMutex);
|
||||
|
||||
test.lock(1);
|
||||
assertEquals(testMutex, 1);
|
||||
test.lock(1);
|
||||
assertEquals(testMutex, 1);
|
||||
test.lock(2);
|
||||
assertEquals(testMutex, 2);
|
||||
test.unlock(1);
|
||||
assertEquals(testMutex, 2); //because this thread locked it twice
|
||||
test.unlock(1);
|
||||
assertEquals(testMutex, 1);
|
||||
test.unlock(2);
|
||||
assertEquals(testMutex, 0);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#endif
|
|
@ -1,290 +0,0 @@
|
|||
#include "TestSuite.h"
|
||||
|
||||
#include "../Source/JSONGlobals.h"
|
||||
|
||||
void TestSuite::TestNamespace(void){
|
||||
#ifdef JSON_LIBRARY
|
||||
UnitTest::SetPrefix("TestNamespace.cpp - Memory Manager");
|
||||
#ifdef JSON_MEMORY_MANAGE
|
||||
#define ASSERT_ZERO_ALLOCATIONS()\
|
||||
assertEquals(json_global(STRING_HANDLER).mymap.size(), 0);\
|
||||
assertEquals(json_global(NODE_HANDLER).mymap.size(), 0)
|
||||
ASSERT_ZERO_ALLOCATIONS();
|
||||
JSONNODE * test = json_new(JSON_NODE);
|
||||
json_set_a(test, JSON_TEXT("Hello"));
|
||||
assertCStringSame(json_as_string(test), JSON_TEXT("Hello"));
|
||||
test = json_new_f(JSON_TEXT("Hi"), 14.3f);
|
||||
assertCStringSame(json_name(test), JSON_TEXT("Hi"));
|
||||
assertEquals(json_global(STRING_HANDLER).mymap.size(), 2);
|
||||
assertEquals(json_global(NODE_HANDLER).mymap.size(), 2);
|
||||
json_delete(test);
|
||||
assertEquals(json_global(NODE_HANDLER).mymap.size(), 1);
|
||||
json_delete_all();
|
||||
assertEquals(json_global(NODE_HANDLER).mymap.size(), 0);
|
||||
json_free_all();
|
||||
ASSERT_ZERO_ALLOCATIONS();
|
||||
#else
|
||||
#define ASSERT_ZERO_ALLOCATIONS() (void)0
|
||||
#endif
|
||||
UnitTest::SetPrefix("TestNamespace.cpp - Stripper");
|
||||
{
|
||||
ASSERT_ZERO_ALLOCATIONS();
|
||||
const json_char * json = JSON_TEXT("{\n\t\"hello\" : \"world\"\r\n} ");
|
||||
const json_char * stripped = JSON_TEXT("{\"hello\":\"world\"}");
|
||||
json_char * res = json_strip_white_space(json);
|
||||
assertCStringSame(res, stripped);
|
||||
json_free(res);
|
||||
ASSERT_ZERO_ALLOCATIONS();
|
||||
}
|
||||
|
||||
#ifndef JSON_STRICT
|
||||
{
|
||||
ASSERT_ZERO_ALLOCATIONS();
|
||||
const json_char * json = JSON_TEXT("/*comment*/{#comment\n\n\t\"hello\" ://comment\n \"world\"\r\n} ");
|
||||
const json_char * stripped = JSON_TEXT("{\"hello\":\"world\"}");
|
||||
json_char * res = json_strip_white_space(json);
|
||||
assertCStringSame(res, stripped);
|
||||
json_free(res);
|
||||
ASSERT_ZERO_ALLOCATIONS();
|
||||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
ASSERT_ZERO_ALLOCATIONS();
|
||||
const json_char * json = JSON_TEXT("[\n\t\"hello world\" , \"hello mars\"\r\n] ");
|
||||
const json_char * stripped = JSON_TEXT("[\"hello world\",\"hello mars\"]");
|
||||
json_char * res = json_strip_white_space(json);
|
||||
assertCStringSame(res, stripped);
|
||||
json_free(res);
|
||||
ASSERT_ZERO_ALLOCATIONS();
|
||||
}
|
||||
{
|
||||
ASSERT_ZERO_ALLOCATIONS();
|
||||
const json_char * json = JSON_TEXT(" {\n\t\"hello\" : true\r\n}");
|
||||
const json_char * stripped = JSON_TEXT("{\"hello\":true}");
|
||||
json_char * res = json_strip_white_space(json);
|
||||
assertCStringSame(res, stripped);
|
||||
json_free(res);
|
||||
ASSERT_ZERO_ALLOCATIONS();
|
||||
}
|
||||
{
|
||||
ASSERT_ZERO_ALLOCATIONS();
|
||||
const json_char * json = JSON_TEXT(" [\n\ttrue , false\r\n]");
|
||||
const json_char * stripped = JSON_TEXT("[true,false]");
|
||||
json_char * res = json_strip_white_space(json);
|
||||
assertCStringSame(res, stripped);
|
||||
json_free(res);
|
||||
ASSERT_ZERO_ALLOCATIONS();
|
||||
}
|
||||
{
|
||||
ASSERT_ZERO_ALLOCATIONS();
|
||||
const json_char * json = JSON_TEXT("[true,false]");
|
||||
const json_char * stripped = JSON_TEXT("[true,false]");
|
||||
json_char * res = json_strip_white_space(json);
|
||||
assertCStringSame(res, stripped);
|
||||
json_free(res);
|
||||
ASSERT_ZERO_ALLOCATIONS();
|
||||
}
|
||||
|
||||
#ifdef JSON_SAFE
|
||||
UnitTest::SetPrefix("TestNamespace.cpp - Parser");
|
||||
{
|
||||
ASSERT_ZERO_ALLOCATIONS();
|
||||
const json_char * json = JSON_TEXT("[{\"a\":\"b\",\"c\":{\"d\":\"e\",\"f\":\"g\",\"e\":\"f ");
|
||||
assertNull(json_parse(json));
|
||||
ASSERT_ZERO_ALLOCATIONS();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef JSON_VALIDATE
|
||||
UnitTest::SetPrefix("TestNamespace.cpp - Validator");
|
||||
assertTrue(json_is_valid(JSON_TEXT("[true,false] ")));
|
||||
assertTrue(json_is_valid(JSON_TEXT(" {\"hello\":\"world\"}")))
|
||||
assertTrue(json_is_valid(JSON_TEXT(" {\"hello\":null}")))
|
||||
#ifdef JSON_STRICT
|
||||
assertFalse(json_is_valid(JSON_TEXT(" {\"hello\":}")));
|
||||
assertFalse(json_is_valid(JSON_TEXT(" {\"hello\":, \"hi\" : \"Mars\"}")));
|
||||
#else
|
||||
assertTrue(json_is_valid(JSON_TEXT(" {\"hello\":}")));
|
||||
assertTrue(json_is_valid(JSON_TEXT(" {\"hello\":, \"hi\" : \"Mars\"}")));
|
||||
#endif
|
||||
assertTrue(json_is_valid(JSON_TEXT(" {\"hello\":null, \"hi\" : \"Mars\"}")));
|
||||
assertFalse(json_is_valid(JSON_TEXT("{\"hello\":\"world\"")));
|
||||
assertFalse(json_is_valid(JSON_TEXT("\"hello\":\"world\"")));
|
||||
assertFalse(json_is_valid(JSON_TEXT("true,false]")));
|
||||
assertFalse(json_is_valid(JSON_TEXT("[true,false")));
|
||||
assertFalse(json_is_valid(JSON_TEXT("hello")));
|
||||
assertFalse(json_is_valid(JSON_TEXT("")));
|
||||
#ifdef JSON_SAFE
|
||||
assertFalse(json_is_valid(JSON_TEXT(" {\"hello\":world\"}")));
|
||||
assertFalse(json_is_valid(JSON_TEXT("{\"hello\":\"world\",}")));
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
UnitTest::SetPrefix("TestNamespace.cpp - Stripper");
|
||||
{
|
||||
json_string json = JSON_TEXT("{\n\t\"hello\" : \"world\"\r\n} ");
|
||||
json_string stripped = JSON_TEXT("{\"hello\":\"world\"}");
|
||||
assertEquals(libjson::strip_white_space(json), stripped);
|
||||
}
|
||||
|
||||
#ifndef JSON_STRICT
|
||||
{
|
||||
json_string json = JSON_TEXT("/*comment*/{#comment\n\n\t\"hello\" ://comment\n \"world\"\r\n} ");
|
||||
json_string stripped = JSON_TEXT("{\"hello\":\"world\"}");
|
||||
assertEquals(libjson::strip_white_space(json), stripped);
|
||||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
json_string json = JSON_TEXT("[\n\t\"hello world\" , \"hello mars\"\r\n] ");
|
||||
json_string stripped = JSON_TEXT("[\"hello world\",\"hello mars\"]");
|
||||
assertEquals(libjson::strip_white_space(json), stripped);
|
||||
}
|
||||
{
|
||||
json_string json = JSON_TEXT(" {\n\t\"hello\" : true\r\n}");
|
||||
json_string stripped = JSON_TEXT("{\"hello\":true}");
|
||||
assertEquals(libjson::strip_white_space(json), stripped);
|
||||
}
|
||||
{
|
||||
json_string json = JSON_TEXT(" [\n\ttrue , false\r\n]");
|
||||
json_string stripped = JSON_TEXT("[true,false]");
|
||||
assertEquals(libjson::strip_white_space(json), stripped);
|
||||
}
|
||||
{
|
||||
json_string json = JSON_TEXT("[true,false]");
|
||||
json_string stripped = JSON_TEXT("[true,false]");
|
||||
assertEquals(libjson::strip_white_space(json), stripped);
|
||||
}
|
||||
|
||||
#ifdef JSON_VALIDATE
|
||||
UnitTest::SetPrefix("TestNamespace.cpp - Validator");
|
||||
assertTrue(libjson::is_valid(JSON_TEXT("[true,false] ")));
|
||||
assertTrue(libjson::is_valid(JSON_TEXT(" {\"hello\":\"world\"}")));
|
||||
|
||||
assertTrue(libjson::is_valid(JSON_TEXT(" {\"hello\":null}")));
|
||||
#ifdef JSON_STRICT
|
||||
assertFalse(libjson::is_valid(JSON_TEXT(" {\"hello\":}")));
|
||||
assertFalse(libjson::is_valid(JSON_TEXT(" {\"hello\":, \"hi\" : \"Mars\"}")));
|
||||
#else
|
||||
assertTrue(libjson::is_valid(JSON_TEXT(" {\"hello\":}")));
|
||||
assertTrue(libjson::is_valid(JSON_TEXT(" {\"hello\":, \"hi\" : \"Mars\"}")));
|
||||
#endif
|
||||
assertTrue(libjson::is_valid(JSON_TEXT(" {\"hello\":null, \"hi\" : \"Mars\"}")));
|
||||
|
||||
assertFalse(libjson::is_valid(JSON_TEXT("{\"hello\":\"world\"")));
|
||||
assertFalse(libjson::is_valid(JSON_TEXT("\"hello\":\"world\"")));
|
||||
assertFalse(libjson::is_valid(JSON_TEXT("true,false]")));
|
||||
assertFalse(libjson::is_valid(JSON_TEXT("[true,false")));
|
||||
assertFalse(libjson::is_valid(JSON_TEXT("hello")));
|
||||
assertFalse(libjson::is_valid(JSON_TEXT("")));
|
||||
assertFalse(libjson::is_valid(JSON_TEXT(" {\"hello\":world\"}")));
|
||||
|
||||
assertFalse(libjson::is_valid(JSON_TEXT("[\"hello\"\"world\"]")));
|
||||
assertFalse(libjson::is_valid(JSON_TEXT("{\"hello\"\"world\", \"hi\":\"mars\"}")));
|
||||
assertFalse(libjson::is_valid(JSON_TEXT("[\"hello\":\"world\"]")));
|
||||
#endif
|
||||
|
||||
JSONNode tester;
|
||||
|
||||
#ifdef JSON_READ_PRIORITY
|
||||
UnitTest::SetPrefix("TestNamespace.cpp - Parse");
|
||||
tester = libjson::parse(JSON_TEXT("\r\n{\"hello\":\"world\"}"));
|
||||
assertEquals(tester.type(), JSON_NODE);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
#if !defined(JSON_PREPARSE) && defined(JSON_READ_PRIORITY)
|
||||
assertFalse(tester.internal -> fetched);
|
||||
tester.preparse();
|
||||
assertTrue(tester.internal -> fetched);
|
||||
assertTrue(tester[0].internal -> fetched);
|
||||
#endif
|
||||
#endif
|
||||
assertEquals(tester.size(), 1);
|
||||
assertEquals(tester[0].name(), JSON_TEXT("hello"));
|
||||
assertEquals(tester[0], JSON_TEXT("world"));
|
||||
#ifdef JSON_UNIT_TEST
|
||||
#if !defined(JSON_PREPARSE) && defined(JSON_READ_PRIORITY)
|
||||
assertTrue(tester.internal -> fetched);
|
||||
#endif
|
||||
#endif
|
||||
#ifdef JSON_SAFE
|
||||
assertException(libjson::parse(JSON_TEXT("{\"hello\":\"world\"")), std::invalid_argument);
|
||||
#endif
|
||||
assertException(libjson::parse(JSON_TEXT("\"hello\":\"world\"")), std::invalid_argument);
|
||||
tester = libjson::parse(JSON_TEXT(" [true, false]\r\n"));
|
||||
assertEquals(tester.type(), JSON_ARRAY);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
#if !defined(JSON_PREPARSE) && defined(JSON_READ_PRIORITY)
|
||||
assertFalse(tester.internal -> fetched);
|
||||
#endif
|
||||
#endif
|
||||
assertEquals(tester.size(), 2);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
#if !defined(JSON_PREPARSE) && defined(JSON_READ_PRIORITY)
|
||||
assertTrue(tester.internal -> fetched);
|
||||
#endif
|
||||
#endif
|
||||
assertException(libjson::parse(JSON_TEXT("true,false]")), std::invalid_argument);
|
||||
#ifdef JSON_SAFE
|
||||
assertException(libjson::parse(JSON_TEXT("[true,false")), std::invalid_argument);
|
||||
#endif
|
||||
assertException(libjson::parse(JSON_TEXT("hello")), std::invalid_argument);
|
||||
assertException(libjson::parse(JSON_TEXT("")), std::invalid_argument);
|
||||
TestSuite::testParsingItself(tester);
|
||||
|
||||
tester = libjson::parse(JSON_TEXT(" [\"hello\", \"world\", \"mars\"]\r\n"));
|
||||
assertEquals(tester.type(), JSON_ARRAY);
|
||||
assertEquals(tester.size(), 3);
|
||||
assertEquals(tester[0], JSON_TEXT("hello"));
|
||||
assertEquals(tester[1], JSON_TEXT("world"));
|
||||
assertEquals(tester[2], JSON_TEXT("mars"));
|
||||
TestSuite::testParsingItself(tester);
|
||||
|
||||
tester = libjson::parse(JSON_TEXT("{\"\":{},\"\":2}"));
|
||||
assertEquals(tester.type(), JSON_NODE);
|
||||
assertEquals(tester.size(), 2);
|
||||
assertEquals(tester[0].type(), JSON_NODE);
|
||||
assertTrue(tester[0].empty());
|
||||
assertEquals(tester[1].type(), JSON_NUMBER);
|
||||
assertEquals(tester[1], 2);
|
||||
assertEquals(tester, libjson::parse(JSON_TEXT("{\"\":{},\"\":2}")));
|
||||
TestSuite::testParsingItself(tester);
|
||||
|
||||
tester = libjson::parse(JSON_TEXT("\r\n{\"hello\":\"world\", \"hi\":\"mars\"}"));
|
||||
assertEquals(tester.type(), JSON_NODE);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
#if !defined(JSON_PREPARSE) && defined(JSON_READ_PRIORITY)
|
||||
assertFalse(tester.internal -> fetched);
|
||||
#endif
|
||||
#endif
|
||||
assertEquals(tester.size(), 2);
|
||||
assertEquals(tester[0].name(), JSON_TEXT("hello"));
|
||||
assertEquals(tester[0], JSON_TEXT("world"));
|
||||
assertEquals(tester[1].name(), JSON_TEXT("hi"));
|
||||
assertEquals(tester[1], JSON_TEXT("mars"));
|
||||
TestSuite::testParsingItself(tester);
|
||||
|
||||
tester = libjson::parse(JSON_TEXT("\r\n{\"hello\":\"world\", \"hi\":\"mars\", \"and\":\"pluto\"}"));
|
||||
assertEquals(tester.type(), JSON_NODE);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
#if !defined(JSON_PREPARSE) && defined(JSON_READ_PRIORITY)
|
||||
assertFalse(tester.internal -> fetched);
|
||||
#endif
|
||||
#endif
|
||||
assertEquals(tester.size(), 3);
|
||||
assertEquals(tester[0].name(), JSON_TEXT("hello"));
|
||||
assertEquals(tester[0], JSON_TEXT("world"));
|
||||
assertEquals(tester[1].name(), JSON_TEXT("hi"));
|
||||
assertEquals(tester[1], JSON_TEXT("mars"));
|
||||
assertEquals(tester[2].name(), JSON_TEXT("and"));
|
||||
assertEquals(tester[2], JSON_TEXT("pluto"));
|
||||
TestSuite::testParsingItself(tester);
|
||||
|
||||
#ifdef JSON_SAFE
|
||||
assertException(libjson::parse(JSON_TEXT("[{\"a\":\"b\",\"c\":{\"d\":\"e\",\"f\":\"g\",\"e\":\"f ")), std::invalid_argument);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
}
|
|
@ -1,131 +0,0 @@
|
|||
#include "TestSuite.h"
|
||||
|
||||
void TestSuite::TestReferenceCounting(void){
|
||||
UnitTest::SetPrefix("TestRefCounting.cpp - Reference Counting");
|
||||
#ifdef JSON_LIBRARY
|
||||
#else
|
||||
JSONNode test1;
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertNotNull(test1.internal);
|
||||
#ifdef JSON_REF_COUNT
|
||||
assertEquals(test1.internal -> refcount, 1);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//copy ctor, should simply increment the reference counter
|
||||
JSONNode test2 = JSONNode(test1);
|
||||
#ifdef JSON_REF_COUNT
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertEquals(test1.internal, test2.internal);
|
||||
#endif
|
||||
assertEquals(test1, test2);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertEquals(test1.internal -> refcount, 2);
|
||||
#endif
|
||||
#else
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertNotEquals(test1.internal, test2.internal);
|
||||
#endif
|
||||
assertEquals(test1, test2);
|
||||
#endif
|
||||
|
||||
//assignment operator, should simply increment the reference counter
|
||||
JSONNode test3 = test2;
|
||||
#ifdef JSON_UNIT_TEST
|
||||
#ifdef JSON_REF_COUNT
|
||||
assertEquals(test1.internal, test3.internal);
|
||||
assertEquals(test2.internal, test3.internal);
|
||||
assertEquals(test1.internal -> refcount, 3);
|
||||
#else
|
||||
assertNotEquals(test1.internal, test3.internal);
|
||||
assertNotEquals(test2.internal, test3.internal);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//assigning something, it should copy now
|
||||
test2 = "hello";
|
||||
#ifdef JSON_UNIT_TEST
|
||||
#ifdef JSON_REF_COUNT
|
||||
assertEquals(test1.internal, test3.internal);
|
||||
assertNotEquals(test2.internal, test3.internal);
|
||||
assertEquals(test1.internal -> refcount, 2);
|
||||
assertEquals(test2.internal -> refcount, 1);
|
||||
#else
|
||||
assertNotEquals(test1.internal, test3.internal);
|
||||
assertNotEquals(test2.internal, test3.internal);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//assigning something, it should copy now
|
||||
test1 = 15;
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertNotEquals(test1.internal, test3.internal);
|
||||
#ifdef JSON_REF_COUNT
|
||||
assertEquals(test1.internal -> refcount, 1);
|
||||
assertEquals(test3.internal -> refcount, 1);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
test1 = test2;
|
||||
#ifdef JSON_REF_COUNT
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertEquals(test1.internal, test2.internal);
|
||||
assertEquals(test1.internal -> refcount, 2);
|
||||
#endif
|
||||
#else
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertNotEquals(test1.internal, test2.internal);
|
||||
#endif
|
||||
assertEquals(test1, test2);
|
||||
#endif
|
||||
|
||||
test1.set_name(JSON_TEXT("hello world"));
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertNotEquals(test1.internal, test2.internal);
|
||||
#ifdef JSON_REF_COUNT
|
||||
assertEquals(test1.internal -> refcount, 1);
|
||||
assertEquals(test1.internal -> refcount, 1);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//test tree copying and partial tree copying
|
||||
UnitTest::SetPrefix("TestRefCounting.cpp - Partial Copy");
|
||||
test1 = JSONNode(JSON_NODE);
|
||||
test1.push_back(JSONNode(JSON_NODE));
|
||||
test1.push_back(JSONNode(JSON_TEXT(""), 5));
|
||||
assertEquals(test1.size(), 2);
|
||||
test2 = test1;
|
||||
#ifdef JSON_UNIT_TEST
|
||||
#ifdef JSON_REF_COUNT
|
||||
assertEquals(test1.internal -> refcount, 2);
|
||||
assertEquals(test1.internal, test2.internal);
|
||||
#else
|
||||
assertNotEquals(test1.internal, test2.internal);
|
||||
#endif
|
||||
#endif
|
||||
#ifdef JSON_READ_PRIORITY
|
||||
assertEquals(test1, libjson::parse(JSON_TEXT("{\"\":{},\"\":5}")));
|
||||
assertEquals(test1, test1);
|
||||
assertEquals(libjson::parse(JSON_TEXT("{\"\":{},\"\":5}")), libjson::parse(JSON_TEXT("{\"\":{},\"\":5}")));
|
||||
TestSuite::testParsingItself(test1);
|
||||
#endif
|
||||
|
||||
test2[1] = 15;
|
||||
assertEquals(test1[1], 5);
|
||||
assertEquals(test2[1], 15);
|
||||
test1 = test2;
|
||||
#ifdef JSON_UNIT_TEST
|
||||
#ifdef JSON_REF_COUNT
|
||||
assertEquals(test1.internal, test2.internal);
|
||||
#else
|
||||
assertNotEquals(test1.internal, test2.internal);
|
||||
#endif
|
||||
#endif
|
||||
test1[0].push_back(JSONNode(JSON_TEXT(""), 1));
|
||||
test1[0].push_back(JSONNode(JSON_TEXT(""), 2));
|
||||
assertEquals(test1[0].size(), 2);
|
||||
assertEquals(test2[0].size(), 0);
|
||||
TestSuite::testParsingItself(test1);
|
||||
TestSuite::testParsingItself(test2);
|
||||
#endif
|
||||
}
|
|
@ -1,125 +0,0 @@
|
|||
|
||||
#include "TestSuite.h"
|
||||
#include "../Source/JSONSharedString.h"
|
||||
|
||||
void TestSuite::TestSharedString(void){
|
||||
UnitTest::SetPrefix("TestSharedString.cpp - Seeing how much regular strings share");
|
||||
json_string sharey = JSON_TEXT("Hello world");
|
||||
json_string sharey2 = sharey;
|
||||
if (sharey2.data() == sharey.data()) echo("Assignment shares data");
|
||||
sharey2 = json_string(sharey);
|
||||
if (sharey2.data() == sharey.data()) echo("Copy ctor shares data");
|
||||
sharey2 = json_string(sharey.begin(), sharey.end());
|
||||
if (sharey2.data() == sharey.data()) echo("Copy with iterators shares data");
|
||||
sharey2 = sharey.substr(0);
|
||||
if (sharey2.data() == sharey.data()) echo("substr shares data");
|
||||
|
||||
json_string value = JSON_TEXT("Hello, I am a string with lots of words");
|
||||
json_shared_string shared = json_shared_string(value);
|
||||
|
||||
UnitTest::SetPrefix("TestSharedString.cpp - Whole String");
|
||||
//make it out of a string, make sure they are equal
|
||||
assertEquals(value.length(), shared.length());
|
||||
assertEquals(value, json_string(shared.std_begin(), shared.std_end()));
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertEquals(1, shared._str -> refCount);
|
||||
#endif
|
||||
|
||||
UnitTest::SetPrefix("TestSharedString.cpp - Substring");
|
||||
//take a substring out of it, make sure its using the same reference
|
||||
json_shared_string hello = json_shared_string(shared, 0, 5);
|
||||
json_string shello = value.substr(0, 5);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertEquals(shared._str, hello._str);
|
||||
assertEquals(2, shared._str -> refCount);
|
||||
#endif
|
||||
assertEquals(shello, json_string(hello.std_begin(), hello.std_end()));
|
||||
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertEquals(shared._str, hello._str);
|
||||
assertEquals(2, shared._str -> refCount);
|
||||
#endif
|
||||
|
||||
UnitTest::SetPrefix("TestSharedString.cpp - Substring to String");
|
||||
//make sure converting it to a string actually does the convert
|
||||
assertEquals(json_string(JSON_TEXT("Hello")), hello.toString());
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertNotEquals(shared._str, hello._str);
|
||||
assertEquals(1, shared._str -> refCount);
|
||||
assertEquals(1, hello._str -> refCount);
|
||||
#endif
|
||||
|
||||
UnitTest::SetPrefix("TestSharedString.cpp - Substring of substring offset zero");
|
||||
json_shared_string rest = json_shared_string(shared, 7);
|
||||
json_string srest = value.substr(7);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertEquals(shared._str, rest._str);
|
||||
assertEquals(7,rest.offset);
|
||||
assertEquals(2, shared._str -> refCount);
|
||||
#endif
|
||||
assertEquals(srest, json_string(rest.std_begin(), rest.std_end()));
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertEquals(shared._str, rest._str);
|
||||
assertEquals(2, shared._str -> refCount);
|
||||
#endif
|
||||
|
||||
json_shared_string I_am_a_string = json_shared_string(rest, 0, 13);
|
||||
json_string sI_am_a_string = srest.substr(0, 13);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertEquals(shared._str, I_am_a_string._str);
|
||||
assertEquals(7,rest.offset);
|
||||
assertEquals(3, shared._str -> refCount);
|
||||
#endif
|
||||
assertEquals(sI_am_a_string, json_string(I_am_a_string.std_begin(), I_am_a_string.std_end()));
|
||||
assertEquals(srest, json_string(rest.std_begin(), rest.std_end()));
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertEquals(shared._str, I_am_a_string._str);
|
||||
assertEquals(3, shared._str -> refCount);
|
||||
#endif
|
||||
|
||||
|
||||
UnitTest::SetPrefix("TestSharedString.cpp - Finding Ref 1");
|
||||
assertEquals(0, hello.find(JSON_TEXT('H')));
|
||||
assertEquals(shello.find(JSON_TEXT('H')), hello.find(JSON_TEXT('H')));
|
||||
assertEquals(4, hello.find(JSON_TEXT('o')));
|
||||
assertEquals(shello.find(JSON_TEXT('o')), hello.find(JSON_TEXT('o')));
|
||||
assertEquals(json_string::npos, hello.find(JSON_TEXT('z')));
|
||||
assertEquals(shello.find(JSON_TEXT('z')), hello.find(JSON_TEXT('z')));
|
||||
|
||||
UnitTest::SetPrefix("TestSharedString.cpp - Finding Shared");
|
||||
assertEquals(0, I_am_a_string.find(JSON_TEXT('I')));
|
||||
assertEquals(sI_am_a_string.find(JSON_TEXT('I')), I_am_a_string.find(JSON_TEXT('I')));
|
||||
assertEquals(7, I_am_a_string.find(JSON_TEXT('s')));
|
||||
assertEquals(sI_am_a_string.find(JSON_TEXT('s')), I_am_a_string.find(JSON_TEXT('s')));
|
||||
assertEquals(json_string::npos, I_am_a_string.find(JSON_TEXT('z')));
|
||||
assertEquals(sI_am_a_string.find(JSON_TEXT('z')), I_am_a_string.find(JSON_TEXT('z')));
|
||||
//still sharing memory with the parent string, which contains a w
|
||||
assertEquals(json_string::npos, I_am_a_string.find(JSON_TEXT('w')));
|
||||
assertEquals(sI_am_a_string.find(JSON_TEXT('w')), I_am_a_string.find(JSON_TEXT('w')));
|
||||
|
||||
UnitTest::SetPrefix("TestSharedString.cpp - Iterator substrings");
|
||||
json_string blah = JSON_TEXT("hello world");
|
||||
json_shared_string blahs(blah);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertEquals(blahs._str -> refCount, 1);
|
||||
#endif
|
||||
json_string sub = json_string(blah.begin(), blah.end());
|
||||
json_shared_string subs = json_shared_string(blahs.begin(), blahs.end());
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertEquals(blahs._str, subs._str);
|
||||
assertEquals(blahs._str -> refCount, 2);
|
||||
#endif
|
||||
assertEquals(blah, blahs.toString());
|
||||
assertEquals(sub, subs.toString());
|
||||
assertEquals(sub.length(), subs.length());
|
||||
sub = json_string(blah.begin(), blah.begin() + 5);
|
||||
subs = json_shared_string(blahs.begin(), blahs.begin() + 5);
|
||||
#ifdef JSON_UNIT_TEST
|
||||
assertEquals(blahs._str, subs._str);
|
||||
assertEquals(blahs._str -> refCount, 2);
|
||||
#endif
|
||||
assertEquals(blah, blahs.toString());
|
||||
assertEquals(sub, subs.toString());
|
||||
assertEquals(sub.length(), subs.length());
|
||||
}
|
||||
|
|
@ -1,171 +0,0 @@
|
|||
#include "TestSuite.h"
|
||||
|
||||
#ifdef JSON_STREAM
|
||||
unsigned int counter = 0;
|
||||
unsigned int errorCounter = 0;
|
||||
|
||||
void errorCallback(void *);
|
||||
void errorCallback(void *){
|
||||
++errorCounter;
|
||||
}
|
||||
|
||||
#ifdef JSON_LIBRARY
|
||||
void Callback(JSONNODE * test, void *);
|
||||
void Callback(JSONNODE * test, void *){
|
||||
++counter;
|
||||
switch(counter){
|
||||
case 1:
|
||||
assertEquals(json_type(test), JSON_NODE);
|
||||
assertTrue(json_empty(test));
|
||||
break;
|
||||
case 2:
|
||||
assertEquals(json_type(test), JSON_ARRAY);
|
||||
assertTrue(json_empty(test));
|
||||
break;
|
||||
case 3:{
|
||||
assertEquals(json_type(test), JSON_NODE);
|
||||
assertEquals(json_size(test), 1);
|
||||
json_char * temp = json_name(json_at(test, 0));
|
||||
assertCStringSame(temp, JSON_TEXT("hello"));
|
||||
json_free(temp);
|
||||
assertEquals(json_as_int(json_at(test, 0)), 1);
|
||||
break;}
|
||||
case 4:
|
||||
assertEquals(json_type(test), JSON_ARRAY);
|
||||
assertEquals(json_size(test), 3);
|
||||
break;
|
||||
case 5:{
|
||||
assertEquals(json_type(test), JSON_NODE);
|
||||
assertEquals(json_size(test), 1);
|
||||
json_char * temp = json_name(json_at(test, 0));
|
||||
assertCStringSame(temp, JSON_TEXT("hi"));
|
||||
json_free(temp);
|
||||
assertEquals(json_size(json_at(test, 0)), 1);
|
||||
assertEquals(json_type(json_at(json_at(test, 0),0)), JSON_NUMBER);
|
||||
temp = json_name(json_at(json_at(test, 0),0));
|
||||
assertCStringSame(temp, JSON_TEXT("one"));
|
||||
json_free(temp);
|
||||
assertEquals(json_as_int(json_at(json_at(test, 0),0)), 1);
|
||||
break;}
|
||||
}
|
||||
}
|
||||
#else
|
||||
void Callback(JSONNode & test, void * ide);
|
||||
void Callback(JSONNode & test, void * ide){
|
||||
assertEquals(ide, (void*)0xDEADBEEF);
|
||||
++counter;
|
||||
switch(counter){
|
||||
case 1:
|
||||
assertEquals(test.type(), JSON_NODE);
|
||||
assertTrue(test.empty());
|
||||
break;
|
||||
case 2:
|
||||
assertEquals(test.type(), JSON_ARRAY);
|
||||
assertTrue(test.empty());
|
||||
break;
|
||||
case 3:
|
||||
assertEquals(test.type(), JSON_NODE);
|
||||
assertEquals(test.size(), 1);
|
||||
assertEquals(test[0].name(), JSON_TEXT("hello"));
|
||||
assertEquals(test[0].as_int(), 1);
|
||||
break;
|
||||
case 4:
|
||||
assertEquals(test.type(), JSON_ARRAY);
|
||||
assertEquals(test.size(), 3);
|
||||
break;
|
||||
case 5:
|
||||
assertEquals(test.type(), JSON_NODE);
|
||||
assertEquals(test.size(), 1);
|
||||
assertEquals(test[0].name(), JSON_TEXT("hi"));
|
||||
assertEquals(test[0].size(), 1)
|
||||
assertEquals(test[0][0].type(), JSON_NUMBER);
|
||||
assertEquals(test[0][0].name(), JSON_TEXT("one"));
|
||||
assertEquals(test[0][0].as_int(), 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif //library
|
||||
#endif //stream
|
||||
|
||||
|
||||
void TestSuite::TestStreams(void){
|
||||
#ifdef JSON_STREAM
|
||||
UnitTest::SetPrefix("TestStreams.cpp - Streams");
|
||||
counter = 0;
|
||||
errorCounter = 0;
|
||||
|
||||
#ifdef JSON_LIBRARY
|
||||
JSONSTREAM * test = json_new_stream(Callback, errorCallback, (void*)0xDEADBEEF);
|
||||
json_stream_push(test, JSON_TEXT("{}[]"));
|
||||
assertEquals(2, counter);
|
||||
assertEquals(0, errorCounter);
|
||||
json_stream_push(test, JSON_TEXT("{\"hel"));
|
||||
assertEquals(2, counter);
|
||||
assertEquals(0, errorCounter);
|
||||
json_stream_push(test, JSON_TEXT("lo\" : 1"));
|
||||
assertEquals(2, counter);
|
||||
assertEquals(0, errorCounter);
|
||||
json_stream_push(test, JSON_TEXT("}["));
|
||||
assertEquals(3, counter);
|
||||
assertEquals(0, errorCounter);
|
||||
json_stream_push(test, JSON_TEXT("1,2,3]{\"hi\" : { \"one\" : 1}"));
|
||||
assertEquals(4, counter);
|
||||
assertEquals(0, errorCounter);
|
||||
json_stream_push(test, JSON_TEXT("}"));
|
||||
assertEquals(5, counter);
|
||||
assertEquals(0, errorCounter);
|
||||
|
||||
#ifdef JSON_SAFE
|
||||
json_stream_push(test, JSON_TEXT("{\"hello\":12keaueuataueaouhe"));
|
||||
assertEquals(1, errorCounter);
|
||||
#endif
|
||||
json_delete_stream(test);
|
||||
#else
|
||||
JSONStream test(Callback, errorCallback, (void*)0xDEADBEEF);
|
||||
test << JSON_TEXT("{}[]");
|
||||
assertEquals(2, counter);
|
||||
assertEquals(0, errorCounter);
|
||||
test << JSON_TEXT("{\"hel");
|
||||
assertEquals(2, counter);
|
||||
assertEquals(0, errorCounter);
|
||||
test << JSON_TEXT("lo\" : 1");
|
||||
assertEquals(2, counter);
|
||||
assertEquals(0, errorCounter);
|
||||
test << JSON_TEXT("}[");
|
||||
assertEquals(3, counter);
|
||||
assertEquals(0, errorCounter);
|
||||
test << JSON_TEXT("1,2,3]{\"hi\" : { \"one\" : 1}");
|
||||
assertEquals(4, counter);
|
||||
assertEquals(0, errorCounter);
|
||||
test << JSON_TEXT("}");
|
||||
assertEquals(5, counter);
|
||||
assertEquals(0, errorCounter);
|
||||
|
||||
#ifdef JSON_SAFE
|
||||
test << JSON_TEXT("{\"hello\":12keaueuataueaouhe");
|
||||
assertEquals(1, errorCounter);
|
||||
#endif
|
||||
|
||||
#ifdef JSON_SECURITY_MAX_STREAM_OBJECTS
|
||||
test.reset();
|
||||
unsigned int currentCount = errorCounter;
|
||||
json_string safe;
|
||||
for(int i = 0; i < JSON_SECURITY_MAX_STREAM_OBJECTS; ++i){
|
||||
safe += JSON_TEXT("{}");
|
||||
}
|
||||
test << safe;
|
||||
assertEquals(133, counter);
|
||||
assertEquals(currentCount, errorCounter);
|
||||
|
||||
test.reset();
|
||||
json_string unsafe;
|
||||
for(int i = 0; i <= JSON_SECURITY_MAX_STREAM_OBJECTS + 1; ++i){
|
||||
unsafe += JSON_TEXT("{}");
|
||||
}
|
||||
test << unsafe;
|
||||
assertEquals(261, counter);
|
||||
assertEquals(currentCount + 1, errorCounter);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
}
|
|
@ -1,197 +0,0 @@
|
|||
#include "TestSuite.h"
|
||||
|
||||
#ifdef JSON_STRING_HEADER
|
||||
#ifdef JSON_UNICODE
|
||||
#include "UStringTest.h"
|
||||
#else
|
||||
#include "StringTest.h"
|
||||
#endif
|
||||
#else
|
||||
//otherwise it will use the regular STL strings and act as a control
|
||||
#include "../../libjson.h"
|
||||
#endif
|
||||
|
||||
static void assertConstEmpty(const json_string & s){
|
||||
assertEquals(s.length(), 0);
|
||||
assertTrue(s.empty());
|
||||
assertCStringSame(s.c_str(), JSON_TEXT(""));
|
||||
assertEquals(s, s);
|
||||
assertEquals(s, JSON_TEXT(""));
|
||||
}
|
||||
|
||||
static void assertEmpty(json_string & s){
|
||||
assertEquals(s.length(), 0);
|
||||
assertTrue(s.empty());
|
||||
assertCStringSame(s.c_str(), JSON_TEXT(""));
|
||||
assertEquals(s, s);
|
||||
assertEquals(s, JSON_TEXT(""));
|
||||
assertConstEmpty(s);
|
||||
}
|
||||
|
||||
static void assertSame(json_string & s, json_string & m){
|
||||
assertEquals(s, m);
|
||||
assertCStringSame(s.c_str(), m.c_str());
|
||||
assertEquals(s.length(), m.length());
|
||||
s.swap(m);
|
||||
assertEquals(s, m);
|
||||
assertCStringSame(s.c_str(), m.c_str());
|
||||
assertEquals(s.length(), m.length());
|
||||
}
|
||||
|
||||
static void assertDifferent(json_string & s, json_string & m){
|
||||
assertNotEquals(s, m);
|
||||
assertCStringNotSame(s.c_str(), m.c_str());
|
||||
}
|
||||
|
||||
void TestSuite::TestString(void){
|
||||
UnitTest::SetPrefix("TestString.cpp - Test String Class");
|
||||
{
|
||||
json_string s;
|
||||
assertEmpty(s);
|
||||
}
|
||||
|
||||
{
|
||||
json_string s;
|
||||
assertEmpty(s);
|
||||
json_string m(s);
|
||||
assertEmpty(m);
|
||||
assertEmpty(s);
|
||||
assertSame(s, m);
|
||||
}
|
||||
|
||||
{
|
||||
json_string s(JSON_TEXT("hello"));
|
||||
assertEquals(s.length(), 5);
|
||||
assertFalse(s.empty());
|
||||
assertCStringSame(s.c_str(), JSON_TEXT("hello"));
|
||||
assertEquals(s, s);
|
||||
assertEquals(s, JSON_TEXT("hello"));
|
||||
s.clear();
|
||||
assertEmpty(s);
|
||||
}
|
||||
|
||||
{
|
||||
json_string s(5, 'h');
|
||||
assertEquals(s.length(), 5);
|
||||
assertFalse(s.empty());
|
||||
assertCStringSame(s.c_str(), JSON_TEXT("hhhhh"));
|
||||
assertEquals(s, s);
|
||||
assertEquals(s, JSON_TEXT("hhhhh"));
|
||||
s.clear();
|
||||
assertEmpty(s);
|
||||
}
|
||||
|
||||
{
|
||||
json_string s(5, 'h');
|
||||
json_string m(s);
|
||||
assertSame(s, m);
|
||||
}
|
||||
|
||||
{
|
||||
json_string s(5, 'h');
|
||||
json_string m(s);
|
||||
assertSame(s, m);
|
||||
s.clear();
|
||||
assertEmpty(s);
|
||||
assertEquals(s.length(), 0);
|
||||
assertDifferent(s, m);
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
json_string s(JSON_TEXT("hello"));
|
||||
json_string m = s;
|
||||
assertSame(s, m);
|
||||
m = s.substr(1, 3);
|
||||
assertEquals(m.length(), 3);
|
||||
assertEquals(m, JSON_TEXT("ell"));
|
||||
}
|
||||
|
||||
{
|
||||
json_string s(JSON_TEXT("hello"));
|
||||
json_string m = s;
|
||||
assertSame(s, m);
|
||||
m = s.substr(1);
|
||||
assertEquals(m.length(), 4);
|
||||
assertEquals(m, JSON_TEXT("ello"));
|
||||
}
|
||||
|
||||
{
|
||||
json_string s(JSON_TEXT("hello"));
|
||||
s += JSON_TEXT(" world");
|
||||
assertEquals(s.length(), 11);
|
||||
assertEquals(s, JSON_TEXT("hello world"));
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
json_string s(JSON_TEXT("hello"));
|
||||
json_string m = s + JSON_TEXT(" world ") + s;
|
||||
assertEquals(m.length(), 17);
|
||||
assertEquals(m, JSON_TEXT("hello world hello"));
|
||||
}
|
||||
|
||||
{
|
||||
json_string s(JSON_TEXT("hello"));
|
||||
s += 'a';
|
||||
s += 'a';
|
||||
s += 'a';
|
||||
s += 'a';
|
||||
assertEquals(s.length(), 9);
|
||||
assertEquals(s, JSON_TEXT("helloaaaa"));
|
||||
}
|
||||
|
||||
{
|
||||
json_string s(JSON_TEXT("hello world"));
|
||||
size_t pos = s.find('w');
|
||||
assertEquals(pos, 6);
|
||||
}
|
||||
|
||||
{
|
||||
json_string s(JSON_TEXT("hello world"));
|
||||
size_t pos = s.find('z');
|
||||
assertEquals(pos, json_string::npos);
|
||||
}
|
||||
|
||||
{
|
||||
json_string s(JSON_TEXT("hello world"));
|
||||
size_t pos = s.find_first_not_of(JSON_TEXT("helo"));
|
||||
assertEquals(pos, 5);
|
||||
}
|
||||
|
||||
{
|
||||
json_string s(JSON_TEXT("hello world"));
|
||||
size_t pos = s.find_first_of(JSON_TEXT("ol"));
|
||||
assertEquals(pos, 2);
|
||||
}
|
||||
|
||||
{
|
||||
json_string s(JSON_TEXT("hello world"));
|
||||
s.erase(s.begin(), s.begin() + 3);
|
||||
assertEquals(s, JSON_TEXT("lo world"));
|
||||
}
|
||||
|
||||
{
|
||||
json_string s(JSON_TEXT("hello world"), 5);
|
||||
assertEquals(s, JSON_TEXT("hello"));
|
||||
}
|
||||
|
||||
#ifndef JSON_LIBRARY
|
||||
#ifndef JSON_STRING_HEADER
|
||||
{
|
||||
json_string s(JSON_TEXT("hello world"));
|
||||
std::wstring wtest(L"hello world");
|
||||
std::string stest("hello world");
|
||||
assertEquals(libjson::to_std_string(s), stest);
|
||||
assertEquals(stest, libjson::to_std_string(s));
|
||||
assertEquals(libjson::to_std_wstring(s), wtest);
|
||||
assertEquals(wtest, libjson::to_std_wstring(s));
|
||||
|
||||
assertEquals(s, libjson::to_json_string(stest));
|
||||
assertEquals(libjson::to_json_string(stest), s);
|
||||
assertEquals(s, libjson::to_json_string(wtest));
|
||||
assertEquals(libjson::to_json_string(wtest), s);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples.
|
||||
.\"See Also:
|
||||
.\"man mdoc.samples for a complete listing of options
|
||||
.\"man mdoc for the short list of editing options
|
||||
.\"/usr/share/misc/mdoc.template
|
||||
.Dd 9/3/10 \" DATE
|
||||
.Dt TestSuite 1 \" Program name and manual section number
|
||||
.Os Darwin
|
||||
.Sh NAME \" Section Header - required - don't modify
|
||||
.Nm TestSuite,
|
||||
.\" The following lines are read in generating the apropos(man -k) database. Use only key
|
||||
.\" words here as the database is built based on the words here and in the .ND line.
|
||||
.Nm Other_name_for_same_program(),
|
||||
.Nm Yet another name for the same program.
|
||||
.\" Use .Nm macro to designate other names for the documented program.
|
||||
.Nd This line parsed for whatis database.
|
||||
.Sh SYNOPSIS \" Section Header - required - don't modify
|
||||
.Nm
|
||||
.Op Fl abcd \" [-abcd]
|
||||
.Op Fl a Ar path \" [-a path]
|
||||
.Op Ar file \" [file]
|
||||
.Op Ar \" [file ...]
|
||||
.Ar arg0 \" Underlined argument - use .Ar anywhere to underline
|
||||
arg2 ... \" Arguments
|
||||
.Sh DESCRIPTION \" Section Header - required - don't modify
|
||||
Use the .Nm macro to refer to your program throughout the man page like such:
|
||||
.Nm
|
||||
Underlining is accomplished with the .Ar macro like this:
|
||||
.Ar underlined text .
|
||||
.Pp \" Inserts a space
|
||||
A list of items with descriptions:
|
||||
.Bl -tag -width -indent \" Begins a tagged list
|
||||
.It item a \" Each item preceded by .It macro
|
||||
Description of item a
|
||||
.It item b
|
||||
Description of item b
|
||||
.El \" Ends the list
|
||||
.Pp
|
||||
A list of flags and their descriptions:
|
||||
.Bl -tag -width -indent \" Differs from above in tag removed
|
||||
.It Fl a \"-a flag as a list item
|
||||
Description of -a flag
|
||||
.It Fl b
|
||||
Description of -b flag
|
||||
.El \" Ends the list
|
||||
.Pp
|
||||
.\" .Sh ENVIRONMENT \" May not be needed
|
||||
.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1
|
||||
.\" .It Ev ENV_VAR_1
|
||||
.\" Description of ENV_VAR_1
|
||||
.\" .It Ev ENV_VAR_2
|
||||
.\" Description of ENV_VAR_2
|
||||
.\" .El
|
||||
.Sh FILES \" File used or created by the topic of the man page
|
||||
.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact
|
||||
.It Pa /usr/share/file_name
|
||||
FILE_1 description
|
||||
.It Pa /Users/joeuser/Library/really_long_file_name
|
||||
FILE_2 description
|
||||
.El \" Ends the list
|
||||
.\" .Sh DIAGNOSTICS \" May not be needed
|
||||
.\" .Bl -diag
|
||||
.\" .It Diagnostic Tag
|
||||
.\" Diagnostic informtion here.
|
||||
.\" .It Diagnostic Tag
|
||||
.\" Diagnostic informtion here.
|
||||
.\" .El
|
||||
.Sh SEE ALSO
|
||||
.\" List links in ascending order by section, alphabetically within a section.
|
||||
.\" Please do not reference files that do not exist without filing a bug report
|
||||
.Xr a 1 ,
|
||||
.Xr b 1 ,
|
||||
.Xr c 1 ,
|
||||
.Xr a 2 ,
|
||||
.Xr b 2 ,
|
||||
.Xr a 3 ,
|
||||
.Xr b 3
|
||||
.\" .Sh BUGS \" Document known, unremedied bugs
|
||||
.\" .Sh HISTORY \" Document history if command behaves in a unique manner
|
|
@ -1,78 +0,0 @@
|
|||
#include "TestSuite.h"
|
||||
#include "../Source/JSONNode.h"
|
||||
|
||||
#ifndef JSON_STDERROR
|
||||
#ifdef JSON_DEBUG
|
||||
#ifdef JSON_LIBRARY
|
||||
static void callback(const json_char * msg_c){
|
||||
json_string msg(msg_c);
|
||||
#else
|
||||
static void callback(const json_string & msg){
|
||||
#endif
|
||||
#ifdef JSON_STRING_HEADER
|
||||
echo("callback triggered, but can't display string");
|
||||
#else
|
||||
#ifdef JSON_UNICODE
|
||||
const std::string res = std::string(msg.begin(), msg.end());
|
||||
echo(res);
|
||||
#else
|
||||
echo(msg);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void TestSuite::TestSelf(void){
|
||||
UnitTest::SetPrefix("TestSuite.cpp - Self Test");
|
||||
#ifndef JSON_STDERROR
|
||||
#ifdef JSON_DEBUG
|
||||
#ifdef JSON_LIBRARY
|
||||
json_register_debug_callback(callback);
|
||||
#else
|
||||
libjson::register_debug_callback(callback);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
assertUnitTest();
|
||||
|
||||
#if defined(JSON_SAFE) && ! defined(JSON_LIBRARY)
|
||||
bool temp = false;
|
||||
JSON_ASSERT_SAFE(true, JSON_TEXT(""), temp = true;);
|
||||
assertFalse(temp);
|
||||
JSON_ASSERT_SAFE(false, JSON_TEXT(""), temp = true;);
|
||||
assertTrue(temp);
|
||||
|
||||
temp = false;
|
||||
JSON_FAIL_SAFE(JSON_TEXT(""), temp = true;);
|
||||
assertTrue(temp);
|
||||
#endif
|
||||
|
||||
echo("If this fails, then edit JSON_INDEX_TYPE in JSONOptions.h");
|
||||
assertLessThanEqualTo(sizeof(json_index_t), sizeof(void*));
|
||||
}
|
||||
|
||||
//makes sure that libjson didn't leak memory somewhere
|
||||
void TestSuite::TestFinal(void){
|
||||
#ifdef JSON_UNIT_TEST
|
||||
UnitTest::SetPrefix("TestSuite.cpp - Memory Leak");
|
||||
echo("Node allocations: " << JSONNode::getNodeAllocationCount());
|
||||
echo("Node deallocations: " << JSONNode::getNodeDeallocationCount());
|
||||
assertEquals(JSONNode::getNodeAllocationCount(), JSONNode::getNodeDeallocationCount());
|
||||
|
||||
echo("internal allocations: " << JSONNode::getInternalAllocationCount());
|
||||
echo("internal deallocations: " << JSONNode::getInternalDeallocationCount());
|
||||
assertEquals(JSONNode::getInternalAllocationCount(), JSONNode::getInternalDeallocationCount());
|
||||
|
||||
echo("children allocations: " << JSONNode::getChildrenAllocationCount());
|
||||
echo("children deallocations: " << JSONNode::getChildrenDeallocationCount());
|
||||
assertEquals(JSONNode::getChildrenAllocationCount(), JSONNode::getChildrenDeallocationCount());
|
||||
|
||||
#if defined(JSON_MEMORY_CALLBACKS) || defined(JSON_MEMORY_POOL)
|
||||
echo("stl allocations: " << JSONAllocatorRelayer::getAllocationCount());
|
||||
echo("stl deallocations: " << JSONAllocatorRelayer::getDeallocationCount());
|
||||
echo("stl bytes: " << JSONAllocatorRelayer::getAllocationByteCount());
|
||||
assertEquals(JSONAllocatorRelayer::getAllocationCount(), JSONAllocatorRelayer::getDeallocationCount());
|
||||
#endif
|
||||
#endif
|
||||
}
|
|
@ -1,109 +0,0 @@
|
|||
#ifndef TESTSUITE_H
|
||||
#define TESTSUITE_H
|
||||
|
||||
#include "UnitTest.h"
|
||||
#include "../../JSONOptions.h"
|
||||
#include "../../libjson.h"
|
||||
#include "../Source/JSONNode.h"
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
/*
|
||||
This class tests libjson's internal working and it's
|
||||
C++ interface
|
||||
*/
|
||||
|
||||
#ifdef JSON_UNICODE
|
||||
#define assertCStringSame(a, b) assertCStringEqualsW(a, b)
|
||||
#define assertCStringNotSame(a, b) assertCStringNotEqualsW(a, b)
|
||||
#else
|
||||
#define assertCStringSame(a, b) assertCStringEquals(a, b)
|
||||
#define assertCStringNotSame(a, b) assertCStringNotEquals(a, b)
|
||||
#endif
|
||||
|
||||
|
||||
class TestSuite {
|
||||
public:
|
||||
static void TestSelf(void);
|
||||
static void TestString(void);
|
||||
static void TestConverters(void);
|
||||
#ifdef JSON_BINARY
|
||||
static void TestBase64(void);
|
||||
#endif
|
||||
static void TestReferenceCounting(void);
|
||||
static void TestConstructors(void);
|
||||
static void TestAssigning(void);
|
||||
static void TestEquality(void);
|
||||
static void TestInequality(void);
|
||||
static void TestChildren(void);
|
||||
static void TestFunctions(void);
|
||||
static void TestIterators(void);
|
||||
static void TestInspectors(void);
|
||||
static void TestNamespace(void);
|
||||
static void TestValidator(void);
|
||||
static void TestStreams(void);
|
||||
#ifdef JSON_WRITE_PRIORITY
|
||||
static void TestWriter(void);
|
||||
#endif
|
||||
#ifdef JSON_COMMENTS
|
||||
static void TestComments(void);
|
||||
#endif
|
||||
#ifdef JSON_MUTEX_CALLBACKS
|
||||
static void TestMutex(void);
|
||||
static void TestThreading(void);
|
||||
#endif
|
||||
static void TestSharedString(void);
|
||||
static void TestFinal(void);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef JSON_LIBRARY
|
||||
static void testParsingItself(JSONNODE * x){
|
||||
#if defined(JSON_WRITE_PRIORITY) && defined(JSON_READ_PRIORITY)
|
||||
{
|
||||
json_char * written = json_write(x);
|
||||
JSONNODE * copy = json_parse(written);
|
||||
assertTrue(json_equal(x, copy));
|
||||
json_delete(copy);
|
||||
json_free(written);
|
||||
}
|
||||
{
|
||||
json_char * written = json_write_formatted(x);
|
||||
JSONNODE * copy = json_parse(written);
|
||||
assertTrue(json_equal(x, copy));
|
||||
json_delete(copy);
|
||||
json_free(written);
|
||||
}
|
||||
{
|
||||
json_char * written = json_write_formatted(x);
|
||||
json_char * written2 = json_write(x);
|
||||
json_char * stripped = json_strip_white_space(written);
|
||||
assertCStringSame(written2, stripped);
|
||||
json_free(stripped);
|
||||
json_free(written);
|
||||
json_free(written2);
|
||||
}
|
||||
#endif
|
||||
{
|
||||
JSONNODE * copy = json_duplicate(x);
|
||||
assertTrue(json_equal(x, copy));
|
||||
json_delete(copy);
|
||||
}
|
||||
}
|
||||
#else
|
||||
static void testParsingItself(JSONNode & x){
|
||||
#if defined(JSON_WRITE_PRIORITY) && defined(JSON_READ_PRIORITY)
|
||||
assertEquals(libjson::parse(x.write()), x);
|
||||
assertEquals(libjson::parse(x.write_formatted()), x);
|
||||
assertEquals(libjson::strip_white_space(x.write_formatted()), x.write());
|
||||
#endif
|
||||
assertEquals(x, x.duplicate())
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,685 +0,0 @@
|
|||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
8DD76F6A0486A84900D96B5E /* TestSuite.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859E8B029090EE04C91782 /* TestSuite.1 */; };
|
||||
BA01440512318DD6002575BA /* internalJSONNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143C912318DD6002575BA /* internalJSONNode.cpp */; };
|
||||
BA01440712318DD6002575BA /* JSONChildren.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143CD12318DD6002575BA /* JSONChildren.cpp */; };
|
||||
BA01440812318DD6002575BA /* JSONDebug.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143CF12318DD6002575BA /* JSONDebug.cpp */; };
|
||||
BA01440912318DD6002575BA /* JSONIterators.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143D212318DD6002575BA /* JSONIterators.cpp */; };
|
||||
BA01440A12318DD6002575BA /* JSONMemory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143D312318DD6002575BA /* JSONMemory.cpp */; };
|
||||
BA01440B12318DD6002575BA /* JSONNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143D512318DD6002575BA /* JSONNode.cpp */; };
|
||||
BA01440C12318DD6002575BA /* JSONNode_Mutex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143D712318DD6002575BA /* JSONNode_Mutex.cpp */; };
|
||||
BA01440D12318DD6002575BA /* JSONWorker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143D812318DD6002575BA /* JSONWorker.cpp */; };
|
||||
BA01440E12318DD6002575BA /* JSONWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143DA12318DD6002575BA /* JSONWriter.cpp */; };
|
||||
BA01440F12318DD6002575BA /* libjson.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143DB12318DD6002575BA /* libjson.cpp */; };
|
||||
BA01441012318DD6002575BA /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143EE12318DD6002575BA /* main.cpp */; };
|
||||
BA01441112318DD6002575BA /* TestAssign.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143EF12318DD6002575BA /* TestAssign.cpp */; };
|
||||
BA01441212318DD6002575BA /* TestChildren.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143F012318DD6002575BA /* TestChildren.cpp */; };
|
||||
BA01441312318DD6002575BA /* TestComments.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143F112318DD6002575BA /* TestComments.cpp */; };
|
||||
BA01441412318DD6002575BA /* TestConverters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143F212318DD6002575BA /* TestConverters.cpp */; };
|
||||
BA01441512318DD6002575BA /* TestCtors.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143F312318DD6002575BA /* TestCtors.cpp */; };
|
||||
BA01441612318DD6002575BA /* TestEquality.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143F412318DD6002575BA /* TestEquality.cpp */; };
|
||||
BA01441712318DD6002575BA /* TestFunctions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143F512318DD6002575BA /* TestFunctions.cpp */; };
|
||||
BA01441812318DD6002575BA /* TestInequality.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143F612318DD6002575BA /* TestInequality.cpp */; };
|
||||
BA01441912318DD6002575BA /* TestInspectors.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143F712318DD6002575BA /* TestInspectors.cpp */; };
|
||||
BA01441A12318DD6002575BA /* TestIterators.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143F812318DD6002575BA /* TestIterators.cpp */; };
|
||||
BA01441B12318DD6002575BA /* TestMutex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143F912318DD6002575BA /* TestMutex.cpp */; };
|
||||
BA01441C12318DD6002575BA /* TestNamespace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143FA12318DD6002575BA /* TestNamespace.cpp */; };
|
||||
BA01441D12318DD6002575BA /* TestRefCounting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143FB12318DD6002575BA /* TestRefCounting.cpp */; };
|
||||
BA01441E12318DD6002575BA /* TestSuite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0143FD12318DD6002575BA /* TestSuite.cpp */; };
|
||||
BA01441F12318DD6002575BA /* TestWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA01440212318DD6002575BA /* TestWriter.cpp */; };
|
||||
BA01442012318DD6002575BA /* UnitTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA01440312318DD6002575BA /* UnitTest.cpp */; };
|
||||
BA07EB3112C8DF7E001AE448 /* JSONStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA07EB3012C8DF7E001AE448 /* JSONStream.cpp */; };
|
||||
BA07EB3D12C8E402001AE448 /* TestStreams.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA07EB3C12C8E402001AE448 /* TestStreams.cpp */; };
|
||||
BA24981513C4F8880021B041 /* JSONAllocator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA24981413C4F8880021B041 /* JSONAllocator.cpp */; };
|
||||
BA2A923214705B8B00609A62 /* securityTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA2A923114705B8B00609A62 /* securityTest.cpp */; };
|
||||
BA3BBF4C147E8EBE004A159D /* RunTestSuite2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA3BBF4B147E8EBE004A159D /* RunTestSuite2.cpp */; };
|
||||
BA7F532E146FF81E00FEEA70 /* json_encode64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F532D146FF81E00FEEA70 /* json_encode64.cpp */; };
|
||||
BA7F5339146FFC6200FEEA70 /* json_decode64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F5338146FFC6200FEEA70 /* json_decode64.cpp */; };
|
||||
BA7F5341146FFE4D00FEEA70 /* jsonSingleton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F5340146FFE4D00FEEA70 /* jsonSingleton.cpp */; };
|
||||
BA7F53471470015D00FEEA70 /* getLenSize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F53461470015D00FEEA70 /* getLenSize.cpp */; };
|
||||
BA7F53551470076400FEEA70 /* _uitoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F53541470076400FEEA70 /* _uitoa.cpp */; };
|
||||
BA7F535F147007EC00FEEA70 /* _areFloatsEqual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F535B147007EC00FEEA70 /* _areFloatsEqual.cpp */; };
|
||||
BA7F5360147007EC00FEEA70 /* _itoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F535D147007EC00FEEA70 /* _itoa.cpp */; };
|
||||
BA7F53671470098B00FEEA70 /* _ftoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F53661470098B00FEEA70 /* _ftoa.cpp */; };
|
||||
BA7F536B14700BD200FEEA70 /* isNumeric.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F536A14700BD200FEEA70 /* isNumeric.cpp */; };
|
||||
BA7F537414700E8900FEEA70 /* JSON_ASSERT_SAFE.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F537314700E8900FEEA70 /* JSON_ASSERT_SAFE.cpp */; };
|
||||
BA7F537714700E9D00FEEA70 /* JSON_ASSERT.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F537614700E9D00FEEA70 /* JSON_ASSERT.cpp */; };
|
||||
BA7F537A14700EBA00FEEA70 /* JSON_FAIL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F537914700EBA00FEEA70 /* JSON_FAIL.cpp */; };
|
||||
BA7F537D14700ECB00FEEA70 /* JSON_FAIL_SAFE.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F537C14700ECB00FEEA70 /* JSON_FAIL_SAFE.cpp */; };
|
||||
BA7F538E14701E5D00FEEA70 /* isValidNumber.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F538D14701E5D00FEEA70 /* isValidNumber.cpp */; };
|
||||
BA7F539114701E6C00FEEA70 /* isValidMember.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F539014701E6C00FEEA70 /* isValidMember.cpp */; };
|
||||
BA7F539414701E7F00FEEA70 /* isValidString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F539314701E7F00FEEA70 /* isValidString.cpp */; };
|
||||
BA7F539714701E9100FEEA70 /* isValidNamedObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F539614701E9100FEEA70 /* isValidNamedObject.cpp */; };
|
||||
BA7F539A14701E9D00FEEA70 /* isValidObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F539914701E9D00FEEA70 /* isValidObject.cpp */; };
|
||||
BA7F539D14701EAE00FEEA70 /* isValidArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA7F539C14701EAE00FEEA70 /* isValidArray.cpp */; };
|
||||
BA90E54112AEDB980064FE9F /* TestValidator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA90E54012AEDB980064FE9F /* TestValidator.cpp */; };
|
||||
BAA1135D147154E500166961 /* isValidPartialRoot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BAA11359147154E500166961 /* isValidPartialRoot.cpp */; };
|
||||
BAA1135E147154E500166961 /* isValidRoot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BAA1135B147154E500166961 /* isValidRoot.cpp */; };
|
||||
BAA11367147155D600166961 /* _atof.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BAA11366147155D600166961 /* _atof.cpp */; };
|
||||
BAB4249612AED5E700EA03D1 /* JSONValidator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BAB4249512AED5E700EA03D1 /* JSONValidator.cpp */; };
|
||||
BAB51D521356503300C3349E /* JSONPreparse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BAB51D511356503300C3349E /* JSONPreparse.cpp */; };
|
||||
BABED9AE12C931230047E2DF /* TestBinary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BABED9AD12C931230047E2DF /* TestBinary.cpp */; };
|
||||
BAD89A2B128F00BB00E1D300 /* TestString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BAD89A2A128F00BB00E1D300 /* TestString.cpp */; };
|
||||
BAD8A0CC1493A9F0005C4908 /* TestSharedString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BAD8A0CB1493A9F0005C4908 /* TestSharedString.cpp */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
8DD76F690486A84900D96B5E /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 8;
|
||||
dstPath = /usr/share/man/man1/;
|
||||
dstSubfolderSpec = 0;
|
||||
files = (
|
||||
8DD76F6A0486A84900D96B5E /* TestSuite.1 in CopyFiles */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 1;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
8DD76F6C0486A84900D96B5E /* TestSuite */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = TestSuite; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
BA0143C612318DD6002575BA /* JSONOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSONOptions.h; path = ../JSONOptions.h; sourceTree = SOURCE_ROOT; };
|
||||
BA0143C712318DD6002575BA /* libjson.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = libjson.h; path = ../libjson.h; sourceTree = SOURCE_ROOT; };
|
||||
BA0143C912318DD6002575BA /* internalJSONNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = internalJSONNode.cpp; sourceTree = "<group>"; };
|
||||
BA0143CA12318DD6002575BA /* internalJSONNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = internalJSONNode.h; sourceTree = "<group>"; };
|
||||
BA0143CD12318DD6002575BA /* JSONChildren.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONChildren.cpp; sourceTree = "<group>"; };
|
||||
BA0143CE12318DD6002575BA /* JSONChildren.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONChildren.h; sourceTree = "<group>"; };
|
||||
BA0143CF12318DD6002575BA /* JSONDebug.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONDebug.cpp; sourceTree = "<group>"; };
|
||||
BA0143D012318DD6002575BA /* JSONDebug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONDebug.h; sourceTree = "<group>"; };
|
||||
BA0143D112318DD6002575BA /* JSONDefs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONDefs.h; sourceTree = "<group>"; };
|
||||
BA0143D212318DD6002575BA /* JSONIterators.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONIterators.cpp; sourceTree = "<group>"; };
|
||||
BA0143D312318DD6002575BA /* JSONMemory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONMemory.cpp; sourceTree = "<group>"; };
|
||||
BA0143D412318DD6002575BA /* JSONMemory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONMemory.h; sourceTree = "<group>"; };
|
||||
BA0143D512318DD6002575BA /* JSONNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONNode.cpp; sourceTree = "<group>"; };
|
||||
BA0143D612318DD6002575BA /* JSONNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONNode.h; sourceTree = "<group>"; };
|
||||
BA0143D712318DD6002575BA /* JSONNode_Mutex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONNode_Mutex.cpp; sourceTree = "<group>"; };
|
||||
BA0143D812318DD6002575BA /* JSONWorker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONWorker.cpp; sourceTree = "<group>"; };
|
||||
BA0143D912318DD6002575BA /* JSONWorker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONWorker.h; sourceTree = "<group>"; };
|
||||
BA0143DA12318DD6002575BA /* JSONWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONWriter.cpp; sourceTree = "<group>"; };
|
||||
BA0143DB12318DD6002575BA /* libjson.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = libjson.cpp; sourceTree = "<group>"; };
|
||||
BA0143DC12318DD6002575BA /* NumberToString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NumberToString.h; sourceTree = "<group>"; };
|
||||
BA0143EE12318DD6002575BA /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
|
||||
BA0143EF12318DD6002575BA /* TestAssign.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestAssign.cpp; sourceTree = "<group>"; };
|
||||
BA0143F012318DD6002575BA /* TestChildren.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestChildren.cpp; sourceTree = "<group>"; };
|
||||
BA0143F112318DD6002575BA /* TestComments.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestComments.cpp; sourceTree = "<group>"; };
|
||||
BA0143F212318DD6002575BA /* TestConverters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestConverters.cpp; sourceTree = "<group>"; };
|
||||
BA0143F312318DD6002575BA /* TestCtors.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestCtors.cpp; sourceTree = "<group>"; };
|
||||
BA0143F412318DD6002575BA /* TestEquality.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestEquality.cpp; sourceTree = "<group>"; };
|
||||
BA0143F512318DD6002575BA /* TestFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestFunctions.cpp; sourceTree = "<group>"; };
|
||||
BA0143F612318DD6002575BA /* TestInequality.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestInequality.cpp; sourceTree = "<group>"; };
|
||||
BA0143F712318DD6002575BA /* TestInspectors.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestInspectors.cpp; sourceTree = "<group>"; };
|
||||
BA0143F812318DD6002575BA /* TestIterators.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestIterators.cpp; sourceTree = "<group>"; };
|
||||
BA0143F912318DD6002575BA /* TestMutex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestMutex.cpp; sourceTree = "<group>"; };
|
||||
BA0143FA12318DD6002575BA /* TestNamespace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestNamespace.cpp; sourceTree = "<group>"; };
|
||||
BA0143FB12318DD6002575BA /* TestRefCounting.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestRefCounting.cpp; sourceTree = "<group>"; };
|
||||
BA0143FD12318DD6002575BA /* TestSuite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestSuite.cpp; sourceTree = "<group>"; };
|
||||
BA0143FE12318DD6002575BA /* TestSuite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestSuite.h; sourceTree = "<group>"; };
|
||||
BA01440212318DD6002575BA /* TestWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestWriter.cpp; sourceTree = "<group>"; };
|
||||
BA01440312318DD6002575BA /* UnitTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnitTest.cpp; sourceTree = "<group>"; };
|
||||
BA01440412318DD6002575BA /* UnitTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnitTest.h; sourceTree = "<group>"; };
|
||||
BA07EB2F12C8DF7E001AE448 /* JSONStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONStream.h; sourceTree = "<group>"; };
|
||||
BA07EB3012C8DF7E001AE448 /* JSONStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONStream.cpp; sourceTree = "<group>"; };
|
||||
BA07EB3C12C8E402001AE448 /* TestStreams.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestStreams.cpp; sourceTree = "<group>"; };
|
||||
BA24981313C4F8880021B041 /* JSONAllocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONAllocator.h; sourceTree = "<group>"; };
|
||||
BA24981413C4F8880021B041 /* JSONAllocator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONAllocator.cpp; sourceTree = "<group>"; };
|
||||
BA2A923014705B8B00609A62 /* securityTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = securityTest.h; path = ../TestSuite2/JSONValidator/securityTest.h; sourceTree = "<group>"; };
|
||||
BA2A923114705B8B00609A62 /* securityTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = securityTest.cpp; path = ../TestSuite2/JSONValidator/securityTest.cpp; sourceTree = "<group>"; };
|
||||
BA37890D12A99A150007FFFC /* Checklist.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Checklist.txt; sourceTree = "<group>"; };
|
||||
BA38C49D12901AD70088EBDD /* UStringTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UStringTest.h; sourceTree = "<group>"; };
|
||||
BA3BBF3F147E8715004A159D /* TestSuite2Creator.php */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.php; path = TestSuite2Creator.php; sourceTree = "<group>"; };
|
||||
BA3BBF4A147E8EBE004A159D /* RunTestSuite2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RunTestSuite2.h; sourceTree = "<group>"; };
|
||||
BA3BBF4B147E8EBE004A159D /* RunTestSuite2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RunTestSuite2.cpp; sourceTree = "<group>"; };
|
||||
BA5D5E131492C7A500FAEDF1 /* JSONSharedString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONSharedString.h; sourceTree = "<group>"; };
|
||||
BA7F532C146FF81E00FEEA70 /* json_encode64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = json_encode64.h; path = /Users/wallace/Documents/libjson/TestSuite2/JSON_Base64/json_encode64.h; sourceTree = "<absolute>"; };
|
||||
BA7F532D146FF81E00FEEA70 /* json_encode64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = json_encode64.cpp; path = /Users/wallace/Documents/libjson/TestSuite2/JSON_Base64/json_encode64.cpp; sourceTree = "<absolute>"; };
|
||||
BA7F5331146FF85D00FEEA70 /* BaseTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BaseTest.h; path = ../TestSuite2/BaseTest.h; sourceTree = "<group>"; };
|
||||
BA7F5337146FFC6200FEEA70 /* json_decode64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = json_decode64.h; path = ../TestSuite2/JSON_Base64/json_decode64.h; sourceTree = "<group>"; };
|
||||
BA7F5338146FFC6200FEEA70 /* json_decode64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = json_decode64.cpp; path = ../TestSuite2/JSON_Base64/json_decode64.cpp; sourceTree = "<group>"; };
|
||||
BA7F533F146FFE4D00FEEA70 /* jsonSingleton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = jsonSingleton.h; path = ../TestSuite2/JSONGlobals/jsonSingleton.h; sourceTree = "<group>"; };
|
||||
BA7F5340146FFE4D00FEEA70 /* jsonSingleton.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = jsonSingleton.cpp; path = ../TestSuite2/JSONGlobals/jsonSingleton.cpp; sourceTree = "<group>"; };
|
||||
BA7F53451470015D00FEEA70 /* getLenSize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = getLenSize.h; path = ../TestSuite2/NumberToString/getLenSize.h; sourceTree = "<group>"; };
|
||||
BA7F53461470015D00FEEA70 /* getLenSize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = getLenSize.cpp; path = ../TestSuite2/NumberToString/getLenSize.cpp; sourceTree = "<group>"; };
|
||||
BA7F53531470076400FEEA70 /* _uitoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _uitoa.h; path = ../TestSuite2/NumberToString/_uitoa.h; sourceTree = "<group>"; };
|
||||
BA7F53541470076400FEEA70 /* _uitoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = _uitoa.cpp; path = ../TestSuite2/NumberToString/_uitoa.cpp; sourceTree = "<group>"; };
|
||||
BA7F535B147007EC00FEEA70 /* _areFloatsEqual.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = _areFloatsEqual.cpp; path = ../TestSuite2/NumberToString/_areFloatsEqual.cpp; sourceTree = "<group>"; };
|
||||
BA7F535C147007EC00FEEA70 /* _areFloatsEqual.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _areFloatsEqual.h; path = ../TestSuite2/NumberToString/_areFloatsEqual.h; sourceTree = "<group>"; };
|
||||
BA7F535D147007EC00FEEA70 /* _itoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = _itoa.cpp; path = ../TestSuite2/NumberToString/_itoa.cpp; sourceTree = "<group>"; };
|
||||
BA7F535E147007EC00FEEA70 /* _itoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _itoa.h; path = ../TestSuite2/NumberToString/_itoa.h; sourceTree = "<group>"; };
|
||||
BA7F53651470098B00FEEA70 /* _ftoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _ftoa.h; path = ../TestSuite2/NumberToString/_ftoa.h; sourceTree = "<group>"; };
|
||||
BA7F53661470098B00FEEA70 /* _ftoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = _ftoa.cpp; path = ../TestSuite2/NumberToString/_ftoa.cpp; sourceTree = "<group>"; };
|
||||
BA7F536914700BD200FEEA70 /* isNumeric.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = isNumeric.h; path = ../TestSuite2/NumberToString/isNumeric.h; sourceTree = "<group>"; };
|
||||
BA7F536A14700BD200FEEA70 /* isNumeric.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = isNumeric.cpp; path = ../TestSuite2/NumberToString/isNumeric.cpp; sourceTree = "<group>"; };
|
||||
BA7F537214700E8900FEEA70 /* JSON_ASSERT_SAFE.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSON_ASSERT_SAFE.h; path = ../TestSuite2/JSONDebug/JSON_ASSERT_SAFE.h; sourceTree = "<group>"; };
|
||||
BA7F537314700E8900FEEA70 /* JSON_ASSERT_SAFE.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSON_ASSERT_SAFE.cpp; path = ../TestSuite2/JSONDebug/JSON_ASSERT_SAFE.cpp; sourceTree = "<group>"; };
|
||||
BA7F537514700E9D00FEEA70 /* JSON_ASSERT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSON_ASSERT.h; path = ../TestSuite2/JSONDebug/JSON_ASSERT.h; sourceTree = "<group>"; };
|
||||
BA7F537614700E9D00FEEA70 /* JSON_ASSERT.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSON_ASSERT.cpp; path = ../TestSuite2/JSONDebug/JSON_ASSERT.cpp; sourceTree = "<group>"; };
|
||||
BA7F537814700EBA00FEEA70 /* JSON_FAIL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSON_FAIL.h; path = ../TestSuite2/JSONDebug/JSON_FAIL.h; sourceTree = "<group>"; };
|
||||
BA7F537914700EBA00FEEA70 /* JSON_FAIL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSON_FAIL.cpp; path = ../TestSuite2/JSONDebug/JSON_FAIL.cpp; sourceTree = "<group>"; };
|
||||
BA7F537B14700ECB00FEEA70 /* JSON_FAIL_SAFE.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSON_FAIL_SAFE.h; path = ../TestSuite2/JSONDebug/JSON_FAIL_SAFE.h; sourceTree = "<group>"; };
|
||||
BA7F537C14700ECB00FEEA70 /* JSON_FAIL_SAFE.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSON_FAIL_SAFE.cpp; path = ../TestSuite2/JSONDebug/JSON_FAIL_SAFE.cpp; sourceTree = "<group>"; };
|
||||
BA7F538C14701E5D00FEEA70 /* isValidNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = isValidNumber.h; path = ../TestSuite2/JSONValidator/isValidNumber.h; sourceTree = "<group>"; };
|
||||
BA7F538D14701E5D00FEEA70 /* isValidNumber.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = isValidNumber.cpp; path = ../TestSuite2/JSONValidator/isValidNumber.cpp; sourceTree = "<group>"; };
|
||||
BA7F538F14701E6C00FEEA70 /* isValidMember.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = isValidMember.h; path = ../TestSuite2/JSONValidator/isValidMember.h; sourceTree = "<group>"; };
|
||||
BA7F539014701E6C00FEEA70 /* isValidMember.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = isValidMember.cpp; path = ../TestSuite2/JSONValidator/isValidMember.cpp; sourceTree = "<group>"; };
|
||||
BA7F539214701E7F00FEEA70 /* isValidString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = isValidString.h; path = ../TestSuite2/JSONValidator/isValidString.h; sourceTree = "<group>"; };
|
||||
BA7F539314701E7F00FEEA70 /* isValidString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = isValidString.cpp; path = ../TestSuite2/JSONValidator/isValidString.cpp; sourceTree = "<group>"; };
|
||||
BA7F539514701E9100FEEA70 /* isValidNamedObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = isValidNamedObject.h; path = ../TestSuite2/JSONValidator/isValidNamedObject.h; sourceTree = "<group>"; };
|
||||
BA7F539614701E9100FEEA70 /* isValidNamedObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = isValidNamedObject.cpp; path = ../TestSuite2/JSONValidator/isValidNamedObject.cpp; sourceTree = "<group>"; };
|
||||
BA7F539814701E9D00FEEA70 /* isValidObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = isValidObject.h; path = ../TestSuite2/JSONValidator/isValidObject.h; sourceTree = "<group>"; };
|
||||
BA7F539914701E9D00FEEA70 /* isValidObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = isValidObject.cpp; path = ../TestSuite2/JSONValidator/isValidObject.cpp; sourceTree = "<group>"; };
|
||||
BA7F539B14701EAE00FEEA70 /* isValidArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = isValidArray.h; path = ../TestSuite2/JSONValidator/isValidArray.h; sourceTree = "<group>"; };
|
||||
BA7F539C14701EAE00FEEA70 /* isValidArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = isValidArray.cpp; path = ../TestSuite2/JSONValidator/isValidArray.cpp; sourceTree = "<group>"; };
|
||||
BA7F53A614701FB900FEEA70 /* validyMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = validyMacros.h; path = ../TestSuite2/JSONValidator/Resources/validyMacros.h; sourceTree = "<group>"; };
|
||||
BA82868312F3BDD0005EAA8B /* Visual_C.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Visual_C.h; sourceTree = "<group>"; };
|
||||
BA82868912F3BE63005EAA8B /* GNU_C.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GNU_C.h; sourceTree = "<group>"; };
|
||||
BA82868A12F3BE76005EAA8B /* Unknown_C.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Unknown_C.h; sourceTree = "<group>"; };
|
||||
BA8286A912F3C391005EAA8B /* Strings_Defs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Strings_Defs.h; sourceTree = "<group>"; };
|
||||
BA8B9AF913D1CA680077C2D5 /* JSONGlobals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONGlobals.h; sourceTree = "<group>"; };
|
||||
BA90E54012AEDB980064FE9F /* TestValidator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestValidator.cpp; sourceTree = "<group>"; };
|
||||
BAA11359147154E500166961 /* isValidPartialRoot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = isValidPartialRoot.cpp; path = ../TestSuite2/JSONValidator/isValidPartialRoot.cpp; sourceTree = "<group>"; };
|
||||
BAA1135A147154E500166961 /* isValidPartialRoot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = isValidPartialRoot.h; path = ../TestSuite2/JSONValidator/isValidPartialRoot.h; sourceTree = "<group>"; };
|
||||
BAA1135B147154E500166961 /* isValidRoot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = isValidRoot.cpp; path = ../TestSuite2/JSONValidator/isValidRoot.cpp; sourceTree = "<group>"; };
|
||||
BAA1135C147154E500166961 /* isValidRoot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = isValidRoot.h; path = ../TestSuite2/JSONValidator/isValidRoot.h; sourceTree = "<group>"; };
|
||||
BAA11365147155D600166961 /* _atof.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _atof.h; path = ../TestSuite2/NumberToString/_atof.h; sourceTree = "<group>"; };
|
||||
BAA11366147155D600166961 /* _atof.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = _atof.cpp; path = ../TestSuite2/NumberToString/_atof.cpp; sourceTree = "<group>"; };
|
||||
BAA87015140FC61F0088B03B /* JSONMemoryPool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONMemoryPool.h; sourceTree = "<group>"; };
|
||||
BAAB76C61232AFB100EA97E4 /* makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = makefile; sourceTree = "<group>"; };
|
||||
BAB4249412AED5E700EA03D1 /* JSONValidator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONValidator.h; sourceTree = "<group>"; };
|
||||
BAB4249512AED5E700EA03D1 /* JSONValidator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONValidator.cpp; sourceTree = "<group>"; };
|
||||
BAB51D501356503300C3349E /* JSONPreparse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONPreparse.h; sourceTree = "<group>"; };
|
||||
BAB51D511356503300C3349E /* JSONPreparse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONPreparse.cpp; sourceTree = "<group>"; };
|
||||
BABED9AD12C931230047E2DF /* TestBinary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestBinary.cpp; sourceTree = "<group>"; };
|
||||
BAC2949914F6DF14005EBF87 /* libbase64++.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "libbase64++.h"; sourceTree = "<group>"; };
|
||||
BAC2949B14F6DF14005EBF87 /* mempool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mempool.h; sourceTree = "<group>"; };
|
||||
BAC2949C14F6E102005EBF87 /* JSON_Base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSON_Base64.h; sourceTree = "<group>"; };
|
||||
BAD899A4128EEEEA00E1D300 /* StringTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringTest.h; sourceTree = "<group>"; };
|
||||
BAD89A2A128F00BB00E1D300 /* TestString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestString.cpp; sourceTree = "<group>"; };
|
||||
BAD8A0CB1493A9F0005C4908 /* TestSharedString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestSharedString.cpp; sourceTree = "<group>"; };
|
||||
C6859E8B029090EE04C91782 /* TestSuite.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = TestSuite.1; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
8DD76F660486A84900D96B5E /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
08FB7794FE84155DC02AAC07 /* TestSuite */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BAC2949714F6DF14005EBF87 /* Dependencies */,
|
||||
BA82868212F3BDA4005EAA8B /* JSONDefs */,
|
||||
BA0143C612318DD6002575BA /* JSONOptions.h */,
|
||||
BA0143C712318DD6002575BA /* libjson.h */,
|
||||
BA0143C812318DD6002575BA /* Source */,
|
||||
BA0143DD12318DD6002575BA /* TestSuite */,
|
||||
C6859E8C029090F304C91782 /* Documentation */,
|
||||
1AB674ADFE9D54B511CA2CBB /* Products */,
|
||||
BAAB76C61232AFB100EA97E4 /* makefile */,
|
||||
);
|
||||
name = TestSuite;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1AB674ADFE9D54B511CA2CBB /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8DD76F6C0486A84900D96B5E /* TestSuite */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BA0143C812318DD6002575BA /* Source */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BAC2949C14F6E102005EBF87 /* JSON_Base64.h */,
|
||||
BA0143C912318DD6002575BA /* internalJSONNode.cpp */,
|
||||
BA0143CA12318DD6002575BA /* internalJSONNode.h */,
|
||||
BA0143CD12318DD6002575BA /* JSONChildren.cpp */,
|
||||
BA0143CE12318DD6002575BA /* JSONChildren.h */,
|
||||
BA0143CF12318DD6002575BA /* JSONDebug.cpp */,
|
||||
BA0143D012318DD6002575BA /* JSONDebug.h */,
|
||||
BA0143D112318DD6002575BA /* JSONDefs.h */,
|
||||
BA0143D212318DD6002575BA /* JSONIterators.cpp */,
|
||||
BA0143D312318DD6002575BA /* JSONMemory.cpp */,
|
||||
BA0143D412318DD6002575BA /* JSONMemory.h */,
|
||||
BA0143D512318DD6002575BA /* JSONNode.cpp */,
|
||||
BA0143D612318DD6002575BA /* JSONNode.h */,
|
||||
BA0143D712318DD6002575BA /* JSONNode_Mutex.cpp */,
|
||||
BA0143D812318DD6002575BA /* JSONWorker.cpp */,
|
||||
BA0143D912318DD6002575BA /* JSONWorker.h */,
|
||||
BA0143DA12318DD6002575BA /* JSONWriter.cpp */,
|
||||
BA0143DB12318DD6002575BA /* libjson.cpp */,
|
||||
BA0143DC12318DD6002575BA /* NumberToString.h */,
|
||||
BAB4249412AED5E700EA03D1 /* JSONValidator.h */,
|
||||
BAB4249512AED5E700EA03D1 /* JSONValidator.cpp */,
|
||||
BA07EB2F12C8DF7E001AE448 /* JSONStream.h */,
|
||||
BA07EB3012C8DF7E001AE448 /* JSONStream.cpp */,
|
||||
BAB51D501356503300C3349E /* JSONPreparse.h */,
|
||||
BAB51D511356503300C3349E /* JSONPreparse.cpp */,
|
||||
BA24981313C4F8880021B041 /* JSONAllocator.h */,
|
||||
BA24981413C4F8880021B041 /* JSONAllocator.cpp */,
|
||||
BA8B9AF913D1CA680077C2D5 /* JSONGlobals.h */,
|
||||
BAA87015140FC61F0088B03B /* JSONMemoryPool.h */,
|
||||
BA5D5E131492C7A500FAEDF1 /* JSONSharedString.h */,
|
||||
);
|
||||
name = Source;
|
||||
path = ../Source;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
BA0143DD12318DD6002575BA /* TestSuite */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BA7F538B14701E0200FEEA70 /* JSONValidator */,
|
||||
BA7F537114700E4E00FEEA70 /* JSONDebug */,
|
||||
BA7F53431470013200FEEA70 /* NumberToString */,
|
||||
BA7F533E146FFDD300FEEA70 /* JSONGlobals */,
|
||||
BA7F5330146FF82B00FEEA70 /* JSON_Base64 */,
|
||||
BA0143EE12318DD6002575BA /* main.cpp */,
|
||||
BA0143EF12318DD6002575BA /* TestAssign.cpp */,
|
||||
BA0143F012318DD6002575BA /* TestChildren.cpp */,
|
||||
BA0143F112318DD6002575BA /* TestComments.cpp */,
|
||||
BA0143F212318DD6002575BA /* TestConverters.cpp */,
|
||||
BA0143F312318DD6002575BA /* TestCtors.cpp */,
|
||||
BA0143F412318DD6002575BA /* TestEquality.cpp */,
|
||||
BA0143F512318DD6002575BA /* TestFunctions.cpp */,
|
||||
BA0143F612318DD6002575BA /* TestInequality.cpp */,
|
||||
BA0143F712318DD6002575BA /* TestInspectors.cpp */,
|
||||
BA0143F812318DD6002575BA /* TestIterators.cpp */,
|
||||
BA0143F912318DD6002575BA /* TestMutex.cpp */,
|
||||
BA0143FA12318DD6002575BA /* TestNamespace.cpp */,
|
||||
BA0143FB12318DD6002575BA /* TestRefCounting.cpp */,
|
||||
BA0143FD12318DD6002575BA /* TestSuite.cpp */,
|
||||
BA0143FE12318DD6002575BA /* TestSuite.h */,
|
||||
BA01440212318DD6002575BA /* TestWriter.cpp */,
|
||||
BA01440312318DD6002575BA /* UnitTest.cpp */,
|
||||
BA01440412318DD6002575BA /* UnitTest.h */,
|
||||
BAD899A4128EEEEA00E1D300 /* StringTest.h */,
|
||||
BAD89A2A128F00BB00E1D300 /* TestString.cpp */,
|
||||
BA38C49D12901AD70088EBDD /* UStringTest.h */,
|
||||
BA37890D12A99A150007FFFC /* Checklist.txt */,
|
||||
BA90E54012AEDB980064FE9F /* TestValidator.cpp */,
|
||||
BA07EB3C12C8E402001AE448 /* TestStreams.cpp */,
|
||||
BABED9AD12C931230047E2DF /* TestBinary.cpp */,
|
||||
BA7F5331146FF85D00FEEA70 /* BaseTest.h */,
|
||||
BA3BBF3F147E8715004A159D /* TestSuite2Creator.php */,
|
||||
BA3BBF4A147E8EBE004A159D /* RunTestSuite2.h */,
|
||||
BA3BBF4B147E8EBE004A159D /* RunTestSuite2.cpp */,
|
||||
BAD8A0CB1493A9F0005C4908 /* TestSharedString.cpp */,
|
||||
);
|
||||
name = TestSuite;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BA7F5330146FF82B00FEEA70 /* JSON_Base64 */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BA7F532C146FF81E00FEEA70 /* json_encode64.h */,
|
||||
BA7F532D146FF81E00FEEA70 /* json_encode64.cpp */,
|
||||
BA7F5337146FFC6200FEEA70 /* json_decode64.h */,
|
||||
BA7F5338146FFC6200FEEA70 /* json_decode64.cpp */,
|
||||
);
|
||||
name = JSON_Base64;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BA7F533E146FFDD300FEEA70 /* JSONGlobals */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BA7F533F146FFE4D00FEEA70 /* jsonSingleton.h */,
|
||||
BA7F5340146FFE4D00FEEA70 /* jsonSingleton.cpp */,
|
||||
);
|
||||
name = JSONGlobals;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BA7F53431470013200FEEA70 /* NumberToString */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BA7F535C147007EC00FEEA70 /* _areFloatsEqual.h */,
|
||||
BA7F535B147007EC00FEEA70 /* _areFloatsEqual.cpp */,
|
||||
BA7F535E147007EC00FEEA70 /* _itoa.h */,
|
||||
BA7F535D147007EC00FEEA70 /* _itoa.cpp */,
|
||||
BA7F53451470015D00FEEA70 /* getLenSize.h */,
|
||||
BA7F53461470015D00FEEA70 /* getLenSize.cpp */,
|
||||
BA7F53531470076400FEEA70 /* _uitoa.h */,
|
||||
BA7F53541470076400FEEA70 /* _uitoa.cpp */,
|
||||
BA7F53651470098B00FEEA70 /* _ftoa.h */,
|
||||
BA7F53661470098B00FEEA70 /* _ftoa.cpp */,
|
||||
BA7F536914700BD200FEEA70 /* isNumeric.h */,
|
||||
BA7F536A14700BD200FEEA70 /* isNumeric.cpp */,
|
||||
BAA11365147155D600166961 /* _atof.h */,
|
||||
BAA11366147155D600166961 /* _atof.cpp */,
|
||||
);
|
||||
name = NumberToString;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BA7F537114700E4E00FEEA70 /* JSONDebug */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BA7F537214700E8900FEEA70 /* JSON_ASSERT_SAFE.h */,
|
||||
BA7F537314700E8900FEEA70 /* JSON_ASSERT_SAFE.cpp */,
|
||||
BA7F537514700E9D00FEEA70 /* JSON_ASSERT.h */,
|
||||
BA7F537614700E9D00FEEA70 /* JSON_ASSERT.cpp */,
|
||||
BA7F537B14700ECB00FEEA70 /* JSON_FAIL_SAFE.h */,
|
||||
BA7F537C14700ECB00FEEA70 /* JSON_FAIL_SAFE.cpp */,
|
||||
BA7F537814700EBA00FEEA70 /* JSON_FAIL.h */,
|
||||
BA7F537914700EBA00FEEA70 /* JSON_FAIL.cpp */,
|
||||
);
|
||||
name = JSONDebug;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BA7F538B14701E0200FEEA70 /* JSONValidator */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BA7F53A514701F9800FEEA70 /* Resources */,
|
||||
BA7F538C14701E5D00FEEA70 /* isValidNumber.h */,
|
||||
BA7F538D14701E5D00FEEA70 /* isValidNumber.cpp */,
|
||||
BA7F538F14701E6C00FEEA70 /* isValidMember.h */,
|
||||
BA7F539014701E6C00FEEA70 /* isValidMember.cpp */,
|
||||
BA7F539214701E7F00FEEA70 /* isValidString.h */,
|
||||
BA7F539314701E7F00FEEA70 /* isValidString.cpp */,
|
||||
BA7F539514701E9100FEEA70 /* isValidNamedObject.h */,
|
||||
BA7F539614701E9100FEEA70 /* isValidNamedObject.cpp */,
|
||||
BA7F539814701E9D00FEEA70 /* isValidObject.h */,
|
||||
BA7F539914701E9D00FEEA70 /* isValidObject.cpp */,
|
||||
BA7F539B14701EAE00FEEA70 /* isValidArray.h */,
|
||||
BA7F539C14701EAE00FEEA70 /* isValidArray.cpp */,
|
||||
BAA1135A147154E500166961 /* isValidPartialRoot.h */,
|
||||
BAA11359147154E500166961 /* isValidPartialRoot.cpp */,
|
||||
BAA1135C147154E500166961 /* isValidRoot.h */,
|
||||
BAA1135B147154E500166961 /* isValidRoot.cpp */,
|
||||
BA2A923014705B8B00609A62 /* securityTest.h */,
|
||||
BA2A923114705B8B00609A62 /* securityTest.cpp */,
|
||||
);
|
||||
name = JSONValidator;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BA7F53A514701F9800FEEA70 /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BA7F53A614701FB900FEEA70 /* validyMacros.h */,
|
||||
);
|
||||
name = Resources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BA82868212F3BDA4005EAA8B /* JSONDefs */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BA82868312F3BDD0005EAA8B /* Visual_C.h */,
|
||||
BA82868912F3BE63005EAA8B /* GNU_C.h */,
|
||||
BA82868A12F3BE76005EAA8B /* Unknown_C.h */,
|
||||
BA8286A912F3C391005EAA8B /* Strings_Defs.h */,
|
||||
);
|
||||
name = JSONDefs;
|
||||
path = ../Source/JSONDefs;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
BAC2949714F6DF14005EBF87 /* Dependencies */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BAC2949814F6DF14005EBF87 /* libbase64++ */,
|
||||
BAC2949A14F6DF14005EBF87 /* mempool++ */,
|
||||
);
|
||||
name = Dependencies;
|
||||
path = ../Dependencies;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BAC2949814F6DF14005EBF87 /* libbase64++ */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BAC2949914F6DF14005EBF87 /* libbase64++.h */,
|
||||
);
|
||||
path = "libbase64++";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BAC2949A14F6DF14005EBF87 /* mempool++ */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BAC2949B14F6DF14005EBF87 /* mempool.h */,
|
||||
);
|
||||
path = "mempool++";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
C6859E8C029090F304C91782 /* Documentation */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C6859E8B029090EE04C91782 /* TestSuite.1 */,
|
||||
);
|
||||
name = Documentation;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
8DD76F620486A84900D96B5E /* TestSuite */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 1DEB923108733DC60010E9CD /* Build configuration list for PBXNativeTarget "TestSuite" */;
|
||||
buildPhases = (
|
||||
8DD76F640486A84900D96B5E /* Sources */,
|
||||
8DD76F660486A84900D96B5E /* Frameworks */,
|
||||
8DD76F690486A84900D96B5E /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = TestSuite;
|
||||
productInstallPath = "$(HOME)/bin";
|
||||
productName = TestSuite;
|
||||
productReference = 8DD76F6C0486A84900D96B5E /* TestSuite */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
08FB7793FE84155DC02AAC07 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0410;
|
||||
};
|
||||
buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "TestSuite" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 1;
|
||||
knownRegions = (
|
||||
English,
|
||||
Japanese,
|
||||
French,
|
||||
German,
|
||||
);
|
||||
mainGroup = 08FB7794FE84155DC02AAC07 /* TestSuite */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
8DD76F620486A84900D96B5E /* TestSuite */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
8DD76F640486A84900D96B5E /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
BA01440512318DD6002575BA /* internalJSONNode.cpp in Sources */,
|
||||
BA01440712318DD6002575BA /* JSONChildren.cpp in Sources */,
|
||||
BA01440812318DD6002575BA /* JSONDebug.cpp in Sources */,
|
||||
BA01440912318DD6002575BA /* JSONIterators.cpp in Sources */,
|
||||
BA01440A12318DD6002575BA /* JSONMemory.cpp in Sources */,
|
||||
BA01440B12318DD6002575BA /* JSONNode.cpp in Sources */,
|
||||
BA01440C12318DD6002575BA /* JSONNode_Mutex.cpp in Sources */,
|
||||
BA01440D12318DD6002575BA /* JSONWorker.cpp in Sources */,
|
||||
BA01440E12318DD6002575BA /* JSONWriter.cpp in Sources */,
|
||||
BA01440F12318DD6002575BA /* libjson.cpp in Sources */,
|
||||
BA01441012318DD6002575BA /* main.cpp in Sources */,
|
||||
BA01441112318DD6002575BA /* TestAssign.cpp in Sources */,
|
||||
BA01441212318DD6002575BA /* TestChildren.cpp in Sources */,
|
||||
BA01441312318DD6002575BA /* TestComments.cpp in Sources */,
|
||||
BA01441412318DD6002575BA /* TestConverters.cpp in Sources */,
|
||||
BA01441512318DD6002575BA /* TestCtors.cpp in Sources */,
|
||||
BA01441612318DD6002575BA /* TestEquality.cpp in Sources */,
|
||||
BA01441712318DD6002575BA /* TestFunctions.cpp in Sources */,
|
||||
BA01441812318DD6002575BA /* TestInequality.cpp in Sources */,
|
||||
BA01441912318DD6002575BA /* TestInspectors.cpp in Sources */,
|
||||
BA01441A12318DD6002575BA /* TestIterators.cpp in Sources */,
|
||||
BA01441B12318DD6002575BA /* TestMutex.cpp in Sources */,
|
||||
BA01441C12318DD6002575BA /* TestNamespace.cpp in Sources */,
|
||||
BA01441D12318DD6002575BA /* TestRefCounting.cpp in Sources */,
|
||||
BA01441E12318DD6002575BA /* TestSuite.cpp in Sources */,
|
||||
BA01441F12318DD6002575BA /* TestWriter.cpp in Sources */,
|
||||
BA01442012318DD6002575BA /* UnitTest.cpp in Sources */,
|
||||
BAD89A2B128F00BB00E1D300 /* TestString.cpp in Sources */,
|
||||
BAB4249612AED5E700EA03D1 /* JSONValidator.cpp in Sources */,
|
||||
BA90E54112AEDB980064FE9F /* TestValidator.cpp in Sources */,
|
||||
BA07EB3112C8DF7E001AE448 /* JSONStream.cpp in Sources */,
|
||||
BA07EB3D12C8E402001AE448 /* TestStreams.cpp in Sources */,
|
||||
BABED9AE12C931230047E2DF /* TestBinary.cpp in Sources */,
|
||||
BAB51D521356503300C3349E /* JSONPreparse.cpp in Sources */,
|
||||
BA24981513C4F8880021B041 /* JSONAllocator.cpp in Sources */,
|
||||
BA7F532E146FF81E00FEEA70 /* json_encode64.cpp in Sources */,
|
||||
BA7F5339146FFC6200FEEA70 /* json_decode64.cpp in Sources */,
|
||||
BA7F5341146FFE4D00FEEA70 /* jsonSingleton.cpp in Sources */,
|
||||
BA7F53471470015D00FEEA70 /* getLenSize.cpp in Sources */,
|
||||
BA7F53551470076400FEEA70 /* _uitoa.cpp in Sources */,
|
||||
BA7F535F147007EC00FEEA70 /* _areFloatsEqual.cpp in Sources */,
|
||||
BA7F5360147007EC00FEEA70 /* _itoa.cpp in Sources */,
|
||||
BA7F53671470098B00FEEA70 /* _ftoa.cpp in Sources */,
|
||||
BA7F536B14700BD200FEEA70 /* isNumeric.cpp in Sources */,
|
||||
BA7F537414700E8900FEEA70 /* JSON_ASSERT_SAFE.cpp in Sources */,
|
||||
BA7F537714700E9D00FEEA70 /* JSON_ASSERT.cpp in Sources */,
|
||||
BA7F537A14700EBA00FEEA70 /* JSON_FAIL.cpp in Sources */,
|
||||
BA7F537D14700ECB00FEEA70 /* JSON_FAIL_SAFE.cpp in Sources */,
|
||||
BA7F538E14701E5D00FEEA70 /* isValidNumber.cpp in Sources */,
|
||||
BA7F539114701E6C00FEEA70 /* isValidMember.cpp in Sources */,
|
||||
BA7F539414701E7F00FEEA70 /* isValidString.cpp in Sources */,
|
||||
BA7F539714701E9100FEEA70 /* isValidNamedObject.cpp in Sources */,
|
||||
BA7F539A14701E9D00FEEA70 /* isValidObject.cpp in Sources */,
|
||||
BA7F539D14701EAE00FEEA70 /* isValidArray.cpp in Sources */,
|
||||
BA2A923214705B8B00609A62 /* securityTest.cpp in Sources */,
|
||||
BAA1135D147154E500166961 /* isValidPartialRoot.cpp in Sources */,
|
||||
BAA1135E147154E500166961 /* isValidRoot.cpp in Sources */,
|
||||
BAA11367147155D600166961 /* _atof.cpp in Sources */,
|
||||
BA3BBF4C147E8EBE004A159D /* RunTestSuite2.cpp in Sources */,
|
||||
BAD8A0CC1493A9F0005C4908 /* TestSharedString.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
1DEB923208733DC60010E9CD /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||
INSTALL_PATH = /usr/local/bin;
|
||||
PRODUCT_NAME = TestSuite;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
1DEB923308733DC60010E9CD /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||
INSTALL_PATH = /usr/local/bin;
|
||||
PRODUCT_NAME = TestSuite;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
1DEB923608733DC60010E9CD /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
|
||||
GCC_TREAT_NONCONFORMANT_CODE_ERRORS_AS_WARNINGS = YES;
|
||||
GCC_VERSION = "";
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
|
||||
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
|
||||
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_CHECK_SWITCH_STATEMENTS = YES;
|
||||
GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = YES;
|
||||
GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES;
|
||||
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
|
||||
GCC_WARN_MISSING_PARENTHESES = YES;
|
||||
GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES;
|
||||
GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
|
||||
GCC_WARN_PEDANTIC = YES;
|
||||
GCC_WARN_PROTOTYPE_CONVERSION = YES;
|
||||
GCC_WARN_SHADOW = YES;
|
||||
GCC_WARN_SIGN_COMPARE = YES;
|
||||
GCC_WARN_STRICT_SELECTOR_MATCH = YES;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNKNOWN_PRAGMAS = YES;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_LABEL = YES;
|
||||
GCC_WARN_UNUSED_PARAMETER = YES;
|
||||
GCC_WARN_UNUSED_VALUE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
GENERATE_PROFILING_CODE = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
RUN_CLANG_STATIC_ANALYZER = YES;
|
||||
SDKROOT = macosx;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
1DEB923708733DC60010E9CD /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_OPTIMIZATION_LEVEL = 3;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
1DEB923108733DC60010E9CD /* Build configuration list for PBXNativeTarget "TestSuite" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
1DEB923208733DC60010E9CD /* Debug */,
|
||||
1DEB923308733DC60010E9CD /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "TestSuite" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
1DEB923608733DC60010E9CD /* Debug */,
|
||||
1DEB923708733DC60010E9CD /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
|
||||
}
|
Binary file not shown.
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<Group
|
||||
location = "container:"
|
||||
name = "New Group">
|
||||
<FileRef
|
||||
location = "self:TestSuite.xcodeproj">
|
||||
</FileRef>
|
||||
</Group>
|
||||
</Workspace>
|
Binary file not shown.
File diff suppressed because it is too large
Load diff
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEWorkspaceUserSettings_HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges</key>
|
||||
<true/>
|
||||
<key>IDEWorkspaceUserSettings_SnapshotAutomaticallyBeforeSignificantChanges</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,35 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Bucket
|
||||
type = "1"
|
||||
version = "1.0">
|
||||
<FileBreakpoints>
|
||||
<FileBreakpoint
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
isPathRelative = "1"
|
||||
filePath = "/JSON_Base64/json_encode64.cpp"
|
||||
timestampString = "351808208.400934"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "10"
|
||||
endingLineNumber = "10"
|
||||
landmarkName = "testJSON_Base64__json_encode64::testReverseEachOther(void)"
|
||||
landmarkType = "5">
|
||||
</FileBreakpoint>
|
||||
<FileBreakpoint
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
isPathRelative = "1"
|
||||
filePath = "TestWriter.cpp"
|
||||
timestampString = "353942983.361924"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "165"
|
||||
endingLineNumber = "165"
|
||||
landmarkName = "TestSuite::TestWriter(void)"
|
||||
landmarkType = "5">
|
||||
</FileBreakpoint>
|
||||
</FileBreakpoints>
|
||||
</Bucket>
|
Binary file not shown.
Binary file not shown.
|
@ -1,72 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "8DD76F620486A84900D96B5E"
|
||||
BuildableName = "TestSuite"
|
||||
BlueprintName = "TestSuite"
|
||||
ReferencedContainer = "container:TestSuite.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
buildConfiguration = "Debug">
|
||||
<Testables>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Debug">
|
||||
<BuildableProductRunnable>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "8DD76F620486A84900D96B5E"
|
||||
BuildableName = "TestSuite"
|
||||
BlueprintName = "TestSuite"
|
||||
ReferencedContainer = "container:TestSuite.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Release">
|
||||
<BuildableProductRunnable>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "8DD76F620486A84900D96B5E"
|
||||
BuildableName = "TestSuite"
|
||||
BlueprintName = "TestSuite"
|
||||
ReferencedContainer = "container:TestSuite.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
|
@ -1,22 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>SchemeUserState</key>
|
||||
<dict>
|
||||
<key>TestSuite.xcscheme</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>SuppressBuildableAutocreation</key>
|
||||
<dict>
|
||||
<key>8DD76F620486A84900D96B5E</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
|
@ -1,74 +0,0 @@
|
|||
<?php
|
||||
|
||||
function endsWith($haystack, $needle){
|
||||
$length = strlen($needle);
|
||||
$start = $length * -1; //negative
|
||||
return (substr($haystack, $start) === $needle);
|
||||
}
|
||||
|
||||
function getFilesFromDir($dir, array & $files) {
|
||||
if ($handle = opendir($dir)) {
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if ($file != "." && $file != "..") {
|
||||
if(is_dir($dir.'/'.$file)) {
|
||||
$dir2 = $dir.'/'.$file;
|
||||
getFilesFromDir($dir2, $files);
|
||||
}
|
||||
else {
|
||||
if (endsWith(strtoupper($file), '.H')){
|
||||
$files[] = $dir.'/'.$file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
function getMethodsFromFile(&$runner, $file){
|
||||
if (($contents = file_get_contents($file)) !== false){
|
||||
//get the class name
|
||||
if (($pos = strpos($contents, 'class ')) !== false){
|
||||
if (($pos2 = strpos($contents, ':', $pos)) !== false){
|
||||
$class = trim(substr($contents, $pos + 6, $pos2 - $pos - 6));
|
||||
if (strpos($class, ' ') === false){
|
||||
$runner .= ' {' . PHP_EOL . ' ' . $class . ' ttt("' . $class . '");' . PHP_EOL;
|
||||
|
||||
//get the methods
|
||||
while(($pos = strpos($contents, 'void test', $pos)) !== false){
|
||||
$pos2 = strpos($contents, '(', $pos);
|
||||
$method = substr($contents, $pos + 5, $pos2 - $pos - 5);
|
||||
$runner .= ' RUNTEST(' . $method . ');' . PHP_EOL;
|
||||
$pos = $pos2;
|
||||
}
|
||||
$runner .= ' }' . PHP_EOL;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$runner .= ' //' . $file . ' cound not be opened' . PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
$array = array();
|
||||
getFilesFromDir(dirname(dirname(__FILE__)) . '/TestSuite2', $array);
|
||||
$runner = '#include "RunTestSuite2.h"' . PHP_EOL;
|
||||
foreach($array as $file){
|
||||
$runner .= '#include "' . $file . '"' . PHP_EOL;
|
||||
}
|
||||
$runner .= PHP_EOL . '#define RUNTEST(name) ttt.setUp(#name); ttt.name(); ttt.tearDown()' . PHP_EOL;
|
||||
$runner .= PHP_EOL . 'void RunTestSuite2::RunTests(void){' . PHP_EOL;
|
||||
|
||||
foreach($array as $file){
|
||||
getMethodsFromFile($runner, $file);
|
||||
}
|
||||
|
||||
|
||||
$runner .= '}' . PHP_EOL . PHP_EOL;
|
||||
if (file_put_contents(dirname(__FILE__) . '/RunTestSuite2.cpp', $runner) === false){
|
||||
echo 'Could not write to output file' . PHP_EOL;
|
||||
} else {
|
||||
echo 'Done' . PHP_EOL;
|
||||
}
|
|
@ -1,225 +0,0 @@
|
|||
#include "TestSuite.h"
|
||||
#include "../Source/JSONValidator.h"
|
||||
|
||||
|
||||
#define assertValid(x, method, nextchar)\
|
||||
{\
|
||||
json_string temp(JSON_TEXT(x));\
|
||||
const json_char * ptr = temp.c_str();\
|
||||
assertTrue(JSONValidator::method(ptr) && (*ptr == JSON_TEXT(nextchar)));\
|
||||
}
|
||||
|
||||
#define assertNotValid(x, method, nextchar)\
|
||||
{\
|
||||
json_string temp(JSON_TEXT(x));\
|
||||
const json_char * ptr = temp.c_str();\
|
||||
assertFalse(JSONValidator::method(ptr) && (*ptr == JSON_TEXT(nextchar)));\
|
||||
}
|
||||
|
||||
#ifdef JSON_SECURITY_MAX_NEST_LEVEL
|
||||
#define assertValid_Depth(x, method, nextchar)\
|
||||
{\
|
||||
json_string temp(JSON_TEXT(x));\
|
||||
const json_char * ptr = temp.c_str();\
|
||||
assertTrue(JSONValidator::method(ptr, 1));\
|
||||
assertEquals(*ptr, JSON_TEXT(nextchar));\
|
||||
}
|
||||
|
||||
#define assertNotValid_Depth(x, method, nextchar)\
|
||||
{\
|
||||
json_string temp(JSON_TEXT(x));\
|
||||
const json_char * ptr = temp.c_str();\
|
||||
assertFalse(JSONValidator::method(ptr, 1));\
|
||||
}
|
||||
#else
|
||||
#define assertValid_Depth(x, method, nextchar) assertValid(x, method, nextchar)
|
||||
#define assertNotValid_Depth(x, method, nextchar) assertNotValid(x, method, nextchar)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
void TestSuite::TestValidator(void){
|
||||
#ifdef JSON_VALIDATE
|
||||
|
||||
UnitTest::SetPrefix("TestValidator.cpp - Validator Root");
|
||||
assertTrue(JSONValidator::isValidRoot(JSON_TEXT("{}")));
|
||||
assertTrue(JSONValidator::isValidRoot(JSON_TEXT("[]")));
|
||||
assertFalse(JSONValidator::isValidRoot(JSON_TEXT("{]")));
|
||||
assertFalse(JSONValidator::isValidRoot(JSON_TEXT("[}")));
|
||||
assertFalse(JSONValidator::isValidRoot(JSON_TEXT("{}aoe")));
|
||||
assertFalse(JSONValidator::isValidRoot(JSON_TEXT("[]aoe")));
|
||||
assertFalse(JSONValidator::isValidRoot(JSON_TEXT("aoe")));
|
||||
assertFalse(JSONValidator::isValidRoot(JSON_TEXT("")));
|
||||
assertFalse(JSONValidator::isValidRoot(JSON_TEXT("[\"stuff\":{},]")));
|
||||
|
||||
UnitTest::SetPrefix("TestValidator.cpp - Validator Number");
|
||||
assertValid("123,\"next\"", isValidNumber, ',');
|
||||
assertValid("12.3,\"next\"", isValidNumber, ',');
|
||||
assertValid("0.123,\"next\"", isValidNumber, ',');
|
||||
assertValid("0,\"next\"", isValidNumber, ',');
|
||||
assertValid("0.,\"next\"", isValidNumber, ',');
|
||||
assertValid("0e123,\"next\"", isValidNumber, ',');
|
||||
assertValid("0e-123,\"next\"", isValidNumber, ',');
|
||||
assertValid("0e+123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("0e12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("0e-12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("0e+12.3,\"next\"", isValidNumber, ',');
|
||||
assertValid("1.e123,\"next\"", isValidNumber, ',');
|
||||
assertValid("1.e-123,\"next\"", isValidNumber, ',');
|
||||
assertValid("1.e+123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("1.e12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("1.e-12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("1.e+12.3,\"next\"", isValidNumber, ',');
|
||||
assertValid("1.0e123,\"next\"", isValidNumber, ',');
|
||||
assertValid("1.0e-123,\"next\"", isValidNumber, ',');
|
||||
assertValid("1.0e+123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("1.0e12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("1.0e-12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("1.0e+12.3,\"next\"", isValidNumber, ',');
|
||||
|
||||
assertValid("-123,\"next\"", isValidNumber, ',');
|
||||
assertValid("-12.3,\"next\"", isValidNumber, ',');
|
||||
assertValid("-0.123,\"next\"", isValidNumber, ',');
|
||||
assertValid("-0,\"next\"", isValidNumber, ',');
|
||||
assertValid("-0.,\"next\"", isValidNumber, ',');
|
||||
assertValid("-0e123,\"next\"", isValidNumber, ',');
|
||||
assertValid("-0e-123,\"next\"", isValidNumber, ',');
|
||||
assertValid("-0e+123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("-0e12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("-0e-12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("-0e+12.3,\"next\"", isValidNumber, ',');
|
||||
assertValid("-1.e123,\"next\"", isValidNumber, ',');
|
||||
assertValid("-1.e-123,\"next\"", isValidNumber, ',');
|
||||
assertValid("-1.e+123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("-1.e12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("-1.e-12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("-1.e+12.3,\"next\"", isValidNumber, ',');
|
||||
assertValid("-1.0e123,\"next\"", isValidNumber, ',');
|
||||
assertValid("-1.0e-123,\"next\"", isValidNumber, ',');
|
||||
assertValid("-1.0e+123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("-1.0e12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("-1.0e-12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("-1.0e+12.3,\"next\"", isValidNumber, ',');
|
||||
assertValid("0123,\"next\"", isValidNumber, ','); //legal when not strict because leading zeros are ignored
|
||||
#ifndef JSON_STRICT
|
||||
assertValid(".01,\"next\"", isValidNumber, ',');
|
||||
assertValid("-.01,\"next\"", isValidNumber, ',');
|
||||
assertValid("+123,\"next\"", isValidNumber, ',');
|
||||
assertValid("+12.3,\"next\"", isValidNumber, ',');
|
||||
assertValid("+0.123,\"next\"", isValidNumber, ',');
|
||||
assertValid("+0,\"next\"", isValidNumber, ',');
|
||||
assertValid("+0.,\"next\"", isValidNumber, ',');
|
||||
assertValid("+0e123,\"next\"", isValidNumber, ',');
|
||||
assertValid("+0e-123,\"next\"", isValidNumber, ',');
|
||||
assertValid("+0e+123,\"next\"", isValidNumber, ',');
|
||||
assertValid("+1.e123,\"next\"", isValidNumber, ',');
|
||||
assertValid("+1.e-123,\"next\"", isValidNumber, ',');
|
||||
assertValid("+1.e+123,\"next\"", isValidNumber, ',');
|
||||
assertValid("+1.0e123,\"next\"", isValidNumber, ',');
|
||||
assertValid("+1.0e-123,\"next\"", isValidNumber, ',');
|
||||
assertValid("+1.0e+123,\"next\"", isValidNumber, ',');
|
||||
assertValid("0x12FF,\"next\"", isValidNumber, ',');
|
||||
#ifdef JSON_OCTAL
|
||||
assertNotValid("0128,\"next\"", isValidNumber, ','); //because of the 8
|
||||
#else
|
||||
assertValid("0128,\"next\"", isValidNumber, ','); //because the leading 0 is ignored
|
||||
#endif
|
||||
#else
|
||||
assertNotValid(".01,\"next\"", isValidNumber, ','); //no leading 0 as required by the standard
|
||||
assertNotValid("-.01,\"next\"", isValidNumber, ','); //no leading 0 as required by the standard
|
||||
assertNotValid("+123,\"next\"", isValidNumber, ','); //no leading +
|
||||
assertNotValid("+12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+0.123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+0,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+0.,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+0e123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+0e-123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+0e+123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1.e123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1.e-123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1.e+123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1.0e123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1.0e-123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1.0e+123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("0x12FF,\"next\"", isValidNumber, ',');
|
||||
assertValid("0128,\"next\"", isValidNumber, ','); //legal because in STRICT mode, this is not octal
|
||||
#endif
|
||||
assertNotValid("+1.0e12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1.0e-12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1.0e+12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1.e12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1.e-12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1.e+12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+0e12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+0e-12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+0e+12.3,\"next\"", isValidNumber, ',');
|
||||
|
||||
UnitTest::SetPrefix("TestValidator.cpp - Validator String");
|
||||
assertValid("hello\":123", isValidString, ':');
|
||||
assertValid("he\\\"ll\\\"o\":123", isValidString, ':');
|
||||
assertValid("he\\u1234llo\":123", isValidString, ':');
|
||||
assertValid("he\\u0FFFllo\":123", isValidString, ':');
|
||||
assertNotValid("he\\uFFFGllo\":123", isValidString, ':');
|
||||
#ifndef JSON_STRICT
|
||||
assertValid("he\\xFFllo\":123", isValidString, ':');
|
||||
#ifdef JSON_OCTAL
|
||||
assertValid("he\\0123llo\":123", isValidString, ':');
|
||||
#else
|
||||
assertNotValid("he\\0123llo\":123", isValidString, ':');
|
||||
#endif
|
||||
#else
|
||||
assertNotValid("he\\xFFllo\":123", isValidString, ':');
|
||||
assertNotValid("he\\0123llo\":123", isValidString, ':');
|
||||
#endif
|
||||
assertNotValid("he\\128llo\":123", isValidString, ':'); //not valid even when not strict because of the 8
|
||||
assertNotValid("he\\", isValidString, ':');
|
||||
assertNotValid("he\\\"", isValidString, ':');
|
||||
assertNotValid("he\\\"llo\\\"", isValidString, ':');
|
||||
assertNotValid("hello", isValidString, ':');
|
||||
|
||||
|
||||
UnitTest::SetPrefix("TestValidator.cpp - Validator Member");
|
||||
assertValid_Depth("true,", isValidMember, ',');
|
||||
assertNotValid_Depth("tru,", isValidMember, ',');
|
||||
assertValid_Depth("false,", isValidMember, ',');
|
||||
assertNotValid_Depth("fals,", isValidMember, ',');
|
||||
assertValid_Depth("null,", isValidMember, ',');
|
||||
assertNotValid_Depth("nul,", isValidMember, ',');
|
||||
assertNotValid_Depth("", isValidMember, ',');
|
||||
#ifndef JSON_STRICT
|
||||
assertValid_Depth("TRUE,", isValidMember, ',');
|
||||
assertValid_Depth("FALSE,", isValidMember, ',');
|
||||
assertValid_Depth("NULL,", isValidMember, ',');
|
||||
assertValid_Depth(",", isValidMember, ',');
|
||||
#else
|
||||
assertNotValid_Depth("TRUE,", isValidMember, ',');
|
||||
assertNotValid_Depth("FALSE,", isValidMember, ',');
|
||||
assertNotValid_Depth("NULL,", isValidMember, ',');
|
||||
assertNotValid_Depth(",", isValidMember, ',');
|
||||
#endif
|
||||
|
||||
UnitTest::SetPrefix("TestValidator.cpp - Validator Security");
|
||||
#ifdef JSON_SECURITY_MAX_NEST_LEVEL
|
||||
#if (JSON_SECURITY_MAX_NEST_LEVEL != 128)
|
||||
#error, test suite only wants a nest security level of 100
|
||||
#endif
|
||||
{
|
||||
json_string json(JSON_TEXT("{"));
|
||||
for(unsigned int i = 0; i < 127; ++i){
|
||||
json += JSON_TEXT("\"n\":{");
|
||||
}
|
||||
json += json_string(128, '}');
|
||||
assertTrue(JSONValidator::isValidRoot(json.c_str()));
|
||||
}
|
||||
{
|
||||
json_string json(JSON_TEXT("{"));
|
||||
for(unsigned int i = 0; i < 128; ++i){
|
||||
json += JSON_TEXT("\"n\":{");
|
||||
}
|
||||
json += json_string(129, '}');
|
||||
assertFalse(JSONValidator::isValidRoot(json.c_str()));
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
|
@ -1,169 +0,0 @@
|
|||
#include "TestSuite.h"
|
||||
|
||||
#ifdef JSON_WRITE_PRIORITY
|
||||
extern bool used_ascii_one;
|
||||
|
||||
void myDoTests(bool asciichar);
|
||||
void myDoTests(bool asciichar){
|
||||
used_ascii_one = asciichar;
|
||||
#ifdef JSON_LIBRARY
|
||||
#define assertWrite(node, func, expected)\
|
||||
{\
|
||||
json_char * _temp = func(node);\
|
||||
assertCStringSame(_temp, expected);\
|
||||
json_free(_temp);\
|
||||
}
|
||||
|
||||
JSONNODE * test1 = json_new(JSON_NODE);
|
||||
assertWrite(test1, json_write, JSON_TEXT("{}"));
|
||||
json_push_back(test1, json_new_a(JSON_TEXT("Hello"), JSON_TEXT("World")));
|
||||
json_push_back(test1, json_new_b(JSON_TEXT("libjson"), true));
|
||||
|
||||
assertWrite(test1, json_write, JSON_TEXT("{\"Hello\":\"World\",\"libjson\":true}"));
|
||||
#ifdef JSON_NEWLINE
|
||||
assertEquals(JSON_NEWLINE, JSON_TEXT("\r\n"));
|
||||
#ifdef JSON_INDENT
|
||||
assertEquals(JSON_INDENT, JSON_TEXT(" "))
|
||||
assertWrite(test1, json_write_formatted, JSON_TEXT("{\r\n \"Hello\" : \"World\",\r\n \"libjson\" : true\r\n}"));
|
||||
#else
|
||||
assertWrite(test1, json_write_formatted, JSON_TEXT("{\r\n\t\"Hello\" : \"World\",\r\n\t\"libjson\" : true\r\n}"));
|
||||
#endif
|
||||
#else
|
||||
#ifdef JSON_INDENT
|
||||
assertEquals(JSON_INDENT, JSON_TEXT(" "))
|
||||
assertWrite(test1, json_write_formatted, JSON_TEXT("{\n \"Hello\" : \"World\",\n \"libjson\" : true\n}"));
|
||||
#else
|
||||
assertWrite(test1, json_write_formatted, JSON_TEXT("{\n\t\"Hello\" : \"World\",\n\t\"libjson\" : true\n}"));
|
||||
#endif
|
||||
#endif
|
||||
json_delete(test1);
|
||||
|
||||
JSONNODE * test2 = json_new(JSON_ARRAY);
|
||||
assertWrite(test2, json_write, JSON_TEXT("[]"));
|
||||
json_delete(test2);
|
||||
|
||||
|
||||
JSONNODE * card = json_new(JSON_ARRAY);
|
||||
JSONNODE *c = json_new(JSON_ARRAY);
|
||||
json_push_back(c, json_new_a(JSON_TEXT("name"), JSON_TEXT("Entr\033e Audio Int\033gr\033e 1")));
|
||||
json_push_back(c, json_new_i(NULL, 0));
|
||||
json_push_back(card, c);
|
||||
#ifdef JSON_READ_PRIORITY
|
||||
#ifndef JSON_ESCAPE_WRITES
|
||||
assertWrite(card, json_write, JSON_TEXT("[[\"Entr\033e Audio Int\033gr\033e 1\",0]]"))
|
||||
JSONNODE * ass = json_parse(JSON_TEXT("[[\"Entr\033e Audio Int\033gr\033e 1\",0]]"));
|
||||
#else
|
||||
assertWrite(card, json_write, JSON_TEXT("[[\"Entr\\u001Be Audio Int\\u001Bgr\\u001Be 1\",0]]"))
|
||||
JSONNODE * ass = json_parse(JSON_TEXT("[[\"Entr\\u001Be Audio Int\\u001Bgr\\u001Be 1\",0]]"));
|
||||
#endif
|
||||
JSONNODE * item = json_at(json_at(ass, 0), 0);
|
||||
assertWrite(item, json_as_string, JSON_TEXT("Entr\033e Audio Int\033gr\033e 1"));
|
||||
json_delete(ass);
|
||||
#endif
|
||||
json_delete(card);
|
||||
|
||||
|
||||
#ifdef JSON_COMMENTS
|
||||
JSONNODE * test3 = json_new(JSON_NODE);
|
||||
json_push_back(test3, json_new_a(JSON_TEXT("Hi"), JSON_TEXT("\\There\\")));
|
||||
json_push_back(test3, json_new_a(JSON_TEXT("Hello"), JSON_TEXT("World")));
|
||||
json_set_comment(json_at(test3, 0), JSON_TEXT("Testing stuff"));
|
||||
json_set_comment(json_at(test3, 1), JSON_TEXT("Multi\r\nLine\nUnix and Windows"));
|
||||
assertWrite(test3, json_write, JSON_TEXT("{\"Hi\":\"\\\\There\\\\\",\"Hello\":\"World\"}"));
|
||||
#if !defined( JSON_INDENT) && !defined(JSON_NEWLINE)
|
||||
#ifdef JSON_WRITE_BASH_COMMENTS
|
||||
assertWrite(test3, json_write_formatted, JSON_TEXT("{\n\t\n\t#Testing stuff\n\t\"Hi\" : \"\\\\There\\\\\",\n\t\n\t#Multi\n\t#Line\n\t#Unix and Windows\n\t\"Hello\" : \"World\"\n}"));
|
||||
#elif defined(JSON_WRITE_SINGLE_LINE_COMMENTS)
|
||||
assertWrite(test3, json_write_formatted, JSON_TEXT("{\n\t\n\t//Testing stuff\n\t\"Hi\" : \"\\\\There\\\\\",\n\t\n\t//Multi\n\t//Line\n\t//Unix and Windows\n\t\"Hello\" : \"World\"\n}"));
|
||||
#else
|
||||
assertWrite(test3, json_write_formatted, JSON_TEXT("{\n\t\n\t//Testing stuff\n\t\"Hi\" : \"\\\\There\\\\\",\n\t\n\t/*\n\t\tMulti\n\t\tLine\n\t\tUnix and Windows\n\t*/\n\t\"Hello\" : \"World\"\n}"));
|
||||
#endif
|
||||
#endif
|
||||
json_delete(test3);
|
||||
#endif
|
||||
|
||||
#ifdef JSON_ARRAY_SIZE_ON_ONE_LINE
|
||||
#if (JSON_ARRAY_SIZE_ON_ONE_LINE == 2)
|
||||
JSONNODE * arrarrr = json_new(JSON_ARRAY);
|
||||
json_push_back(arrarrr, json_new_i(JSON_TEXT(""), 12));
|
||||
json_push_back(arrarrr, json_new_i(JSON_TEXT(""), 8));
|
||||
assertWrite(arrarrr, json_write_formatted, JSON_TEXT("[12, 8]"));
|
||||
assertWrite(arrarrr, json_write, JSON_TEXT("[12,8]"));
|
||||
json_delete(arrarrr);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#else
|
||||
JSONNode test1(JSON_NODE);
|
||||
assertEquals(test1.write(), JSON_TEXT("{}"));
|
||||
test1.push_back(JSONNode(JSON_TEXT("Hello"), JSON_TEXT("\\World\\")));
|
||||
test1.push_back(JSONNode(JSON_TEXT("libjson"), true));
|
||||
assertEquals(test1.write(), JSON_TEXT("{\"Hello\":\"\\\\World\\\\\",\"libjson\":true}"));
|
||||
#ifdef JSON_NEWLINE
|
||||
assertEquals(JSON_NEWLINE, JSON_TEXT("\r\n"));
|
||||
#ifdef JSON_INDENT
|
||||
assertEquals(JSON_INDENT, JSON_TEXT(" "))
|
||||
assertEquals(test1.write_formatted(), JSON_TEXT("{\r\n \"Hello\" : \"\\\\World\\\\\",\r\n \"libjson\" : true\r\n}"));
|
||||
#else
|
||||
assertEquals(test1.write_formatted(), JSON_TEXT("{\r\n\t\"Hello\" : \"\\\\World\\\\\",\r\n\t\"libjson\" : true\r\n}"));
|
||||
#endif
|
||||
#else
|
||||
#ifdef JSON_INDENT
|
||||
assertEquals(JSON_INDENT, JSON_TEXT(" "))
|
||||
assertEquals(test1.write_formatted(), JSON_TEXT("{\n \"Hello\" : \"\\\\World\\\\\",\n \"libjson\" : true\n}"));
|
||||
#else
|
||||
assertEquals(test1.write_formatted(), JSON_TEXT("{\n\t\"Hello\" : \"\\\\World\\\\\",\n\t\"libjson\" : true\n}"));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
JSONNode test2(JSON_ARRAY);
|
||||
assertEquals(test2.write(), JSON_TEXT("[]"));
|
||||
|
||||
#ifdef JSON_COMMENTS
|
||||
JSONNode test3(JSON_NODE);
|
||||
test3.push_back(JSONNode(JSON_TEXT("Hi"), JSON_TEXT("There")));
|
||||
test3.push_back(JSONNode(JSON_TEXT("Hello"), JSON_TEXT("World")));
|
||||
test3[0].set_comment(JSON_TEXT("Testing stuff"));
|
||||
test3[1].set_comment(JSON_TEXT("Multi\r\nLine\nUnix and Windows"));
|
||||
assertEquals(test3.write(), JSON_TEXT("{\"Hi\":\"There\",\"Hello\":\"World\"}"));
|
||||
#if !defined( JSON_INDENT) && !defined(JSON_NEWLINE)
|
||||
#ifdef JSON_WRITE_BASH_COMMENTS
|
||||
assertEquals(test3.write_formatted(), JSON_TEXT("{\n\t\n\t#Testing stuff\n\t\"Hi\" : \"There\",\n\t\n\t#Multi\n\t#Line\n\t#Unix and Windows\n\t\"Hello\" : \"World\"\n}"));
|
||||
#elif defined(JSON_WRITE_SINGLE_LINE_COMMENTS)
|
||||
assertEquals(test3.write_formatted(), JSON_TEXT("{\n\t\n\t//Testing stuff\n\t\"Hi\" : \"There\",\n\t\n\t//Multi\n\t//Line\n\t//Unix and Windows\n\t\"Hello\" : \"World\"\n}"));
|
||||
#else
|
||||
assertEquals(test3.write_formatted(), JSON_TEXT("{\n\t\n\t//Testing stuff\n\t\"Hi\" : \"There\",\n\t\n\t/*\n\t\tMulti\n\t\tLine\n\t\tUnix and Windows\n\t*/\n\t\"Hello\" : \"World\"\n}"));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef JSON_READ_PRIORITY
|
||||
used_ascii_one = asciichar;
|
||||
const json_char * str = JSON_TEXT("{ \"mt\":\"\\\"str\\\"\" }"); // str={"mt":"\"str\""}
|
||||
json_string check = libjson::strip_white_space(str);
|
||||
assertEquals(check, JSON_TEXT("{\"mt\":\"\\\"str\\\"\"}"));
|
||||
|
||||
used_ascii_one = asciichar;
|
||||
JSONNode obj = libjson::parse(str);
|
||||
json_string objstr = obj.write();
|
||||
assertEquals(objstr, JSON_TEXT("{\"mt\":\"\\\"str\\\"\"}"));
|
||||
|
||||
|
||||
UnitTest::SetPrefix("TestWriter.cpp - ascii one char");
|
||||
used_ascii_one = asciichar;
|
||||
JSONNode n = libjson::parse(JSON_TEXT("[ \"I said: \\\"foo!\\\"\" ]"));
|
||||
json_string result = n.write_formatted();
|
||||
assertEquals(result, JSON_TEXT("[\n\t\"I said: \\\"foo!\\\"\"\n]"));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void TestSuite::TestWriter(void){
|
||||
UnitTest::SetPrefix("TestWriter.cpp - Writing (no ascii one)");
|
||||
myDoTests(false);
|
||||
|
||||
UnitTest::SetPrefix("TestWriter.cpp - Writing (yes ascii one)");
|
||||
myDoTests(true);
|
||||
}
|
||||
#endif
|
|
@ -1,298 +0,0 @@
|
|||
#ifndef USTRING_TEST_H
|
||||
#define USTRING_TEST_H
|
||||
|
||||
/*
|
||||
* Developer note: This is not a fully functionaly string and is not meant to be used as such.
|
||||
* It is merely to serve as a testing module
|
||||
*/
|
||||
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
#include <cwchar> //need wide characters
|
||||
#include <iostream>
|
||||
|
||||
typedef wchar_t mychar;
|
||||
|
||||
static size_t mystrlen(const mychar * str){
|
||||
unsigned int i = 0;
|
||||
for(const mychar * it = str; *it; ++it, ++i){
|
||||
//dummy
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
class json_string {
|
||||
public:
|
||||
struct const_iterator {
|
||||
inline const_iterator& operator ++(void) { ++it; return *this; }
|
||||
inline const_iterator& operator --(void) { --it; return *this; }
|
||||
inline const_iterator& operator +=(long i) { it += i; return *this; }
|
||||
inline const_iterator& operator -=(long i) { it -= i; return *this; }
|
||||
inline const_iterator operator ++(int) {
|
||||
const_iterator result(*this);
|
||||
++it;
|
||||
return result;
|
||||
}
|
||||
inline const_iterator operator --(int) {
|
||||
const_iterator result(*this);
|
||||
--it;
|
||||
return result;
|
||||
}
|
||||
inline const_iterator operator +(long i) const {
|
||||
const_iterator result(*this);
|
||||
result.it += i;
|
||||
return result;
|
||||
}
|
||||
inline const_iterator operator -(long i) const {
|
||||
const_iterator result(*this);
|
||||
result.it -= i;
|
||||
return result;
|
||||
}
|
||||
inline size_t operator -(const_iterator other) const {
|
||||
return it - other.it;
|
||||
}
|
||||
inline mychar & operator [](size_t pos) const { return it[pos]; };
|
||||
inline mychar & operator *(void) const { return *it; }
|
||||
inline bool operator == (const const_iterator & other) const { return it == other.it; }
|
||||
inline bool operator != (const const_iterator & other) const { return it != other.it; }
|
||||
inline bool operator > (const const_iterator & other) const { return it > other.it; }
|
||||
inline bool operator >= (const const_iterator & other) const { return it >= other.it; }
|
||||
inline bool operator < (const const_iterator & other) const { return it < other.it; }
|
||||
inline bool operator <= (const const_iterator & other) const { return it <= other.it; }
|
||||
inline const_iterator & operator = (const const_iterator & orig) { it = orig.it; return *this; }
|
||||
const_iterator (const const_iterator & orig) : it(orig.it) {}
|
||||
const_iterator (const mychar * place) : it((mychar*)place) {}
|
||||
const_iterator(void) : it(0) {};
|
||||
|
||||
mychar * it;
|
||||
};
|
||||
|
||||
struct iterator {
|
||||
inline iterator& operator ++(void) { ++it; return *this; }
|
||||
inline iterator& operator --(void) { --it; return *this; }
|
||||
inline iterator& operator +=(long i) { it += i; return *this; }
|
||||
inline iterator& operator -=(long i) { it -= i; return *this; }
|
||||
inline iterator operator ++(int) {
|
||||
iterator result(*this);
|
||||
++it;
|
||||
return result;
|
||||
}
|
||||
inline iterator operator --(int) {
|
||||
iterator result(*this);
|
||||
--it;
|
||||
return result;
|
||||
}
|
||||
inline iterator operator +(long i) const {
|
||||
iterator result(*this);
|
||||
result.it += i;
|
||||
return result;
|
||||
}
|
||||
inline iterator operator -(long i) const {
|
||||
iterator result(*this);
|
||||
result.it -= i;
|
||||
return result;
|
||||
}
|
||||
inline mychar & operator [](size_t pos) const { return it[pos]; };
|
||||
inline mychar & operator *(void) const { return *it; }
|
||||
inline bool operator == (const iterator & other) const { return it == other.it; }
|
||||
inline bool operator != (const iterator & other) const { return it != other.it; }
|
||||
inline bool operator > (const iterator & other) const { return it > other.it; }
|
||||
inline bool operator >= (const iterator & other) const { return it >= other.it; }
|
||||
inline bool operator < (const iterator & other) const { return it < other.it; }
|
||||
inline bool operator <= (const iterator & other) const { return it <= other.it; }
|
||||
inline iterator & operator = (const iterator & orig) { it = orig.it; return *this; }
|
||||
inline operator const_iterator() const json_nothrow { return const_iterator(it); }
|
||||
iterator (const iterator & orig) : it(orig.it) {}
|
||||
iterator (const mychar * place) : it((mychar*)place) {}
|
||||
|
||||
mychar * it;
|
||||
};
|
||||
|
||||
|
||||
const static size_t npos = 0xFFFFFFFF;
|
||||
json_string(void) : len(0), str(0){
|
||||
setToCStr(L"", 0);
|
||||
}
|
||||
|
||||
json_string(const mychar * meh) : len(0), str(0){
|
||||
setToCStr(meh, mystrlen(meh));
|
||||
}
|
||||
|
||||
json_string(const mychar * meh, size_t l) : len(l), str(0){
|
||||
setToCStr(meh, l);
|
||||
str[len] = '\0';
|
||||
}
|
||||
|
||||
json_string(const iterator & beg, const iterator & en) : len(0), str(0){
|
||||
setToCStr(beg.it, en.it - beg.it);
|
||||
str[len] = '\0';
|
||||
}
|
||||
|
||||
json_string(const const_iterator & beg, const const_iterator & en) : len(0), str(0){
|
||||
setToCStr(beg.it, en.it - beg.it);
|
||||
str[len] = '\0';
|
||||
}
|
||||
|
||||
json_string(const json_string & meh) : len(0), str(0){
|
||||
setToCStr(meh.c_str(), meh.len);
|
||||
}
|
||||
|
||||
~json_string(void){ std::free(str); };
|
||||
|
||||
json_string(unsigned int l, mychar meh) : len(0), str(0){
|
||||
str = (mychar*)std::malloc((l + 1) * sizeof(mychar));
|
||||
len = l;
|
||||
for (unsigned int i = 0; i < l; ++i){
|
||||
str[i] = meh;
|
||||
}
|
||||
str[l] = L'\0';
|
||||
}
|
||||
|
||||
void swap(json_string & meh){
|
||||
size_t _len = len;
|
||||
mychar * _str = str;
|
||||
len = meh.len;
|
||||
str = meh.str;
|
||||
meh.len = _len;
|
||||
meh.str = _str;
|
||||
}
|
||||
|
||||
iterator begin(void){ return iterator(str); };
|
||||
iterator end(void){ return iterator(str + length()); };
|
||||
const iterator begin(void) const { return iterator(str); };
|
||||
const iterator end(void) const { return iterator(str + length()); };
|
||||
void assign(const iterator & beg, const iterator & en){
|
||||
json_string(beg, en).swap(*this);
|
||||
}
|
||||
json_string & append(const iterator & beg, const iterator & en){
|
||||
json_string temp(beg, en);
|
||||
return *this += temp;
|
||||
}
|
||||
|
||||
const mychar * c_str(void) const { return str; };
|
||||
const mychar * data(void) const { return str; };
|
||||
size_t length(void) const { return len; };
|
||||
size_t capacity(void) const { return len; };
|
||||
bool empty(void) const { return len == 0; };
|
||||
|
||||
bool operator ==(const json_string & other) const {
|
||||
if (len != other.len) return false;
|
||||
return memcmp(str, other.str, len * sizeof(mychar)) == 0;
|
||||
}
|
||||
|
||||
bool operator !=(const json_string & other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
const wchar_t & operator[] (size_t pos) const { return str[pos]; }
|
||||
wchar_t & operator[] ( size_t pos ){ return str[pos]; }
|
||||
|
||||
json_string & operator = (const json_string & meh) {
|
||||
std::free(str);
|
||||
setToCStr(meh.c_str(), meh.len);
|
||||
return *this;
|
||||
}
|
||||
|
||||
json_string & operator = (const mychar * meh) {
|
||||
std::free(str);
|
||||
setToCStr(meh, mystrlen(meh));
|
||||
return *this;
|
||||
}
|
||||
|
||||
json_string & operator += (const json_string & other) {
|
||||
size_t newlen = len + other.len;
|
||||
mychar * newstr = (mychar*)std::malloc((newlen + 1) * sizeof(mychar));
|
||||
std::memcpy(newstr, str, len * sizeof(mychar));
|
||||
std::memcpy(newstr + len, other.str, (other.len + 1) * sizeof(mychar));
|
||||
len = newlen;
|
||||
std::free(str);
|
||||
str = newstr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const json_string operator + (const json_string & other) const {
|
||||
json_string result = *this;
|
||||
result += other;
|
||||
return result;
|
||||
}
|
||||
|
||||
json_string & operator += (const mychar other) {
|
||||
mychar temp[2] = {other, L'\0'};
|
||||
json_string temp_s(temp);
|
||||
return (*this) += temp_s;
|
||||
}
|
||||
|
||||
const json_string operator + (const mychar other) const {
|
||||
json_string result = *this;
|
||||
result += other;
|
||||
return result;
|
||||
}
|
||||
|
||||
void reserve(size_t){}; //noop, its just a test
|
||||
void clear(void){setToCStr(L"", 0);}
|
||||
|
||||
json_string substr(size_t pos = 0, size_t n = npos) const {
|
||||
json_string res(false, false, false);
|
||||
if (n > len) n = len;
|
||||
if (n + pos > len) n = len - pos;
|
||||
res.setToCStr(str + pos, n);
|
||||
res.str[n] = L'\0';
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
size_t find ( mychar c, size_t pos = 0 ) const {
|
||||
if (pos > len) return npos;
|
||||
for(mychar * i = str + pos; *i; ++i){
|
||||
if (*i == c) return i - str;
|
||||
}
|
||||
return npos;
|
||||
}
|
||||
|
||||
size_t find_first_not_of ( const mychar* s, size_t pos = 0 ) const {
|
||||
if (pos > len) return npos;
|
||||
for(mychar * i = str + pos; *i; ++i){
|
||||
bool found = false;
|
||||
for(const mychar * k = s; *k; ++k){
|
||||
if (*i == *k){
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) return i - str;
|
||||
}
|
||||
return npos;
|
||||
}
|
||||
|
||||
size_t find_first_of ( const mychar* s, size_t pos = 0 ) const {
|
||||
if (pos > len) return npos;
|
||||
for(mychar * i = str + pos; *i; ++i){
|
||||
for(const mychar * k = s; *k; ++k){
|
||||
if (*i == *k){
|
||||
return i - str;
|
||||
}
|
||||
}
|
||||
}
|
||||
return npos;
|
||||
}
|
||||
|
||||
iterator erase(iterator it, iterator it2){
|
||||
size_t mov = it2.it - it.it;
|
||||
std::memmove(str, it2.it, (len - mov + 1) * sizeof(mychar)); //+1 for null terminator
|
||||
len -= mov;
|
||||
return it;
|
||||
}
|
||||
private:
|
||||
json_string(bool, bool, bool) : len(0), str(0){};
|
||||
|
||||
void setToCStr(const mychar * st, size_t l){
|
||||
len = l;
|
||||
str = (mychar*)std::memcpy(std::malloc((len + 1) * sizeof(mychar)), st, (len + 1) * sizeof(mychar));
|
||||
}
|
||||
|
||||
size_t len;
|
||||
mychar * str;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,176 +0,0 @@
|
|||
#include "UnitTest.h"
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
#include <ctime>
|
||||
#include <cstdlib>
|
||||
|
||||
std::vector<std::string> Fails;
|
||||
std::vector<std::string> All;
|
||||
bool ReturnOnFail = false;
|
||||
bool Echo = true;
|
||||
std::string Prefix;
|
||||
clock_t started = 0;
|
||||
#if (!defined(CLOCKS_PER_SEC))
|
||||
#define noTimeFormatting
|
||||
#endif
|
||||
|
||||
std::string timing();
|
||||
std::string timing(){
|
||||
clock_t clockticks = clock() - started;
|
||||
std::stringstream out;
|
||||
|
||||
|
||||
if (CLOCKS_PER_SEC == 1000000){
|
||||
if (clockticks < 10000){
|
||||
out << clockticks << " microseconds";
|
||||
return out.str();
|
||||
} else if (clockticks < 10000000){
|
||||
out << clockticks / 1000 << " milliseconds";
|
||||
return out.str();
|
||||
}
|
||||
} else if (CLOCKS_PER_SEC == 1000){
|
||||
if (clockticks < 10000){
|
||||
out << clockticks << " milliseconds";
|
||||
return out.str();
|
||||
}
|
||||
} else {
|
||||
out << clockticks << " clockticks";
|
||||
return out.str();
|
||||
}
|
||||
|
||||
#ifndef noTimeFormatting
|
||||
if ((CLOCKS_PER_SEC == 1000000) || (CLOCKS_PER_SEC == 1000)){
|
||||
clock_t seconds = clockticks / CLOCKS_PER_SEC;
|
||||
if (seconds < 60){
|
||||
out << seconds << " seconds";
|
||||
} else if (seconds < 7200) {
|
||||
out << seconds / 60 << " minutes";
|
||||
} else {
|
||||
out << seconds / 3600 << " hours";
|
||||
}
|
||||
return out.str();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void UnitTest::SelfCheck(void){
|
||||
assertTrue(true);
|
||||
assertFalse(false);
|
||||
assertEquals(1, 1);
|
||||
assertNotEquals(1, 0);
|
||||
|
||||
assertGreaterThan(1, 0);
|
||||
assertGreaterThanEqualTo(1, 0);
|
||||
assertGreaterThanEqualTo(1, 1);
|
||||
|
||||
assertLessThan(0, 1);
|
||||
assertLessThanEqualTo(0, 1);
|
||||
assertLessThanEqualTo(1, 1);
|
||||
|
||||
assertCStringEquals("Hello", "Hello");
|
||||
assertCStringNotEquals("Hello", "World");
|
||||
|
||||
assertCStringEqualsW(L"Hello", L"Hello");
|
||||
assertCStringNotEqualsW(L"Hello", L"World");
|
||||
|
||||
std::vector<std::string> exception_Test;
|
||||
assertException(std::string res = exception_Test.at(15), std::out_of_range);
|
||||
}
|
||||
|
||||
std::string fix(const std::string & str);
|
||||
std::string fix(const std::string & str){
|
||||
std::string fff(str);
|
||||
size_t pos = fff.find('\n');
|
||||
while(pos != std::string::npos){
|
||||
fff = fff.substr(0, pos) + "\\n" + fff.substr(pos + 1);
|
||||
pos = fff.find('\n', pos + 1);
|
||||
}
|
||||
pos = fff.find('\t');
|
||||
while(pos != std::string::npos){
|
||||
fff = fff.substr(0, pos) + "\\t" + fff.substr(pos + 1);
|
||||
pos = fff.find('\t', pos + 1);
|
||||
}
|
||||
pos = fff.find('\r');
|
||||
while(pos != std::string::npos){
|
||||
fff = fff.substr(0, pos) + "\\r" + fff.substr(pos + 1);
|
||||
pos = fff.find('\r', pos + 1);
|
||||
}
|
||||
pos = fff.find('\"');
|
||||
while(pos != std::string::npos){
|
||||
fff = fff.substr(0, pos) + "\\\"" + fff.substr(pos + 1);
|
||||
pos = fff.find('\"', pos + 2);
|
||||
}
|
||||
return fff;
|
||||
}
|
||||
|
||||
void UnitTest::PushFailure(const std::string & fail){
|
||||
Fails.push_back(fail);
|
||||
if (test_likely(Echo)) std::cout << fail << std::endl;
|
||||
All.push_back(std::string("<b style=\"color:#000000;background:#FF0000\">") + fail + "</b><br>");
|
||||
}
|
||||
|
||||
void UnitTest::PushSuccess(const std::string & pass){
|
||||
All.push_back(std::string("<b style=\"color:#000000;background:#00FF00\">") + pass + "</b><br>");
|
||||
}
|
||||
|
||||
std::string UnitTest::ToString(void){
|
||||
std::stringstream out;
|
||||
out << "Number of failed tests: " << Fails.size();
|
||||
std::string result(out.str());
|
||||
for(std::vector<std::string>::iterator it = Fails.begin(), end = Fails.end(); it != end; ++it){
|
||||
result += *it;
|
||||
result += "\n";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string UnitTest::ToHTML(void){
|
||||
std::string result("<html><head><title>Test Suite Results</title></head><body><a style=\"font-size:14\">");
|
||||
std::stringstream out;
|
||||
out << "Passed Tests: <c style=\"color:#00CC00\">" << All.size() - Fails.size() << "</c><br>Failed Tests: <c style=\"color:#CC0000\">" << Fails.size() << "</c><br>Total Tests: " << All.size() << "<br>";
|
||||
if (test_likely(started)){
|
||||
out << "Elapsed time: " << timing() << "<br><br>";
|
||||
} else {
|
||||
out << "<br>";
|
||||
}
|
||||
result += out.str();
|
||||
for(std::vector<std::string>::iterator it = All.begin(), end = All.end(); it != end; ++it){
|
||||
result += *it;
|
||||
}
|
||||
return result + "</a></body></html>";
|
||||
}
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
void UnitTest::SaveTo(const std::string & location){
|
||||
FILE * fp = fopen(location.c_str(), "w");
|
||||
if (test_likely(fp != 0)){
|
||||
std::string html(ToHTML());
|
||||
fwrite(html.c_str(), html.length(), 1, fp);
|
||||
fclose(fp);
|
||||
system("pwd");
|
||||
std::cout << "Saved file to " << location << std::endl;
|
||||
} else {
|
||||
std::cout << "Couldn't save file" << std::endl;
|
||||
}
|
||||
|
||||
if (test_likely(Echo)) std::cout << "Passed tests: " << All.size() - Fails.size() << std::endl << "Failed tests: " << Fails.size() << std::endl;
|
||||
}
|
||||
|
||||
bool UnitTest::GetReturnOnFail(void){ return ReturnOnFail; }
|
||||
void UnitTest::SetReturnOnFail(bool option){ ReturnOnFail = option; }
|
||||
void UnitTest::SetEcho(bool option){ Echo = option; }
|
||||
void UnitTest::SetPrefix(const std::string & prefix){
|
||||
std::cout << prefix << std::endl;
|
||||
Prefix = prefix;
|
||||
}
|
||||
std::string UnitTest::GetPrefix(void){ return Prefix; }
|
||||
void UnitTest::echo_(const std::string & out){
|
||||
All.push_back(fix(out) + "<br>");
|
||||
std::cout << out << std::endl;
|
||||
}
|
||||
|
||||
void UnitTest::StartTime(void){
|
||||
started = clock();
|
||||
}
|
|
@ -1,229 +0,0 @@
|
|||
#ifndef _TEST_SUITE_H_
|
||||
#define _TEST_SUITE_H_
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <cstring>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define TEST_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100)
|
||||
#if (TEST_GCC_VERSION >= 29600)
|
||||
#define test_likely(x) __builtin_expect((long)((bool)(x)),1)
|
||||
#define test_unlikely(x) __builtin_expect((long)((bool)(x)),0)
|
||||
#else
|
||||
#define test_likely(x) x
|
||||
#define test_unlikely(x) x
|
||||
#endif
|
||||
#else
|
||||
#define test_likely(x) x
|
||||
#define test_unlikely(x) x
|
||||
#endif
|
||||
|
||||
#include <limits>
|
||||
|
||||
template <typename T>
|
||||
union unittest_numUnion {
|
||||
unittest_numUnion(T _v) : val(_v){}
|
||||
T val;
|
||||
unsigned char c[sizeof(T)];
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
static bool unittest_isNAN(T num){
|
||||
unittest_numUnion<T> orig(num);
|
||||
|
||||
static unittest_numUnion<T> sig_nan(std::numeric_limits<T>::signaling_NaN());
|
||||
|
||||
bool isNAN = true;
|
||||
for(size_t i = 0; i < sizeof(T); ++i){
|
||||
if (orig.c[i] != sig_nan.c[i]){
|
||||
isNAN = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isNAN) return true;
|
||||
|
||||
static unittest_numUnion<T> quiet_nan(std::numeric_limits<T>::quiet_NaN());
|
||||
|
||||
for(size_t i = 0; i < sizeof(T); ++i){
|
||||
if (orig.c[i] != quiet_nan.c[i]){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
class UnitTest {
|
||||
public:
|
||||
static void SelfCheck(void);
|
||||
static void PushFailure(const std::string & fail);
|
||||
static void PushSuccess(const std::string & pass);
|
||||
static void echo_(const std::string & out);
|
||||
static std::string ToString(void);
|
||||
static std::string ToHTML(void);
|
||||
static void SaveTo(const std::string & location);
|
||||
static void SetReturnOnFail(bool option);
|
||||
static bool GetReturnOnFail(void);
|
||||
static void SetEcho(bool option);
|
||||
static void SetPrefix(const std::string & prefix);
|
||||
static std::string GetPrefix(void);
|
||||
static void StartTime(void);
|
||||
static inline bool _floatsAreEqual(const double & one, const double & two){
|
||||
return (one > two) ? (one - two) < .000001 : (one - two) > -.000001;
|
||||
}
|
||||
};
|
||||
|
||||
#define MakePre()\
|
||||
std::string pre = UnitTest::GetPrefix();\
|
||||
if (test_unlikely(pre.empty())){\
|
||||
std::stringstream out;\
|
||||
out << __FILE__ << ":" << __LINE__;\
|
||||
pre = out.str();\
|
||||
}\
|
||||
pre += ": ";
|
||||
|
||||
#define FAIL(stri)\
|
||||
MakePre()\
|
||||
UnitTest::PushFailure(pre + std::string(stri));\
|
||||
if (UnitTest::GetReturnOnFail()) return;
|
||||
|
||||
#define PASS(stri)\
|
||||
MakePre();\
|
||||
UnitTest::PushSuccess(pre + std::string(stri));\
|
||||
|
||||
#define assertUnitTest()\
|
||||
UnitTest::SelfCheck();
|
||||
|
||||
#define assertTrue(cond)\
|
||||
if (test_unlikely(!(cond))){\
|
||||
FAIL(#cond);\
|
||||
} else {\
|
||||
PASS(#cond);\
|
||||
}
|
||||
|
||||
#define assertFalse(cond)\
|
||||
if (test_unlikely(cond)){\
|
||||
FAIL(#cond);\
|
||||
} else {\
|
||||
PASS(#cond);\
|
||||
}
|
||||
|
||||
#define assertTrue_Primitive(cond, leftside, rightside)\
|
||||
if (test_unlikely(!(cond))){\
|
||||
std::stringstream unit_out;\
|
||||
unit_out << #cond;\
|
||||
unit_out << ", Left side: " << leftside;\
|
||||
unit_out << ", Right side: " << rightside;\
|
||||
FAIL(unit_out.str());\
|
||||
} else {\
|
||||
PASS(#cond);\
|
||||
}
|
||||
|
||||
//needs to copy it so that if its a function call it only does it once
|
||||
#define assertNAN(type, one)\
|
||||
{\
|
||||
type val = (type)one;\
|
||||
std::string lag(#one);\
|
||||
lag += " not a number";\
|
||||
if (test_likely(unittest_isNAN<type>(one))){\
|
||||
PASS(lag)\
|
||||
} else {\
|
||||
FAIL(lag)\
|
||||
}\
|
||||
}
|
||||
|
||||
#define assertFloatEquals(one, two)\
|
||||
assertTrue(UnitTest::_floatsAreEqual(one, two))
|
||||
|
||||
#define assertEquals(one, two)\
|
||||
assertTrue((one) == (two))
|
||||
|
||||
#define assertNotEquals(one, two)\
|
||||
assertTrue((one) != (two))
|
||||
|
||||
#define assertGreaterThan(one, two)\
|
||||
assertTrue((one) > (two))
|
||||
|
||||
#define assertGreaterThanEqualTo(one, two)\
|
||||
assertTrue((one) >= (two))
|
||||
|
||||
#define assertLessThan(one, two)\
|
||||
assertTrue((one) < (two))
|
||||
|
||||
#define assertLessThanEqualTo(one, two)\
|
||||
assertTrue((one) <= (two))
|
||||
|
||||
|
||||
|
||||
#define assertEquals_Primitive(one, two)\
|
||||
assertTrue_Primitive((one) == (two), one, two)
|
||||
|
||||
#define assertNotEquals_Primitive(one, two)\
|
||||
assertTrue_Primitive((one) != (two), one, two)
|
||||
|
||||
#define assertGreaterThan_Primitive(one, two)\
|
||||
assertTrue_Primitive((one) > (two), one, two)
|
||||
|
||||
#define assertGreaterThanEqualTo_Primitive(one, two)\
|
||||
assertTrue_Primitive((one) >= (two), one, two)
|
||||
|
||||
#define assertLessThan_Primitive(one, two)\
|
||||
assertTrue_Primitive((one) < (two), one, two)
|
||||
|
||||
#define assertLessThanEqualTo_Primitive(one, two)\
|
||||
assertTrue_Primitive((one) <= (two), one, two)
|
||||
|
||||
#define assertNull(one)\
|
||||
assertTrue(one == NULL);
|
||||
|
||||
#define assertNotNull(one)\
|
||||
assertTrue(one != NULL);
|
||||
|
||||
#define assertCStringEquals(one, two)\
|
||||
if (test_unlikely(strcmp(one, two))){\
|
||||
FAIL(std::string(#one) + "==" + #two);\
|
||||
} else {\
|
||||
PASS(std::string(#one) + "==" + #two);\
|
||||
}
|
||||
|
||||
#define assertCStringNotEquals(one, two)\
|
||||
if (test_unlikely(!strcmp(one, two))){\
|
||||
FAIL(std::string(#one) + "!=" + #two);\
|
||||
} else {\
|
||||
PASS(std::string(#one) + "!=" + #two);\
|
||||
}
|
||||
|
||||
#define assertCStringEqualsW(one, two)\
|
||||
if (test_unlikely(wcscmp(one, two))){\
|
||||
FAIL(std::string(#one) + "==" + #two);\
|
||||
} else {\
|
||||
PASS(std::string(#one) + "==" + #two);\
|
||||
}
|
||||
|
||||
#define assertCStringNotEqualsW(one, two)\
|
||||
if (test_unlikely(!wcscmp(one, two))){\
|
||||
FAIL(std::string(#one) + "!=" + #two);\
|
||||
} else {\
|
||||
PASS(std::string(#one) + "!=" + #two);\
|
||||
}
|
||||
|
||||
#define assertException(code, exc)\
|
||||
{\
|
||||
bool failed = false;\
|
||||
try {\
|
||||
code;\
|
||||
} catch (exc){\
|
||||
PASS(std::string(#exc) + " caught");\
|
||||
failed = true;\
|
||||
}\
|
||||
if (test_unlikely(!failed)){ FAIL(std::string(#exc) + " not caught");}\
|
||||
}
|
||||
|
||||
#define echo(something)\
|
||||
{\
|
||||
std::stringstream somet;\
|
||||
somet << something;\
|
||||
UnitTest::echo_(somet.str());\
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,149 +0,0 @@
|
|||
#include <iostream>
|
||||
#include <cstdlib> //for malloc, realloc, and free
|
||||
#include "TestSuite.h"
|
||||
#include "../../libjson.h"
|
||||
|
||||
void DoTests(void);
|
||||
void DoTests(void){
|
||||
TestSuite::TestStreams();
|
||||
TestSuite::TestValidator();
|
||||
TestSuite::TestString();
|
||||
TestSuite::TestConverters();
|
||||
#ifdef JSON_BINARY
|
||||
TestSuite::TestBase64();
|
||||
#endif
|
||||
|
||||
TestSuite::TestReferenceCounting();
|
||||
TestSuite::TestConstructors();
|
||||
TestSuite::TestAssigning();
|
||||
TestSuite::TestEquality();
|
||||
TestSuite::TestInequality();
|
||||
TestSuite::TestChildren();
|
||||
TestSuite::TestFunctions();
|
||||
TestSuite::TestIterators();
|
||||
TestSuite::TestInspectors();
|
||||
TestSuite::TestNamespace();
|
||||
#ifdef JSON_WRITE_PRIORITY
|
||||
TestSuite::TestWriter();
|
||||
#endif
|
||||
#ifdef JSON_COMMENTS
|
||||
TestSuite::TestComments();
|
||||
#endif
|
||||
#ifdef JSON_MUTEX_CALLBACKS
|
||||
TestSuite::TestMutex();
|
||||
TestSuite::TestThreading();
|
||||
#endif
|
||||
TestSuite::TestSharedString();
|
||||
TestSuite::TestFinal();
|
||||
}
|
||||
|
||||
#ifdef JSON_MEMORY_CALLBACKS
|
||||
long mallocs = 0;
|
||||
long reallocs = 0;
|
||||
long frees = 0;
|
||||
long bytes = 0;
|
||||
|
||||
//used to check load
|
||||
size_t maxBytes = 0;
|
||||
size_t currentBytes = 0;
|
||||
#ifdef JSON_LIBRARY
|
||||
#define MEMTYPE unsigned long
|
||||
#else
|
||||
#define MEMTYPE size_t
|
||||
#endif
|
||||
#include <map>
|
||||
#include <vector>
|
||||
std::map<void *, MEMTYPE> mem_mapping;
|
||||
std::vector<size_t> bytesallocated;
|
||||
|
||||
void * testmal(MEMTYPE siz);
|
||||
void * testmal(MEMTYPE siz){
|
||||
++mallocs;
|
||||
bytes += (long)siz;
|
||||
currentBytes += siz;
|
||||
if (currentBytes > maxBytes) maxBytes = currentBytes;
|
||||
bytesallocated.push_back(currentBytes);
|
||||
|
||||
void * res = std::malloc(siz);
|
||||
mem_mapping[res] = siz;
|
||||
return res;
|
||||
}
|
||||
|
||||
void testfree(void * ptr);
|
||||
void testfree(void * ptr){
|
||||
++frees;
|
||||
|
||||
std::map<void *, MEMTYPE>::iterator i = mem_mapping.find(ptr);
|
||||
if (i != mem_mapping.end()){ //globals
|
||||
currentBytes -= mem_mapping[ptr];
|
||||
mem_mapping.erase(ptr);
|
||||
}
|
||||
|
||||
bytesallocated.push_back(currentBytes);
|
||||
|
||||
std::free(ptr);
|
||||
}
|
||||
|
||||
void * testreal(void * ptr, MEMTYPE siz);
|
||||
void * testreal(void * ptr, MEMTYPE siz){
|
||||
++reallocs;
|
||||
|
||||
std::map<void *, MEMTYPE>::iterator i = mem_mapping.find(ptr);
|
||||
if (i != mem_mapping.end()){ //globals
|
||||
currentBytes -= mem_mapping[ptr];
|
||||
mem_mapping.erase(ptr);
|
||||
}
|
||||
currentBytes += siz;
|
||||
if (currentBytes > maxBytes) maxBytes = currentBytes;
|
||||
bytesallocated.push_back(currentBytes);
|
||||
|
||||
|
||||
void * res = std::realloc(ptr, siz);
|
||||
mem_mapping[res] = siz;
|
||||
return res;
|
||||
}
|
||||
|
||||
void doMemTests(void);
|
||||
void doMemTests(void){
|
||||
#ifdef JSON_LIBRARY
|
||||
json_register_memory_callbacks(testmal, testreal, testfree);
|
||||
#else
|
||||
libjson::register_memory_callbacks(testmal, testreal, testfree);
|
||||
#endif
|
||||
DoTests();
|
||||
echo("mallocs: " << mallocs);
|
||||
echo("frees: " << frees);
|
||||
echo("reallocs: " << reallocs);
|
||||
echo("bytes: " << bytes << " (" << (int)(bytes / 1024) << " KB)");
|
||||
echo("max bytes at once: " << maxBytes << " (" << (int)(maxBytes / 1024) << " KB)");
|
||||
std::vector<size_t>::iterator i = bytesallocated.begin();
|
||||
std::vector<size_t>::iterator e = bytesallocated.end();
|
||||
size_t bbytes = 0;
|
||||
for(; i != e; ++i){
|
||||
bbytes += *i;
|
||||
}
|
||||
bbytes = (size_t)(((double)bbytes) / ((double)bytesallocated.size()));
|
||||
echo("avg bytes at once: " << bbytes << " (" << (int)(bbytes / 1024) << " KB)");
|
||||
echo("still allocated: " << currentBytes << " (" << (int)(currentBytes / 1024) << " KB) (Global variables)");
|
||||
assertEquals(mallocs, frees);
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "RunTestSuite2.h"
|
||||
|
||||
int main () {
|
||||
UnitTest::StartTime();
|
||||
TestSuite::TestSelf();
|
||||
|
||||
DoTests();
|
||||
|
||||
#ifdef JSON_MEMORY_CALLBACKS
|
||||
doMemTests();
|
||||
#endif
|
||||
|
||||
RunTestSuite2::RunTests();
|
||||
|
||||
UnitTest::SaveTo("out.html");
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
OS=$(shell uname)
|
||||
ifeq ($(OS), Darwin)
|
||||
fastflag = -fast -ffast-math -fexpensive-optimizations
|
||||
else
|
||||
fastflag = -O3 -ffast-math -fexpensive-optimizations
|
||||
endif
|
||||
|
||||
COMPILER ?= g++
|
||||
|
||||
single:
|
||||
$(COMPILER) main.cpp TestAssign.cpp TestChildren.cpp \
|
||||
TestComments.cpp TestConverters.cpp TestCtors.cpp \
|
||||
TestEquality.cpp TestFunctions.cpp TestInequality.cpp \
|
||||
TestInspectors.cpp TestIterators.cpp TestMutex.cpp \
|
||||
TestNamespace.cpp TestRefCounting.cpp TestSuite.cpp \
|
||||
TestWriter.cpp TestString.cpp UnitTest.cpp \
|
||||
TestValidator.cpp TestStreams.cpp TestBinary.cpp \
|
||||
RunTestSuite2.cpp TestSharedString.cpp \
|
||||
../Source/internalJSONNode.cpp \
|
||||
../Source/JSONChildren.cpp ../Source/JSONDebug.cpp \
|
||||
../Source/JSONIterators.cpp ../Source/JSONMemory.cpp \
|
||||
../Source/JSONNode_Mutex.cpp ../Source/JSONNode.cpp \
|
||||
../Source/JSONWorker.cpp ../Source/JSONWriter.cpp \
|
||||
../Source/libjson.cpp ../Source/JSONValidator.cpp \
|
||||
../Source/JSONStream.cpp ../Source/JSONAllocator.cpp \
|
||||
../Source/JSONPreparse.cpp \
|
||||
../TestSuite2/JSON_Base64/json_decode64.cpp \
|
||||
../TestSuite2/JSON_Base64/json_encode64.cpp \
|
||||
../TestSuite2/JSONDebug/JSON_ASSERT_SAFE.cpp \
|
||||
../TestSuite2/JSONDebug/JSON_ASSERT.cpp \
|
||||
../TestSuite2/JSONDebug/JSON_FAIL_SAFE.cpp \
|
||||
../TestSuite2/JSONDebug/JSON_FAIL.cpp \
|
||||
../TestSuite2/JSONGlobals/jsonSingleton.cpp \
|
||||
../TestSuite2/JSONValidator/isValidArray.cpp \
|
||||
../TestSuite2/JSONValidator/isValidMember.cpp \
|
||||
../TestSuite2/JSONValidator/isValidNamedObject.cpp \
|
||||
../TestSuite2/JSONValidator/isValidNumber.cpp \
|
||||
../TestSuite2/JSONValidator/isValidObject.cpp \
|
||||
../TestSuite2/JSONValidator/isValidPartialRoot.cpp \
|
||||
../TestSuite2/JSONValidator/isValidRoot.cpp \
|
||||
../TestSuite2/JSONValidator/isValidString.cpp \
|
||||
../TestSuite2/JSONValidator/securityTest.cpp \
|
||||
../TestSuite2/NumberToString/_areFloatsEqual.cpp \
|
||||
../TestSuite2/NumberToString/_atof.cpp \
|
||||
../TestSuite2/NumberToString/_ftoa.cpp \
|
||||
../TestSuite2/NumberToString/_itoa.cpp \
|
||||
../TestSuite2/NumberToString/_uitoa.cpp \
|
||||
../TestSuite2/NumberToString/getLenSize.cpp \
|
||||
../TestSuite2/NumberToString/isNumeric.cpp \
|
||||
-Wfatal-errors -DNDEBUG $(fastflag) -pipe -o testapp
|
||||
|
||||
debug:
|
||||
$(COMPILER) main.cpp TestAssign.cpp TestChildren.cpp \
|
||||
TestComments.cpp TestConverters.cpp TestCtors.cpp \
|
||||
TestEquality.cpp TestFunctions.cpp TestInequality.cpp \
|
||||
TestInspectors.cpp TestIterators.cpp TestMutex.cpp \
|
||||
TestNamespace.cpp TestRefCounting.cpp TestSuite.cpp \
|
||||
TestWriter.cpp TestString.cpp UnitTest.cpp \
|
||||
TestValidator.cpp TestStreams.cpp TestBinary.cpp \
|
||||
RunTestSuite2.cpp TestSharedString.cpp \
|
||||
../Source/internalJSONNode.cpp \
|
||||
../Source/JSONChildren.cpp ../Source/JSONDebug.cpp \
|
||||
../Source/JSONIterators.cpp ../Source/JSONMemory.cpp \
|
||||
../Source/JSONNode_Mutex.cpp ../Source/JSONNode.cpp \
|
||||
../Source/JSONWorker.cpp ../Source/JSONWriter.cpp \
|
||||
../Source/libjson.cpp ../Source/JSONValidator.cpp \
|
||||
../Source/JSONStream.cpp ../Source/JSONAllocator.cpp \
|
||||
../Source/JSONPreparse.cpp \
|
||||
../TestSuite2/JSON_Base64/json_decode64.cpp \
|
||||
../TestSuite2/JSON_Base64/json_encode64.cpp \
|
||||
../TestSuite2/JSONDebug/JSON_ASSERT_SAFE.cpp \
|
||||
../TestSuite2/JSONDebug/JSON_ASSERT.cpp \
|
||||
../TestSuite2/JSONDebug/JSON_FAIL_SAFE.cpp \
|
||||
../TestSuite2/JSONDebug/JSON_FAIL.cpp \
|
||||
../TestSuite2/JSONGlobals/jsonSingleton.cpp \
|
||||
../TestSuite2/JSONValidator/isValidArray.cpp \
|
||||
../TestSuite2/JSONValidator/isValidMember.cpp \
|
||||
../TestSuite2/JSONValidator/isValidNamedObject.cpp \
|
||||
../TestSuite2/JSONValidator/isValidNumber.cpp \
|
||||
../TestSuite2/JSONValidator/isValidObject.cpp \
|
||||
../TestSuite2/JSONValidator/isValidPartialRoot.cpp \
|
||||
../TestSuite2/JSONValidator/isValidRoot.cpp \
|
||||
../TestSuite2/JSONValidator/isValidString.cpp \
|
||||
../TestSuite2/JSONValidator/securityTest.cpp \
|
||||
../TestSuite2/NumberToString/_areFloatsEqual.cpp \
|
||||
../TestSuite2/NumberToString/_atof.cpp \
|
||||
../TestSuite2/NumberToString/_ftoa.cpp \
|
||||
../TestSuite2/NumberToString/_itoa.cpp \
|
||||
../TestSuite2/NumberToString/_uitoa.cpp \
|
||||
../TestSuite2/NumberToString/getLenSize.cpp \
|
||||
../TestSuite2/NumberToString/isNumeric.cpp \
|
||||
-Wfatal-errors -DJSON_DEBUG -pipe -o testapp
|
||||
|
||||
small:
|
||||
$(COMPILER) main.cpp TestAssign.cpp TestChildren.cpp \
|
||||
TestComments.cpp TestConverters.cpp TestCtors.cpp \
|
||||
TestEquality.cpp TestFunctions.cpp TestInequality.cpp \
|
||||
TestInspectors.cpp TestIterators.cpp TestMutex.cpp \
|
||||
TestNamespace.cpp TestRefCounting.cpp TestSuite.cpp \
|
||||
TestWriter.cpp TestString.cpp UnitTest.cpp \
|
||||
TestValidator.cpp TestStreams.cpp TestBinary.cpp \
|
||||
RunTestSuite2.cpp TestSharedString.cpp \
|
||||
../Source/internalJSONNode.cpp \
|
||||
../Source/JSONChildren.cpp ../Source/JSONDebug.cpp \
|
||||
../Source/JSONIterators.cpp ../Source/JSONMemory.cpp \
|
||||
../Source/JSONNode_Mutex.cpp ../Source/JSONNode.cpp \
|
||||
../Source/JSONWorker.cpp ../Source/JSONWriter.cpp \
|
||||
../Source/libjson.cpp ../Source/JSONValidator.cpp \
|
||||
../Source/JSONStream.cpp ../Source/JSONAllocator.cpp \
|
||||
../Source/JSONPreparse.cpp \
|
||||
../TestSuite2/JSON_Base64/json_decode64.cpp \
|
||||
../TestSuite2/JSON_Base64/json_encode64.cpp \
|
||||
../TestSuite2/JSONDebug/JSON_ASSERT_SAFE.cpp \
|
||||
../TestSuite2/JSONDebug/JSON_ASSERT.cpp \
|
||||
../TestSuite2/JSONDebug/JSON_FAIL_SAFE.cpp \
|
||||
../TestSuite2/JSONDebug/JSON_FAIL.cpp \
|
||||
../TestSuite2/JSONGlobals/jsonSingleton.cpp \
|
||||
../TestSuite2/JSONValidator/isValidArray.cpp \
|
||||
../TestSuite2/JSONValidator/isValidMember.cpp \
|
||||
../TestSuite2/JSONValidator/isValidNamedObject.cpp \
|
||||
../TestSuite2/JSONValidator/isValidNumber.cpp \
|
||||
../TestSuite2/JSONValidator/isValidObject.cpp \
|
||||
../TestSuite2/JSONValidator/isValidPartialRoot.cpp \
|
||||
../TestSuite2/JSONValidator/isValidRoot.cpp \
|
||||
../TestSuite2/JSONValidator/isValidString.cpp \
|
||||
../TestSuite2/JSONValidator/securityTest.cpp \
|
||||
../TestSuite2/NumberToString/_areFloatsEqual.cpp \
|
||||
../TestSuite2/NumberToString/_atof.cpp \
|
||||
../TestSuite2/NumberToString/_ftoa.cpp \
|
||||
../TestSuite2/NumberToString/_itoa.cpp \
|
||||
../TestSuite2/NumberToString/_uitoa.cpp \
|
||||
../TestSuite2/NumberToString/getLenSize.cpp \
|
||||
../TestSuite2/NumberToString/isNumeric.cpp \
|
||||
-Wfatal-errors -DNDEBUG -Os -ffast-math -DJSON_LESS_MEMORY -pipe -o testapp
|
||||
|
||||
test:
|
||||
$(COMPILER) All/main.cpp UnitTest.cpp -DNDEBUG $(fastflag) -ffast-math -fexpensive-optimizations -pipe -o testall
|
|
@ -1,24 +0,0 @@
|
|||
#ifndef JSON_TESTSUITE_BASETEST_H
|
||||
#define JSON_TESTSUITE_BASETEST_H
|
||||
|
||||
#include "../TestSuite/UnitTest.h"
|
||||
#include <string>
|
||||
|
||||
class libjson_CodeCoverage;
|
||||
|
||||
class BaseTest {
|
||||
public:
|
||||
BaseTest(const std::string & name) : _name(name), coverage(0) {}
|
||||
virtual ~BaseTest(void){};
|
||||
virtual void setUp(const std::string & methodName){ UnitTest::SetPrefix(_name + "::" + methodName); }
|
||||
virtual void tearDown(void){}
|
||||
protected:
|
||||
const std::string _name;
|
||||
libjson_CodeCoverage * coverage;
|
||||
private:
|
||||
BaseTest(const BaseTest &);
|
||||
BaseTest & operator=(const BaseTest &);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
#include "JSON_ASSERT.h"
|
||||
#include "../../Source/JSONDebug.h"
|
||||
|
||||
#if defined JSON_DEBUG
|
||||
#ifndef JSON_STDERROR
|
||||
static json_string last;
|
||||
#ifdef JSON_LIBRARY
|
||||
static void callback(const json_char * p){ last = p; }
|
||||
#else
|
||||
static void callback(const json_string & p){ last = p; }
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
const json_string fail_consta = JSON_TEXT("fail"); //should pass the same pointer all the way through, no copies
|
||||
const json_string null_consta = JSON_TEXT("");
|
||||
#if defined JSON_DEBUG || defined JSON_SAFE
|
||||
json_error_callback_t origCallbacka = NULL;
|
||||
#endif
|
||||
|
||||
void testJSONDebug_JSON_ASSERT::setUp(const std::string & methodName){
|
||||
BaseTest::setUp(methodName);
|
||||
#if defined JSON_DEBUG
|
||||
#ifndef JSON_STDERROR
|
||||
origCallbacka = JSONDebug::register_callback(callback); //check that the callback was called
|
||||
last = null_consta;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void testJSONDebug_JSON_ASSERT::tearDown(void){
|
||||
BaseTest::tearDown();
|
||||
#if defined JSON_DEBUG
|
||||
#ifndef JSON_STDERROR
|
||||
JSONDebug::register_callback(origCallbacka); //check that the callback was called
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Make sure asserts that pass do not call the callback or run extra code
|
||||
*/
|
||||
void testJSONDebug_JSON_ASSERT::testPass(void){
|
||||
#if defined JSON_DEBUG
|
||||
#ifndef JSON_STDERROR
|
||||
JSON_ASSERT(1 == 1, fail_consta);
|
||||
assertEquals(last, null_consta); //make sure the callback was not called
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Make sure asserts that fail do call the callback and run extra code
|
||||
*/
|
||||
void testJSONDebug_JSON_ASSERT::testFail(void){
|
||||
#if defined JSON_DEBUG
|
||||
#ifndef JSON_STDERROR
|
||||
JSON_ASSERT(1 == 0, fail_consta);
|
||||
assertEquals(last, fail_consta); //make sure the callback was actually called
|
||||
#endif
|
||||
#endif
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
#ifndef JSON_TESTSUITE_JSON_DEBUG__JSON_ASSERT_H
|
||||
#define JSON_TESTSUITE_JSON_DEBUG__JSON_ASSERT_H
|
||||
|
||||
#include "../BaseTest.h"
|
||||
|
||||
class testJSONDebug_JSON_ASSERT : public BaseTest {
|
||||
public:
|
||||
testJSONDebug_JSON_ASSERT(const std::string & name) : BaseTest(name){}
|
||||
virtual void setUp(const std::string & methodName);
|
||||
virtual void tearDown(void);
|
||||
void testPass(void);
|
||||
void testFail(void);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,74 +0,0 @@
|
|||
#include "JSON_ASSERT_SAFE.h"
|
||||
#include "../../Source/JSONDebug.h"
|
||||
|
||||
#if defined JSON_DEBUG
|
||||
#ifndef JSON_STDERROR
|
||||
static json_string last;
|
||||
#ifdef JSON_LIBRARY
|
||||
static void callback(const json_char * p){ last = p; }
|
||||
#else
|
||||
static void callback(const json_string & p){ last = p; }
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
const json_string fail_const = JSON_TEXT("fail"); //should pass the same pointer all the way through, no copies
|
||||
const json_string null_const = JSON_TEXT("");
|
||||
#if defined JSON_DEBUG || defined JSON_SAFE
|
||||
json_error_callback_t origCallback = NULL;
|
||||
#endif
|
||||
|
||||
void testJSONDebug_JSON_ASSERT_SAFE::setUp(const std::string & methodName){
|
||||
BaseTest::setUp(methodName);
|
||||
#if defined JSON_DEBUG
|
||||
#ifndef JSON_STDERROR
|
||||
origCallback = JSONDebug::register_callback(callback); //check that the callback was called
|
||||
last = null_const;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void testJSONDebug_JSON_ASSERT_SAFE::tearDown(void){
|
||||
BaseTest::tearDown();
|
||||
#if defined JSON_DEBUG
|
||||
#ifndef JSON_STDERROR
|
||||
JSONDebug::register_callback(origCallback); //check that the callback was called
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Make sure asserts that pass do not call the callback or run extra code
|
||||
*/
|
||||
void testJSONDebug_JSON_ASSERT_SAFE::testPass(void){
|
||||
int i = 0;
|
||||
JSON_ASSERT_SAFE(1 == 1, fail_const, i = 1;);
|
||||
assertEquals(i, 0);
|
||||
|
||||
#if defined JSON_DEBUG
|
||||
#ifndef JSON_STDERROR
|
||||
assertEquals(last, null_const); //make sure the callback was not called
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Make sure asserts that fail do call the callback and run extra code
|
||||
*/
|
||||
void testJSONDebug_JSON_ASSERT_SAFE::testFail(void){
|
||||
int i = 0;
|
||||
JSON_ASSERT_SAFE(1 == 0, fail_const, i = 1;);
|
||||
#if defined(JSON_SAFE)
|
||||
assertEquals(i, 1); //safe caught the code
|
||||
#else
|
||||
assertEquals(i, 0); //fell through because no safety catch
|
||||
#endif
|
||||
|
||||
#if defined JSON_DEBUG
|
||||
#ifndef JSON_STDERROR
|
||||
assertEquals(last, fail_const); //make sure the callback was actually called
|
||||
#endif
|
||||
#endif
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
#ifndef JSON_TESTSUITE_JSON_DEBUG__JSON_ASSERT_SAFE_H
|
||||
#define JSON_TESTSUITE_JSON_DEBUG__JSON_ASSERT_SAFE_H
|
||||
|
||||
#include "../BaseTest.h"
|
||||
|
||||
class testJSONDebug_JSON_ASSERT_SAFE : public BaseTest {
|
||||
public:
|
||||
testJSONDebug_JSON_ASSERT_SAFE(const std::string & name) : BaseTest(name){}
|
||||
virtual void setUp(const std::string & methodName);
|
||||
virtual void tearDown(void);
|
||||
void testPass(void);
|
||||
void testFail(void);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,51 +0,0 @@
|
|||
#include "JSON_FAIL.h"
|
||||
#include "../../Source/JSONDebug.h"
|
||||
|
||||
#if defined JSON_DEBUG
|
||||
#ifndef JSON_STDERROR
|
||||
static json_string last;
|
||||
#ifdef JSON_LIBRARY
|
||||
static void callback(const json_char * p){ last = p; }
|
||||
#else
|
||||
static void callback(const json_string & p){ last = p; }
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
const json_string fail_constf = JSON_TEXT("fail"); //should pass the same pointer all the way through, no copies
|
||||
const json_string null_constf = JSON_TEXT("");
|
||||
#if defined JSON_DEBUG || defined JSON_SAFE
|
||||
json_error_callback_t origCallbackf = NULL;
|
||||
#endif
|
||||
|
||||
void testJSONDebug_JSON_FAIL::setUp(const std::string & methodName){
|
||||
BaseTest::setUp(methodName);
|
||||
#if defined JSON_DEBUG
|
||||
#ifndef JSON_STDERROR
|
||||
origCallbackf = JSONDebug::register_callback(callback); //check that the callback was called
|
||||
last = null_constf;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void testJSONDebug_JSON_FAIL::tearDown(void){
|
||||
BaseTest::tearDown();
|
||||
#if defined JSON_DEBUG
|
||||
#ifndef JSON_STDERROR
|
||||
JSONDebug::register_callback(origCallbackf); //check that the callback was called
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Make sure fails do call the callback
|
||||
*/
|
||||
void testJSONDebug_JSON_FAIL::testFail(void){
|
||||
#if defined JSON_DEBUG
|
||||
#ifndef JSON_STDERROR
|
||||
JSON_FAIL(fail_constf);
|
||||
assertEquals(last, fail_constf); //make sure the callback was actually called
|
||||
#endif
|
||||
#endif
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
#ifndef JSON_TESTSUITE_JSON_DEBUG__JSON_FAIL_H
|
||||
#define JSON_TESTSUITE_JSON_DEBUG__JSON_FAIL_H
|
||||
|
||||
#include "../BaseTest.h"
|
||||
|
||||
class testJSONDebug_JSON_FAIL : public BaseTest {
|
||||
public:
|
||||
testJSONDebug_JSON_FAIL(const std::string & name) : BaseTest(name){}
|
||||
virtual void setUp(const std::string & methodName);
|
||||
virtual void tearDown(void);
|
||||
void testFail(void);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,58 +0,0 @@
|
|||
#include "JSON_FAIL_SAFE.h"
|
||||
#include "../../Source/JSONDebug.h"
|
||||
|
||||
#if defined JSON_DEBUG
|
||||
#ifndef JSON_STDERROR
|
||||
static json_string last;
|
||||
#ifdef JSON_LIBRARY
|
||||
static void callback(const json_char * p){ last = p; }
|
||||
#else
|
||||
static void callback(const json_string & p){ last = p; }
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
const json_string fail_constfs = JSON_TEXT("fail"); //should pass the same pointer all the way through, no copies
|
||||
const json_string null_constfs = JSON_TEXT("");
|
||||
#if defined JSON_DEBUG || defined JSON_SAFE
|
||||
json_error_callback_t origCallbackfs = NULL;
|
||||
#endif
|
||||
|
||||
void testJSONDebug_JSON_FAIL_SAFE::setUp(const std::string & methodName){
|
||||
BaseTest::setUp(methodName);
|
||||
#if defined JSON_DEBUG
|
||||
#ifndef JSON_STDERROR
|
||||
origCallbackfs = JSONDebug::register_callback(callback); //check that the callback was called
|
||||
last = null_constfs;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void testJSONDebug_JSON_FAIL_SAFE::tearDown(void){
|
||||
BaseTest::tearDown();
|
||||
#if defined JSON_DEBUG
|
||||
#ifndef JSON_STDERROR
|
||||
JSONDebug::register_callback(origCallbackfs); //check that the callback was called
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Make sure fails do call the callback and run extra code
|
||||
*/
|
||||
void testJSONDebug_JSON_FAIL_SAFE::testFail(void){
|
||||
int i = 0;
|
||||
JSON_FAIL_SAFE(fail_constfs, i = 1;);
|
||||
#if defined(JSON_SAFE)
|
||||
assertEquals(i, 1); //safe caught the code
|
||||
#else
|
||||
assertEquals(i, 0); //fell through because no safety catch
|
||||
#endif
|
||||
|
||||
#if defined JSON_DEBUG
|
||||
#ifndef JSON_STDERROR
|
||||
assertEquals(last, fail_constfs); //make sure the callback was actually called
|
||||
#endif
|
||||
#endif
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
#ifndef JSON_TESTSUITE_JSON_DEBUG__JSON_FAIL_SAFE_H
|
||||
#define JSON_TESTSUITE_JSON_DEBUG__JSON_FAIL_SAFE_H
|
||||
|
||||
#include "../BaseTest.h"
|
||||
|
||||
class testJSONDebug_JSON_FAIL_SAFE : public BaseTest {
|
||||
public:
|
||||
testJSONDebug_JSON_FAIL_SAFE(const std::string & name) : BaseTest(name){}
|
||||
virtual void setUp(const std::string & methodName);
|
||||
virtual void tearDown(void);
|
||||
void testFail(void);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,21 +0,0 @@
|
|||
#include "jsonSingleton.h"
|
||||
#include "../../Source/JSONGlobals.h"
|
||||
|
||||
json_global_decl(std::string, WITHVALUE, "myvalue");
|
||||
json_global_decl(std::string, WITHOUTVALUE, );
|
||||
|
||||
void testJSONGlobals__jsonSingleton::testValue(void){
|
||||
std::string * p1 = &jsonSingletonWITHVALUE::getValue();
|
||||
std::string * p2 = &json_global(WITHVALUE);
|
||||
assertEquals(p1, p2);
|
||||
assertEquals(json_global(WITHVALUE), "myvalue");
|
||||
assertEquals(jsonSingletonWITHVALUE::getValue(), "myvalue");
|
||||
}
|
||||
|
||||
void testJSONGlobals__jsonSingleton::testNoValue(void){
|
||||
std::string * p1 = &jsonSingletonWITHOUTVALUE::getValue();
|
||||
std::string * p2 = &json_global(WITHOUTVALUE);
|
||||
assertEquals(p1, p2);
|
||||
assertEquals(json_global(WITHOUTVALUE), "");
|
||||
assertEquals(jsonSingletonWITHOUTVALUE::getValue(), "");
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
#ifndef JSON_TESTSUITE_JSON_GLOBALS__JSON_SINGLETON_H
|
||||
#define JSON_TESTSUITE_JSON_GLOBALS__JSON_SINGLETON_H
|
||||
|
||||
#include "../BaseTest.h"
|
||||
|
||||
class testJSONGlobals__jsonSingleton : public BaseTest {
|
||||
public:
|
||||
testJSONGlobals__jsonSingleton(const std::string & name) : BaseTest(name){}
|
||||
void testValue(void);
|
||||
void testNoValue(void);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,48 +0,0 @@
|
|||
#ifndef JSON_TESTSUITE_JSON_VALIDATOR_RESOURCES_VALIDITY_MACROS_H
|
||||
#define JSON_TESTSUITE_JSON_VALIDATOR_RESOURCES_VALIDITY_MACROS_H
|
||||
|
||||
#include "../../../../JSONOptions.h"
|
||||
|
||||
#ifdef JSON_VALIDATE
|
||||
|
||||
#define assertValid(x, method, nextchar)\
|
||||
{\
|
||||
json_string temp(JSON_TEXT(x));\
|
||||
const json_char * ptr = temp.c_str();\
|
||||
assertTrue(JSONValidator::method(ptr) && ((*ptr)==JSON_TEXT(nextchar)));\
|
||||
}
|
||||
|
||||
#define assertNotValid(x, method, nextchar)\
|
||||
{\
|
||||
json_string temp(JSON_TEXT(x));\
|
||||
const json_char * ptr = temp.c_str();\
|
||||
assertTrue(!JSONValidator::method(ptr) || ((*ptr)!=JSON_TEXT(nextchar)));\
|
||||
}
|
||||
|
||||
#ifdef JSON_SECURITY_MAX_NEST_LEVEL
|
||||
#define assertValid_Depth(x, method, nextchar)\
|
||||
{\
|
||||
json_string temp(JSON_TEXT(x));\
|
||||
const json_char * ptr = temp.c_str();\
|
||||
assertTrue(JSONValidator::method(ptr, 1) && ((*ptr)==JSON_TEXT(nextchar)));\
|
||||
}
|
||||
|
||||
#define assertNotValid_Depth(x, method, nextchar)\
|
||||
{\
|
||||
json_string temp(JSON_TEXT(x));\
|
||||
const json_char * ptr = temp.c_str();\
|
||||
assertTrue(!JSONValidator::method(ptr, 1) || ((*ptr)!=JSON_TEXT(nextchar)));\
|
||||
}
|
||||
#else
|
||||
#define assertValid_Depth(x, method, nextchar) assertValid(x, method, nextchar)
|
||||
#define assertNotValid_Depth(x, method, nextchar) assertNotValid(x, method, nextchar)
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define assertValid(x, method, nextchar)
|
||||
#define assertNotValid(x, method, nextchar)
|
||||
#define assertValid_Depth(x, method, nextchar)
|
||||
#define assertNotValid_Depth(x, method, nextchar)
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,11 +0,0 @@
|
|||
/*
|
||||
* isValidArray.cpp
|
||||
* TestSuite
|
||||
*
|
||||
* Created by Jonathan Wallace on 11/13/11.
|
||||
* Copyright 2011 StreamWIDE. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "isValidArray.h"
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
/*
|
||||
* isValidArray.h
|
||||
* TestSuite
|
||||
*
|
||||
* Created by Jonathan Wallace on 11/13/11.
|
||||
* Copyright 2011 StreamWIDE. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
#include "isValidMember.h"
|
||||
#include "Resources/validyMacros.h"
|
||||
#include "../../Source/JSONValidator.h"
|
||||
|
||||
/*
|
||||
*
|
||||
* !!! ATTENTION !!!
|
||||
*
|
||||
* libjson currently has three number parsing methods, they are being merged
|
||||
* behind the scenes, but all three interfaces must be consistent, so every set
|
||||
* of numbers need to be tested in all three spots
|
||||
*
|
||||
* JSONValidator/isValidMember *this file*
|
||||
* * Soon to come actual parser *
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* This tests the three valid members that is not string, number, or container
|
||||
*/
|
||||
void testJSONValidator__isValidMember::testMembers(void){
|
||||
#ifdef JSON_VALIDATE
|
||||
assertValid_Depth("true,", isValidMember, ',');
|
||||
assertValid_Depth("false,", isValidMember, ',');
|
||||
assertValid_Depth("null,", isValidMember, ',');
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This tests that json's case sensitive rules are to be obeyed
|
||||
*/
|
||||
void testJSONValidator__isValidMember::testStrict(void){
|
||||
#ifdef JSON_VALIDATE
|
||||
#ifdef JSON_STRICT
|
||||
assertNotValid_Depth("TRUE,", isValidMember, ',');
|
||||
assertNotValid_Depth("FALSE,", isValidMember, ',');
|
||||
assertNotValid_Depth("NULL,", isValidMember, ',');
|
||||
assertNotValid_Depth(",", isValidMember, ','); //also accepted as null usually
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This tests that json's case sensitive rules are not obeyed normally
|
||||
*/
|
||||
void testJSONValidator__isValidMember::testNotStrict(void){
|
||||
#ifdef JSON_VALIDATE
|
||||
#ifndef JSON_STRICT
|
||||
assertValid_Depth("TRUE,", isValidMember, ',');
|
||||
assertValid_Depth("FALSE,", isValidMember, ',');
|
||||
assertValid_Depth("NULL,", isValidMember, ',');
|
||||
assertValid_Depth(",", isValidMember, ','); //also accepted as null usually
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This tests that non member values are not allowed
|
||||
*/
|
||||
void testJSONValidator__isValidMember::testNotMembers(void){
|
||||
#ifdef JSON_VALIDATE
|
||||
assertNotValid_Depth("tru,", isValidMember, ',');
|
||||
assertNotValid_Depth("fals,", isValidMember, ',');
|
||||
assertNotValid_Depth("nul,", isValidMember, ',');
|
||||
assertNotValid_Depth("", isValidMember, ','); //needs a comma after it because of how the pipeline works
|
||||
assertNotValid_Depth("xxx,", isValidMember, ',');
|
||||
assertNotValid_Depth("nonsense,", isValidMember, ',');
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This tests that for all cases, if the string suddely ends, it recovers
|
||||
*/
|
||||
void testJSONValidator__isValidMember::testSuddenEnd(void){
|
||||
#ifdef JSON_VALIDATE
|
||||
assertNotValid_Depth("", isValidMember, ',');
|
||||
|
||||
//--- void testJSONValidator__isValidMember::testSuddenEnd(void){
|
||||
assertNotValid_Depth("true", isValidMember, ',');
|
||||
assertNotValid_Depth("false", isValidMember, ',');
|
||||
assertNotValid_Depth("null", isValidMember, ',');
|
||||
|
||||
//strict stuff
|
||||
assertNotValid_Depth("TRUE", isValidMember, ',');
|
||||
assertNotValid_Depth("FALSE", isValidMember, ',');
|
||||
assertNotValid_Depth("NULL", isValidMember, ',');
|
||||
|
||||
//--- void testJSONValidator__isValidMember::testNotMembers(void){
|
||||
assertNotValid_Depth("tru", isValidMember, ',');
|
||||
assertNotValid_Depth("fals", isValidMember, ',');
|
||||
assertNotValid_Depth("nul", isValidMember, ',');
|
||||
assertNotValid_Depth("", isValidMember, ','); //needs a comma after it because of how the pipeline works
|
||||
assertNotValid_Depth("xxx", isValidMember, ',');
|
||||
assertNotValid_Depth("nonsense", isValidMember, ',');
|
||||
assertNotValid_Depth("1234", isValidMember, ',');
|
||||
#endif
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
#ifndef JSON_TESTSUITE_JSON_VALIDATOR__IS_VALID_MEMBER_H
|
||||
#define JSON_TESTSUITE_JSON_VALIDATOR__IS_VALID_MEMBER_H
|
||||
|
||||
#include "../BaseTest.h"
|
||||
|
||||
class testJSONValidator__isValidMember : public BaseTest {
|
||||
public:
|
||||
testJSONValidator__isValidMember(const std::string & name) : BaseTest(name){}
|
||||
void testMembers(void);
|
||||
void testStrict(void);
|
||||
void testNotStrict(void);
|
||||
void testNotMembers(void);
|
||||
void testSuddenEnd(void);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,11 +0,0 @@
|
|||
/*
|
||||
* isValidNamedObject.cpp
|
||||
* TestSuite
|
||||
*
|
||||
* Created by Jonathan Wallace on 11/13/11.
|
||||
* Copyright 2011 StreamWIDE. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "isValidNamedObject.h"
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
/*
|
||||
* isValidNamedObject.h
|
||||
* TestSuite
|
||||
*
|
||||
* Created by Jonathan Wallace on 11/13/11.
|
||||
* Copyright 2011 StreamWIDE. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
|
@ -1,506 +0,0 @@
|
|||
#include "isValidNumber.h"
|
||||
#include "Resources/validyMacros.h"
|
||||
#include "../../Source/JSONValidator.h"
|
||||
|
||||
/*
|
||||
*
|
||||
* !!! ATTENTION !!!
|
||||
*
|
||||
* libjson currently has three number parsing methods, they are being merged
|
||||
* behind the scenes, but all three interfaces must be consistent, so every set
|
||||
* of numbers need to be tested in all three spots
|
||||
*
|
||||
* JSONValidator/isValidNumber *this file*
|
||||
* NumberToString/isNumeric
|
||||
* * Soon to come actual parser *
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Tests regular positive numbers in various forms
|
||||
*/
|
||||
void testJSONValidator__isValidNumber::testPositive(void){
|
||||
#ifdef JSON_VALIDATE
|
||||
assertValid("123,\"next\"", isValidNumber, ',');
|
||||
assertValid("12.3,\"next\"", isValidNumber, ',');
|
||||
assertValid("0.123,\"next\"", isValidNumber, ',');
|
||||
assertValid("0,\"next\"", isValidNumber, ',');
|
||||
assertValid("0.,\"next\"", isValidNumber, ',');
|
||||
assertValid("1.,\"next\"", isValidNumber, ',');
|
||||
assertValid("1,\"next\"", isValidNumber, ',');
|
||||
assertValid("0.0,\"next\"", isValidNumber, ',');
|
||||
assertValid("1.0,\"next\"", isValidNumber, ',');
|
||||
assertValid("1.01,\"next\"", isValidNumber, ',');
|
||||
//signed positives are legal when not in strict mode, this is tested below
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests regular negative numbers in various forms
|
||||
*/
|
||||
void testJSONValidator__isValidNumber::testNegative(void){
|
||||
#ifdef JSON_VALIDATE
|
||||
assertValid("-123,\"next\"", isValidNumber, ',');
|
||||
assertValid("-12.3,\"next\"", isValidNumber, ',');
|
||||
assertValid("-0.123,\"next\"", isValidNumber, ',');
|
||||
assertValid("-0,\"next\"", isValidNumber, ',');
|
||||
assertValid("-0.,\"next\"", isValidNumber, ',');
|
||||
assertValid("-1,\"next\"", isValidNumber, ',');
|
||||
assertValid("-1.,\"next\"", isValidNumber, ',');
|
||||
assertValid("-0.0,\"next\"", isValidNumber, ',');
|
||||
assertValid("-1.0,\"next\"", isValidNumber, ',');
|
||||
assertValid("-1.01,\"next\"", isValidNumber, ',');
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests positive numbers with regular scientific notation
|
||||
*/
|
||||
void testJSONValidator__isValidNumber::testPositive_ScientificNotation(void){
|
||||
#ifdef JSON_VALIDATE
|
||||
assertValid("0e123,\"next\"", isValidNumber, ','); //TODO is 0e... a valid scientific number? its always zero
|
||||
assertNotValid("0e12.3,\"next\"", isValidNumber, ',');
|
||||
assertValid("1.e123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("1.e12.3,\"next\"", isValidNumber, ',');
|
||||
assertValid("1.0e123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("1.0e12.3,\"next\"", isValidNumber, ',');
|
||||
|
||||
assertValid("0e2,\"next\"", isValidNumber, ',');
|
||||
assertValid("1e2,\"next\"", isValidNumber, ',');
|
||||
assertValid("0.e2,\"next\"", isValidNumber, ',');
|
||||
assertValid("1.e2,\"next\"", isValidNumber, ',');
|
||||
assertValid("0.0e2,\"next\"", isValidNumber, ',');
|
||||
assertValid("1.0e2,\"next\"", isValidNumber, ',');
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests negative numbers with regular scientifc notation
|
||||
*/
|
||||
void testJSONValidator__isValidNumber::testNegative_ScientificNotation(void){
|
||||
#ifdef JSON_VALIDATE
|
||||
assertValid("-0e123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("-0e12.3,\"next\"", isValidNumber, ',');
|
||||
assertValid("-1.e123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("-1.e12.3,\"next\"", isValidNumber, ',');
|
||||
assertValid("-1.0e123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("-1.0e12.3,\"next\"", isValidNumber, ',');
|
||||
|
||||
assertValid("-0e2,\"next\"", isValidNumber, ',');
|
||||
assertValid("-1e2,\"next\"", isValidNumber, ',');
|
||||
assertValid("-0.e2,\"next\"", isValidNumber, ',');
|
||||
assertValid("-1.e2,\"next\"", isValidNumber, ',');
|
||||
assertValid("-0.0e2,\"next\"", isValidNumber, ',');
|
||||
assertValid("-1.0e2,\"next\"", isValidNumber, ',');
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests positive numbers with scientific notiation that has a sign in it
|
||||
*/
|
||||
void testJSONValidator__isValidNumber::testPositive_SignedScientificNotation(void){
|
||||
#ifdef JSON_VALIDATE
|
||||
assertValid("0e-123,\"next\"", isValidNumber, ',');
|
||||
assertValid("0e+123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("0e-12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("0e+12.3,\"next\"", isValidNumber, ',');
|
||||
assertValid("1.e-123,\"next\"", isValidNumber, ',');
|
||||
assertValid("1.e+123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("1.e-12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("1.e+12.3,\"next\"", isValidNumber, ',');
|
||||
assertValid("1.0e-123,\"next\"", isValidNumber, ',');
|
||||
assertValid("1.0e+123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("1.0e-12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("1.0e+12.3,\"next\"", isValidNumber, ',');
|
||||
|
||||
assertValid("0e2,\"next\"", isValidNumber, ',');
|
||||
assertValid("1e2,\"next\"", isValidNumber, ',');
|
||||
assertValid("0.e2,\"next\"", isValidNumber, ',');
|
||||
assertValid("1.e2,\"next\"", isValidNumber, ',');
|
||||
assertValid("0.0e2,\"next\"", isValidNumber, ',');
|
||||
assertValid("1.0e2,\"next\"", isValidNumber, ',');
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests negative numbers with scientific notiation that has a sign in it
|
||||
*/
|
||||
void testJSONValidator__isValidNumber::testNegative_SignedScientificNotation(void){
|
||||
#ifdef JSON_VALIDATE
|
||||
assertValid("-0e-123,\"next\"", isValidNumber, ',');
|
||||
assertValid("-0e+123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("-0e-12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("-0e+12.3,\"next\"", isValidNumber, ',');
|
||||
assertValid("-0.e-123,\"next\"", isValidNumber, ',');
|
||||
assertValid("-0.e+123,\"next\"", isValidNumber, ',');
|
||||
assertValid("-1.e-123,\"next\"", isValidNumber, ',');
|
||||
assertValid("-1.e+123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("-1.e-12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("-1.e+12.3,\"next\"", isValidNumber, ',');
|
||||
assertValid("-0.0e-123,\"next\"", isValidNumber, ',');
|
||||
assertValid("-0.0e+123,\"next\"", isValidNumber, ',');
|
||||
assertValid("-1.0e-123,\"next\"", isValidNumber, ',');
|
||||
assertValid("-1.0e+123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("-1.0e-12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("-1.0e+12.3,\"next\"", isValidNumber, ',');
|
||||
|
||||
assertValid("-0e-2,\"next\"", isValidNumber, ',');
|
||||
assertValid("-1e-2,\"next\"", isValidNumber, ',');
|
||||
assertValid("-0.e-2,\"next\"", isValidNumber, ',');
|
||||
assertValid("-1.e-2,\"next\"", isValidNumber, ',');
|
||||
assertValid("-0.0e-2,\"next\"", isValidNumber, ',');
|
||||
assertValid("-1.0e-2,\"next\"", isValidNumber, ',');
|
||||
assertValid("-0e+2,\"next\"", isValidNumber, ',');
|
||||
assertValid("-1e+2,\"next\"", isValidNumber, ',');
|
||||
assertValid("-0.e+2,\"next\"", isValidNumber, ',');
|
||||
assertValid("-1.e+2,\"next\"", isValidNumber, ',');
|
||||
assertValid("-0.0e+2,\"next\"", isValidNumber, ',');
|
||||
assertValid("-1.0e+2,\"next\"", isValidNumber, ',');
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests that in strict mode, libjson isn't relaxed about what is and isn't
|
||||
* a valid number. libjson by default accepts a few extra common notations.
|
||||
*/
|
||||
void testJSONValidator__isValidNumber::testStrict(void){
|
||||
#ifdef JSON_VALIDATE
|
||||
#ifdef JSON_STRICT
|
||||
assertNotValid("00,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("00.01,\"next\"", isValidNumber, ',');
|
||||
assertNotValid(".01,\"next\"", isValidNumber, ','); //no leading 0 as required by the standard
|
||||
assertNotValid("-.01,\"next\"", isValidNumber, ','); //no leading 0 as required by the standard
|
||||
assertNotValid("+123,\"next\"", isValidNumber, ','); //no leading +
|
||||
assertNotValid("+12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+0.123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+0e123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+0e-123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+0e+123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1.e123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1.e-123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1.e+123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1.0e123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1.0e-123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1.0e+123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+0e12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+0e-12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+0e+12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1.e12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1.e-12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1.e+12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1.0e12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1.0e-12.3,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1.0e+12.3,\"next\"", isValidNumber, ',');
|
||||
|
||||
assertNotValid("0x12FF,\"next\"", isValidNumber, ',');
|
||||
assertValid("0128,\"next\"", isValidNumber, ','); //legal because in STRICT mode, this is not octal, leading zero is ignored
|
||||
|
||||
assertNotValid("0xABCD,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("0124,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1.,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+0.0,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1.0,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+0e2,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1e2,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+0.e2,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1.e2,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+0.0e2,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1.0e2,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+0e-2,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1e-2,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+0.e-2,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1.e-2,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+0e+2,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1e+2,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+0.e+2,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1.e+2,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+0.0e+2,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("+1.0e+2,\"next\"", isValidNumber, ',');
|
||||
|
||||
assertNotValid("1e-0123,\"next\"", isValidNumber, ','); //not valid because of negative and leading zero
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests that the extra common notations that libjson supports all
|
||||
* test out as valid
|
||||
*/
|
||||
void testJSONValidator__isValidNumber::testNotStrict(void){
|
||||
#ifdef JSON_VALIDATE
|
||||
#ifndef JSON_STRICT
|
||||
assertValid("00,\"next\"", isValidNumber, ',');
|
||||
assertValid("00.01,\"next\"", isValidNumber, ',');
|
||||
assertValid(".01,\"next\"", isValidNumber, ',');
|
||||
assertValid("-.01,\"next\"", isValidNumber, ',');
|
||||
assertValid("+123,\"next\"", isValidNumber, ',');
|
||||
assertValid("+12.3,\"next\"", isValidNumber, ',');
|
||||
assertValid("+0.123,\"next\"", isValidNumber, ',');
|
||||
assertValid("+0,\"next\"", isValidNumber, ',');
|
||||
assertValid("+0.,\"next\"", isValidNumber, ',');
|
||||
assertValid("+0e123,\"next\"", isValidNumber, ',');
|
||||
assertValid("+0e-123,\"next\"", isValidNumber, ',');
|
||||
assertValid("+0e+123,\"next\"", isValidNumber, ',');
|
||||
assertValid("+1.e123,\"next\"", isValidNumber, ',');
|
||||
assertValid("+1.e-123,\"next\"", isValidNumber, ',');
|
||||
assertValid("+1.e+123,\"next\"", isValidNumber, ',');
|
||||
assertValid("+1.0e123,\"next\"", isValidNumber, ',');
|
||||
assertValid("+1.0e-123,\"next\"", isValidNumber, ',');
|
||||
assertValid("+1.0e+123,\"next\"", isValidNumber, ',');
|
||||
assertValid("+0e12.3,\"next\"", isValidNumber, ',');
|
||||
assertValid("+0e-12.3,\"next\"", isValidNumber, ',');
|
||||
assertValid("+0e+12.3,\"next\"", isValidNumber, ',');
|
||||
assertValid("+1.e12.3,\"next\"", isValidNumber, ',');
|
||||
assertValid("+1.e-12.3,\"next\"", isValidNumber, ',');
|
||||
assertValid("+1.e+12.3,\"next\"", isValidNumber, ',');
|
||||
assertValid("+1.0e12.3,\"next\"", isValidNumber, ',');
|
||||
assertValid("+1.0e-12.3,\"next\"", isValidNumber, ',');
|
||||
assertValid("+1.0e+12.3,\"next\"", isValidNumber, ',');
|
||||
|
||||
assertValid("0x12FF,\"next\"", isValidNumber, ',');
|
||||
#ifdef JSON_OCTAL
|
||||
assertNotValid("0128,\"next\"", isValidNumber, ','); //because of the 8
|
||||
assertValid("0123,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("-0128,\"next\"", isValidNumber, ',');
|
||||
assertValid("-0123,\"next\"", isValidNumber, ',');
|
||||
#else
|
||||
assertValid("0128,\"next\"", isValidNumber, ','); //because of the 8
|
||||
assertValid("0123,\"next\"", isValidNumber, ',');
|
||||
assertValid("-0128,\"next\"", isValidNumber, ',');
|
||||
assertValid("-0123,\"next\"", isValidNumber, ',');
|
||||
#endif
|
||||
|
||||
|
||||
assertValid("0xABCD,\"next\"", isValidNumber, ',');
|
||||
assertValid("0124,\"next\"", isValidNumber, ',');
|
||||
assertValid("+1,\"next\"", isValidNumber, ',');
|
||||
assertValid("+1.,\"next\"", isValidNumber, ',');
|
||||
assertValid("+0.0,\"next\"", isValidNumber, ',');
|
||||
assertValid("+1.0,\"next\"", isValidNumber, ',');
|
||||
assertValid("+0e2,\"next\"", isValidNumber, ',');
|
||||
assertValid("+1e2,\"next\"", isValidNumber, ',');
|
||||
assertValid("+0.e2,\"next\"", isValidNumber, ',');
|
||||
assertValid("+1.e2,\"next\"", isValidNumber, ',');
|
||||
assertValid("+0.0e2,\"next\"", isValidNumber, ',');
|
||||
assertValid("+1.0e2,\"next\"", isValidNumber, ',');
|
||||
assertValid("+0e-2,\"next\"", isValidNumber, ',');
|
||||
assertValid("+1e-2,\"next\"", isValidNumber, ',');
|
||||
assertValid("+0.e-2,\"next\"", isValidNumber, ',');
|
||||
assertValid("+1.e-2,\"next\"", isValidNumber, ',');
|
||||
assertValid("+0e+2,\"next\"", isValidNumber, ',');
|
||||
assertValid("+1e+2,\"next\"", isValidNumber, ',');
|
||||
assertValid("+0.e+2,\"next\"", isValidNumber, ',');
|
||||
assertValid("+1.e+2,\"next\"", isValidNumber, ',');
|
||||
assertValid("+0.0e+2,\"next\"", isValidNumber, ',');
|
||||
assertValid("+1.0e+2,\"next\"", isValidNumber, ',');
|
||||
|
||||
assertValid("1e-0123,\"next\"", isValidNumber, ',');
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This tests values that aren't numbers at all, to make sure they are
|
||||
* flagged as not valid
|
||||
*/
|
||||
void testJSONValidator__isValidNumber::testNotNumbers(void){
|
||||
#ifdef JSON_VALIDATE
|
||||
assertNotValid("-.,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("-e,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("0xABCDv,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("001234,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("09124,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("0no,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("no,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("n1234,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("12no,\"next\"", isValidNumber, ',');
|
||||
assertNotValid("0en5,\"next\"", isValidNumber, ',');
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This test checks that for all above mentioned valids,
|
||||
* if the string cuts off suddenly, it recovers
|
||||
*/
|
||||
void testJSONValidator__isValidNumber::testSuddenEnd(void){
|
||||
#ifdef JSON_VALIDATE
|
||||
assertNotValid("", isValidNumber, ',');
|
||||
|
||||
//--- void testJSONValidator__isValidNumber::testPositive(void){
|
||||
assertNotValid("123", isValidNumber, ',');
|
||||
assertNotValid("12.3", isValidNumber, ',');
|
||||
assertNotValid("0.123", isValidNumber, ',');
|
||||
assertNotValid("0", isValidNumber, ',');
|
||||
assertNotValid("0.", isValidNumber, ',');
|
||||
assertNotValid("1.", isValidNumber, ',');
|
||||
assertNotValid("1", isValidNumber, ',');
|
||||
assertNotValid("0.0", isValidNumber, ',');
|
||||
assertNotValid("1.0", isValidNumber, ',');
|
||||
assertNotValid("1.01", isValidNumber, ',');
|
||||
assertNotValid("0123", isValidNumber, ',');
|
||||
|
||||
//--- void testJSONValidator__isValidNumber::testNegative(void){
|
||||
assertNotValid("-123", isValidNumber, ',');
|
||||
assertNotValid("-12.3", isValidNumber, ',');
|
||||
assertNotValid("-0.123", isValidNumber, ',');
|
||||
assertNotValid("-0", isValidNumber, ',');
|
||||
assertNotValid("-0.", isValidNumber, ',');
|
||||
assertNotValid("-1", isValidNumber, ',');
|
||||
assertNotValid("-1.", isValidNumber, ',');
|
||||
assertNotValid("-0.0", isValidNumber, ',');
|
||||
assertNotValid("-1.0", isValidNumber, ',');
|
||||
assertNotValid("-1.01", isValidNumber, ',');
|
||||
assertNotValid("-0123", isValidNumber, ',');
|
||||
|
||||
//--- void testJSONValidator__isValidNumber::testPositive_ScientificNotation(void){
|
||||
assertNotValid("0e", isValidNumber, ',');
|
||||
assertNotValid("0E", isValidNumber, ',');
|
||||
assertNotValid("0e123", isValidNumber, ',');
|
||||
assertNotValid("0e12.3", isValidNumber, ',');
|
||||
assertNotValid("1.e123", isValidNumber, ',');
|
||||
assertNotValid("1.e12.3", isValidNumber, ',');
|
||||
assertNotValid("1.0e123", isValidNumber, ',');
|
||||
assertNotValid("1.0e12.3", isValidNumber, ',');
|
||||
assertNotValid("0e2", isValidNumber, ',');
|
||||
assertNotValid("1e2", isValidNumber, ',');
|
||||
assertNotValid("0.e2", isValidNumber, ',');
|
||||
assertNotValid("1.e2", isValidNumber, ',');
|
||||
assertNotValid("0.0e2", isValidNumber, ',');
|
||||
assertNotValid("1.0e2", isValidNumber, ',');
|
||||
|
||||
//--- void testJSONValidator__isValidNumber::testNegative_ScientificNotation(void){
|
||||
assertNotValid("-0e123", isValidNumber, ',');
|
||||
assertNotValid("-0e12.3", isValidNumber, ',');
|
||||
assertNotValid("-1.e123", isValidNumber, ',');
|
||||
assertNotValid("-1.e12.3", isValidNumber, ',');
|
||||
assertNotValid("-1.0e123", isValidNumber, ',');
|
||||
assertNotValid("-1.0e12.3", isValidNumber, ',');
|
||||
assertNotValid("-0e2", isValidNumber, ',');
|
||||
assertNotValid("-1e2", isValidNumber, ',');
|
||||
assertNotValid("-0.e2", isValidNumber, ',');
|
||||
assertNotValid("-1.e2", isValidNumber, ',');
|
||||
assertNotValid("-0.0e2", isValidNumber, ',');
|
||||
assertNotValid("-1.0e2", isValidNumber, ',');
|
||||
|
||||
//--- void testJSONValidator__isValidNumber::testPositive_SignedScientificNotation(void){
|
||||
assertNotValid("0e-123", isValidNumber, ',');
|
||||
assertNotValid("0e+123", isValidNumber, ',');
|
||||
assertNotValid("0e-12.3", isValidNumber, ',');
|
||||
assertNotValid("0e+12.3", isValidNumber, ',');
|
||||
assertNotValid("1.e-123", isValidNumber, ',');
|
||||
assertNotValid("1.e+123", isValidNumber, ',');
|
||||
assertNotValid("1.e-12.3", isValidNumber, ',');
|
||||
assertNotValid("1.e+12.3", isValidNumber, ',');
|
||||
assertNotValid("1.0e-123", isValidNumber, ',');
|
||||
assertNotValid("1.0e+123", isValidNumber, ',');
|
||||
assertNotValid("1.0e-12.3", isValidNumber, ',');
|
||||
assertNotValid("1.0e+12.3", isValidNumber, ',');
|
||||
assertNotValid("0e2", isValidNumber, ',');
|
||||
assertNotValid("1e2", isValidNumber, ',');
|
||||
assertNotValid("0.e2", isValidNumber, ',');
|
||||
assertNotValid("1.e2", isValidNumber, ',');
|
||||
assertNotValid("0.0e2", isValidNumber, ',');
|
||||
assertNotValid("1.0e2", isValidNumber, ',');
|
||||
|
||||
//--- void testJSONValidator__isValidNumber::testNegative_SignedScientificNotation(void){
|
||||
assertNotValid("-0e-123", isValidNumber, ',');
|
||||
assertNotValid("-0e+123", isValidNumber, ',');
|
||||
assertNotValid("-0e-12.3", isValidNumber, ',');
|
||||
assertNotValid("-0e+12.3", isValidNumber, ',');
|
||||
assertNotValid("-0.e-123", isValidNumber, ',');
|
||||
assertNotValid("-0.e+123", isValidNumber, ',');
|
||||
assertNotValid("-1.e-123", isValidNumber, ',');
|
||||
assertNotValid("-1.e+123", isValidNumber, ',');
|
||||
assertNotValid("-1.e-12.3", isValidNumber, ',');
|
||||
assertNotValid("-1.e+12.3", isValidNumber, ',');
|
||||
assertNotValid("-0.0e-123", isValidNumber, ',');
|
||||
assertNotValid("-0.0e+123", isValidNumber, ',');
|
||||
assertNotValid("-1.0e-123", isValidNumber, ',');
|
||||
assertNotValid("-1.0e+123", isValidNumber, ',');
|
||||
assertNotValid("-1.0e-12.3", isValidNumber, ',');
|
||||
assertNotValid("-1.0e+12.3", isValidNumber, ',');
|
||||
assertNotValid("-0e-2", isValidNumber, ',');
|
||||
assertNotValid("-1e-2", isValidNumber, ',');
|
||||
assertNotValid("-0.e-2", isValidNumber, ',');
|
||||
assertNotValid("-1.e-2", isValidNumber, ',');
|
||||
assertNotValid("-0.0e-2", isValidNumber, ',');
|
||||
assertNotValid("-1.0e-2", isValidNumber, ',');
|
||||
assertNotValid("-0e+2", isValidNumber, ',');
|
||||
assertNotValid("-1e+2", isValidNumber, ',');
|
||||
assertNotValid("-0.e+2", isValidNumber, ',');
|
||||
assertNotValid("-1.e+2", isValidNumber, ',');
|
||||
assertNotValid("-0.0e+2", isValidNumber, ',');
|
||||
assertNotValid("-1.0e+2", isValidNumber, ',');
|
||||
|
||||
//strict stuff
|
||||
assertNotValid(".01", isValidNumber, ','); //no leading 0 as required by the standard
|
||||
assertNotValid("-.01", isValidNumber, ','); //no leading 0 as required by the standard
|
||||
assertNotValid("+123", isValidNumber, ','); //no leading +
|
||||
assertNotValid("+12.3", isValidNumber, ',');
|
||||
assertNotValid("+0.123", isValidNumber, ',');
|
||||
assertNotValid("+0e123", isValidNumber, ',');
|
||||
assertNotValid("+0e-123", isValidNumber, ',');
|
||||
assertNotValid("+0e+123", isValidNumber, ',');
|
||||
assertNotValid("+1.e123", isValidNumber, ',');
|
||||
assertNotValid("+1.e-123", isValidNumber, ',');
|
||||
assertNotValid("+1.e+123", isValidNumber, ',');
|
||||
assertNotValid("+1.0e123", isValidNumber, ',');
|
||||
assertNotValid("+1.0e-123", isValidNumber, ',');
|
||||
assertNotValid("+1.0e+123", isValidNumber, ',');
|
||||
assertNotValid("+0e12.3", isValidNumber, ',');
|
||||
assertNotValid("+0e-12.3", isValidNumber, ',');
|
||||
assertNotValid("+0e+12.3", isValidNumber, ',');
|
||||
assertNotValid("+1.e12.3", isValidNumber, ',');
|
||||
assertNotValid("+1.e-12.3", isValidNumber, ',');
|
||||
assertNotValid("+1.e+12.3", isValidNumber, ',');
|
||||
assertNotValid("+1.0e12.3", isValidNumber, ',');
|
||||
assertNotValid("+1.0e-12.3", isValidNumber, ',');
|
||||
assertNotValid("+1.0e+12.3", isValidNumber, ',');
|
||||
assertNotValid("0x12FF", isValidNumber, ',');
|
||||
assertNotValid("0128", isValidNumber, ','); //legal because in STRICT mode, this is not octal, leading zero is ignored
|
||||
assertNotValid("0xABCD", isValidNumber, ',');
|
||||
assertNotValid("0124", isValidNumber, ',');
|
||||
assertNotValid("+1", isValidNumber, ',');
|
||||
assertNotValid("+1.", isValidNumber, ',');
|
||||
assertNotValid("+0.0", isValidNumber, ',');
|
||||
assertNotValid("+1.0", isValidNumber, ',');
|
||||
assertNotValid("+0e2", isValidNumber, ',');
|
||||
assertNotValid("+1e2", isValidNumber, ',');
|
||||
assertNotValid("+0.e2", isValidNumber, ',');
|
||||
assertNotValid("+1.e2", isValidNumber, ',');
|
||||
assertNotValid("+0.0e2", isValidNumber, ',');
|
||||
assertNotValid("+1.0e2", isValidNumber, ',');
|
||||
assertNotValid("+0e-2", isValidNumber, ',');
|
||||
assertNotValid("+1e-2", isValidNumber, ',');
|
||||
assertNotValid("+0.e-2", isValidNumber, ',');
|
||||
assertNotValid("+1.e-2", isValidNumber, ',');
|
||||
assertNotValid("+0e+2", isValidNumber, ',');
|
||||
assertNotValid("+1e+2", isValidNumber, ',');
|
||||
assertNotValid("+0.e+2", isValidNumber, ',');
|
||||
assertNotValid("+1.e+2", isValidNumber, ',');
|
||||
assertNotValid("+0.0e+2", isValidNumber, ',');
|
||||
assertNotValid("+1.0e+2", isValidNumber, ',');
|
||||
assertNotValid("0128", isValidNumber, ','); //because of the 8
|
||||
|
||||
|
||||
//--- void testJSONValidator__isValidNumber::testNotNumbers(void){
|
||||
assertNotValid("0xABCDv", isValidNumber, ',');
|
||||
assertNotValid("001234", isValidNumber, ',');
|
||||
assertNotValid("09124", isValidNumber, ',');
|
||||
assertNotValid("0no", isValidNumber, ',');
|
||||
assertNotValid("no", isValidNumber, ',');
|
||||
assertNotValid("n1234", isValidNumber, ',');
|
||||
assertNotValid("12no", isValidNumber, ',');
|
||||
assertNotValid("0en5", isValidNumber, ',');
|
||||
#endif
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
#ifndef JSON_TESTSUITE_JSON_VALIDATOR__IS_VALID_NUMBER_H
|
||||
#define JSON_TESTSUITE_JSON_VALIDATOR__IS_VALID_NUMBER_H
|
||||
|
||||
#include "../BaseTest.h"
|
||||
|
||||
class testJSONValidator__isValidNumber : public BaseTest {
|
||||
public:
|
||||
testJSONValidator__isValidNumber(const std::string & name) : BaseTest(name){}
|
||||
void testPositive(void);
|
||||
void testNegative(void);
|
||||
void testPositive_ScientificNotation(void);
|
||||
void testNegative_ScientificNotation(void);
|
||||
void testPositive_SignedScientificNotation(void);
|
||||
void testNegative_SignedScientificNotation(void);
|
||||
void testStrict(void);
|
||||
void testNotStrict(void);
|
||||
void testNotNumbers(void);
|
||||
void testSuddenEnd(void);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,11 +0,0 @@
|
|||
/*
|
||||
* isValidObject.cpp
|
||||
* TestSuite
|
||||
*
|
||||
* Created by Jonathan Wallace on 11/13/11.
|
||||
* Copyright 2011 StreamWIDE. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "isValidObject.h"
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
/*
|
||||
* isValidObject.h
|
||||
* TestSuite
|
||||
*
|
||||
* Created by Jonathan Wallace on 11/13/11.
|
||||
* Copyright 2011 StreamWIDE. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
/*
|
||||
* isValidPartialRoot.cpp
|
||||
* TestSuite
|
||||
*
|
||||
* Created by Jonathan Wallace on 11/13/11.
|
||||
* Copyright 2011 StreamWIDE. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "isValidPartialRoot.h"
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
/*
|
||||
* isValidPartialRoot.h
|
||||
* TestSuite
|
||||
*
|
||||
* Created by Jonathan Wallace on 11/13/11.
|
||||
* Copyright 2011 StreamWIDE. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
#include "isValidRoot.h"
|
||||
#include "Resources/validyMacros.h"
|
||||
#include "../../Source/JSONValidator.h"
|
||||
|
||||
void testJSONValidator__isValidRoot::testRoots(void){
|
||||
#ifdef JSON_VALIDATE
|
||||
assertTrue(JSONValidator::isValidRoot(JSON_TEXT("{}")));
|
||||
assertTrue(JSONValidator::isValidRoot(JSON_TEXT("[]")));
|
||||
assertTrue(JSONValidator::isValidRoot(JSON_TEXT("[\"stuff\"]")));
|
||||
#endif
|
||||
}
|
||||
|
||||
void testJSONValidator__isValidRoot::testNotRoots(void){
|
||||
#ifdef JSON_VALIDATE
|
||||
assertFalse(JSONValidator::isValidRoot(JSON_TEXT("{]")));
|
||||
assertFalse(JSONValidator::isValidRoot(JSON_TEXT("[}")));
|
||||
assertFalse(JSONValidator::isValidRoot(JSON_TEXT("{}aoe")));
|
||||
assertFalse(JSONValidator::isValidRoot(JSON_TEXT("[]aoe")));
|
||||
assertFalse(JSONValidator::isValidRoot(JSON_TEXT("aoe")));
|
||||
assertFalse(JSONValidator::isValidRoot(JSON_TEXT("")));
|
||||
assertFalse(JSONValidator::isValidRoot(JSON_TEXT("[\"stuff\":{},]")));
|
||||
#endif
|
||||
}
|
||||
|
||||
void testJSONValidator__isValidRoot::testSuddenEnd(void){
|
||||
#ifdef JSON_VALIDATE
|
||||
assertFalse(JSONValidator::isValidRoot(JSON_TEXT("")));
|
||||
|
||||
//--- void testJSONValidator__isValidRoot::testRoots(void){
|
||||
assertFalse(JSONValidator::isValidRoot(JSON_TEXT("{")));
|
||||
assertFalse(JSONValidator::isValidRoot(JSON_TEXT("[")));
|
||||
assertFalse(JSONValidator::isValidRoot(JSON_TEXT("[\"stuff")));
|
||||
|
||||
//---void testJSONValidator__isValidRoot::testNotRoots(void){
|
||||
assertFalse(JSONValidator::isValidRoot(JSON_TEXT("{}aoe")));
|
||||
assertFalse(JSONValidator::isValidRoot(JSON_TEXT("[]aoe")));
|
||||
assertFalse(JSONValidator::isValidRoot(JSON_TEXT("aoe")));
|
||||
#endif
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
#ifndef JSON_TESTSUITE_JSON_VALIDATOR__IS_VALID_ROOT_H
|
||||
#define JSON_TESTSUITE_JSON_VALIDATOR__IS_VALID_ROOT_H
|
||||
|
||||
#include "../BaseTest.h"
|
||||
|
||||
class testJSONValidator__isValidRoot : public BaseTest {
|
||||
public:
|
||||
testJSONValidator__isValidRoot(const std::string & name) : BaseTest(name){}
|
||||
void testRoots(void);
|
||||
void testNotRoots(void);
|
||||
void testSuddenEnd(void);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,63 +0,0 @@
|
|||
#include "isValidString.h"
|
||||
#include "Resources/validyMacros.h"
|
||||
#include "../../Source/JSONValidator.h"
|
||||
|
||||
void testJSONValidator__isValidString::testNormal(void){
|
||||
assertValid("hello\":123", isValidString, ':');
|
||||
assertValid("he\\\"ll\\\"o\":123", isValidString, ':');
|
||||
}
|
||||
|
||||
void testJSONValidator__isValidString::testUnicode(void){
|
||||
assertValid("he\\u1234llo\":123", isValidString, ':');
|
||||
assertValid("he\\u0FFFllo\":123", isValidString, ':');
|
||||
assertNotValid("he\\uFFFGllo\":123", isValidString, ':');
|
||||
}
|
||||
|
||||
void testJSONValidator__isValidString::testStrict(void){
|
||||
#ifdef JSON_STRICT
|
||||
assertNotValid("he\\xFFllo\":123", isValidString, ':');
|
||||
assertNotValid("he\\0123llo\":123", isValidString, ':');
|
||||
#endif
|
||||
}
|
||||
|
||||
void testJSONValidator__isValidString::testNotStrict(void){
|
||||
#ifndef JSON_STRICT
|
||||
assertValid("he\\xFFllo\":123", isValidString, ':');
|
||||
#ifdef JSON_OCTAL
|
||||
assertValid("he\\0123llo\":123", isValidString, ':');
|
||||
#else
|
||||
assertNotValid("he\\0123llo\":123", isValidString, ':');
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void testJSONValidator__isValidString::testNotString(void){
|
||||
assertNotValid("he\\128llo\":123", isValidString, ':'); //not valid even when not strict because of the 8
|
||||
}
|
||||
|
||||
void testJSONValidator__isValidString::testSuddenEnd(void){
|
||||
assertNotValid("he\\", isValidString, ':');
|
||||
assertNotValid("he\\\"", isValidString, ':'); //escaped quote
|
||||
assertNotValid("he\\\"llo\\\"", isValidString, ':'); //two esacaped quotes
|
||||
|
||||
//--- void testJSONValidator__isValidString::testNormal(void){
|
||||
assertNotValid("hello", isValidString, ':');
|
||||
assertNotValid("he\\\"ll\\\"o", isValidString, ':');
|
||||
|
||||
//--- void testJSONValidator__isValidString::testUnicode(void){
|
||||
assertNotValid("he\\u1234llo", isValidString, ':');
|
||||
assertNotValid("he\\u0FF", isValidString, ':');
|
||||
assertNotValid("he\\u0F", isValidString, ':');
|
||||
assertNotValid("he\\u0", isValidString, ':');
|
||||
assertNotValid("he\\u", isValidString, ':');
|
||||
assertNotValid("he\\", isValidString, ':');
|
||||
|
||||
//strict stuff
|
||||
assertNotValid("he\\xFF", isValidString, ':');
|
||||
assertNotValid("he\\xF", isValidString, ':');
|
||||
assertNotValid("he\\x", isValidString, ':');
|
||||
assertNotValid("he\\0123", isValidString, ':');
|
||||
assertNotValid("he\\012", isValidString, ':');
|
||||
assertNotValid("he\\01", isValidString, ':');
|
||||
assertNotValid("he\\0", isValidString, ':');
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
#ifndef JSON_TESTSUITE_JSON_VALIDATOR__IS_VALID_STRING_H
|
||||
#define JSON_TESTSUITE_JSON_VALIDATOR__IS_VALID_STRING_H
|
||||
|
||||
#include "../BaseTest.h"
|
||||
|
||||
class testJSONValidator__isValidString : public BaseTest {
|
||||
public:
|
||||
testJSONValidator__isValidString(const std::string & name) : BaseTest(name){}
|
||||
void testNormal(void);
|
||||
void testUnicode(void);
|
||||
void testStrict(void);
|
||||
void testNotStrict(void);
|
||||
void testNotString(void);
|
||||
void testSuddenEnd(void);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,27 +0,0 @@
|
|||
#include "securityTest.h"
|
||||
#include "Resources/validyMacros.h"
|
||||
#include "../../Source/JSONValidator.h"
|
||||
|
||||
void testJSONValidator__securityTest::testsecurity(void){
|
||||
#ifdef JSON_SECURITY_MAX_NEST_LEVEL
|
||||
#if (JSON_SECURITY_MAX_NEST_LEVEL != 128)
|
||||
#error, test suite only wants a nest security level of 100
|
||||
#endif
|
||||
{
|
||||
json_string json(JSON_TEXT("{"));
|
||||
for(unsigned int i = 0; i < 127; ++i){
|
||||
json += JSON_TEXT("\"n\":{");
|
||||
}
|
||||
json += json_string(128, '}');
|
||||
assertTrue(JSONValidator::isValidRoot(json.c_str()));
|
||||
}
|
||||
{
|
||||
json_string json(JSON_TEXT("{"));
|
||||
for(unsigned int i = 0; i < 128; ++i){
|
||||
json += JSON_TEXT("\"n\":{");
|
||||
}
|
||||
json += json_string(129, '}');
|
||||
assertFalse(JSONValidator::isValidRoot(json.c_str()));
|
||||
}
|
||||
#endif
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
#ifndef JSON_TESTSUITE_JSON_VALIDATOR__SECURITY_TEST_H
|
||||
#define JSON_TESTSUITE_JSON_VALIDATOR__SECURITY_TEST_H
|
||||
|
||||
#include "../BaseTest.h"
|
||||
|
||||
class testJSONValidator__securityTest : public BaseTest {
|
||||
public:
|
||||
testJSONValidator__securityTest(const std::string & name) : BaseTest(name){}
|
||||
void testsecurity(void);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,12 +0,0 @@
|
|||
#include "json_decode64.h"
|
||||
#include "../../Source/JSON_Base64.h"
|
||||
|
||||
void testJSON_Base64__json_decode64::testNotBase64(void){
|
||||
#if defined(JSON_BINARY) || defined(JSON_EXPOSE_BASE64)
|
||||
#ifdef JSON_SAFE
|
||||
assertEquals(JSONBase64::json_decode64(JSON_TEXT("123!abc")), "");
|
||||
assertEquals(JSONBase64::json_decode64(JSON_TEXT("123=abc")), "");
|
||||
assertEquals(JSONBase64::json_decode64(JSON_TEXT("123abc===")), "");
|
||||
#endif
|
||||
#endif
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
#ifndef JSON_TESTSUITE_JSON_BASE64__JSON_DECODE64_H
|
||||
#define JSON_TESTSUITE_JSON_BASE64__JSON_DECODE64_H
|
||||
|
||||
#include "../BaseTest.h"
|
||||
|
||||
class testJSON_Base64__json_decode64 : public BaseTest {
|
||||
public:
|
||||
testJSON_Base64__json_decode64(const std::string & name) : BaseTest(name){}
|
||||
void testNotBase64(void);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,48 +0,0 @@
|
|||
#include "json_encode64.h"
|
||||
#include "../../Source/JSON_Base64.h"
|
||||
|
||||
/**
|
||||
* Make sure that these two function reverse each other
|
||||
*/
|
||||
void testJSON_Base64__json_encode64::testReverseEachOther(void){
|
||||
#if defined(JSON_BINARY) || defined(JSON_EXPOSE_BASE64)
|
||||
#ifdef JSON_SAFE
|
||||
assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"", 0)), "");
|
||||
#endif
|
||||
assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"A", 1)), "A");
|
||||
assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"AB", 2)), "AB");
|
||||
assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"ABC", 3)), "ABC");
|
||||
assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"ABCD", 4)), "ABCD");
|
||||
assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"ABCDE", 5)), "ABCDE");
|
||||
assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"ABCDEF", 6)), "ABCDEF");
|
||||
assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"ABCDEFG", 7)), "ABCDEFG");
|
||||
assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"ABCDEFGH", 8)), "ABCDEFGH");
|
||||
assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"ABCDEFGHI", 9)), "ABCDEFGHI");
|
||||
assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"ABCDEFGHIJ", 10)), "ABCDEFGHIJ");
|
||||
assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"ABCDEFGHIJK", 11)), "ABCDEFGHIJK");
|
||||
assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"ABCDEFGHIJKL", 12)), "ABCDEFGHIJKL");
|
||||
assertEquals(JSONBase64::json_decode64(JSONBase64::json_encode64((unsigned char *)"ABCDEFGHIJKLM", 13)), "ABCDEFGHIJKLM");
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure all characters work in the code
|
||||
*/
|
||||
void testJSON_Base64__json_encode64::testAllChars(void){
|
||||
#if defined(JSON_BINARY) || defined(JSON_EXPOSE_BASE64)
|
||||
|
||||
//create a binary chunk of data to use with every char
|
||||
unsigned char temp[255];
|
||||
for(unsigned int i = 0; i < 255; ++i){
|
||||
temp[i] = (unsigned char)i;
|
||||
}
|
||||
|
||||
//loop through all of the lengths
|
||||
for(unsigned int length = 1; length < 255; ++length){
|
||||
json_string ts = JSONBase64::json_encode64(temp, length);
|
||||
std::string rs = JSONBase64::json_decode64(ts);
|
||||
assertEquals(rs.size(), length);
|
||||
assertEquals(memcmp(rs.data(), temp, length), 0);
|
||||
}
|
||||
#endif
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
#ifndef JSON_TESTSUITE_JSON_BASE64__JSON_ENCODE64_H
|
||||
#define JSON_TESTSUITE_JSON_BASE64__JSON_ENCODE64_H
|
||||
|
||||
#include "../BaseTest.h"
|
||||
|
||||
class testJSON_Base64__json_encode64 : public BaseTest {
|
||||
public:
|
||||
testJSON_Base64__json_encode64(const std::string & name) : BaseTest(name){}
|
||||
void testReverseEachOther(void);
|
||||
void testAllChars(void);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,47 +0,0 @@
|
|||
#include "_areFloatsEqual.h"
|
||||
#include "../../Source/NumberToString.h"
|
||||
|
||||
|
||||
/**
|
||||
* Tests that numbers that are actually equal are identified that way
|
||||
*/
|
||||
void testNumberToString__areFloatsEqual::testEqual(void){
|
||||
assertTrue(_floatsAreEqual( 0.0, 0.0));
|
||||
assertTrue(_floatsAreEqual( 1.0, 1.0));
|
||||
assertTrue(_floatsAreEqual( 1.1, 1.1));
|
||||
assertTrue(_floatsAreEqual(-1.0, -1.0));
|
||||
assertTrue(_floatsAreEqual( 0.1, 0.1));
|
||||
assertTrue(_floatsAreEqual(-0.1, -0.1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Make sure that numbers that are very different are identified as not equal
|
||||
*/
|
||||
void testNumberToString__areFloatsEqual::testNotEqual(void){
|
||||
assertFalse(_floatsAreEqual( 1.0, -1.0));
|
||||
assertFalse(_floatsAreEqual( 1.0, 0.0));
|
||||
assertFalse(_floatsAreEqual(-1.0, -.0));
|
||||
assertFalse(_floatsAreEqual( 0.1, 0.0));
|
||||
assertFalse(_floatsAreEqual(-0.1, 0.0));
|
||||
assertFalse(_floatsAreEqual(1.0, 1.0001));
|
||||
assertFalse(_floatsAreEqual(1.0001, 1.0));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Make sure numbers that are different, but within the threshold of
|
||||
* floats/doubles being equal are identified as equal
|
||||
*/
|
||||
void testNumberToString__areFloatsEqual::testCloseEnough(void){
|
||||
//check the exact threshold
|
||||
assertFalse(_floatsAreEqual( 0.0, JSON_FLOAT_THRESHHOLD));
|
||||
assertFalse(_floatsAreEqual( 0.0, -JSON_FLOAT_THRESHHOLD));
|
||||
|
||||
//check things beneath that threashold
|
||||
assertTrue(_floatsAreEqual(0.0, JSON_FLOAT_THRESHHOLD / 2));
|
||||
assertTrue(_floatsAreEqual(0.0, JSON_FLOAT_THRESHHOLD / -2));
|
||||
assertTrue(_floatsAreEqual(-0.1, -0.1));
|
||||
assertTrue(_floatsAreEqual(1.000000001, 1.0));
|
||||
assertTrue(_floatsAreEqual(1.0, 1.000000001));
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
#ifndef JSON_TESTSUITE_NUMBER_TO_STRING__ARE_FLOATS_EQUAL_H
|
||||
#define JSON_TESTSUITE_NUMBER_TO_STRING__ARE_FLOATS_EQUAL_H
|
||||
|
||||
#include "../BaseTest.h"
|
||||
|
||||
class testNumberToString__areFloatsEqual : public BaseTest {
|
||||
public:
|
||||
testNumberToString__areFloatsEqual(const std::string & name) : BaseTest(name){}
|
||||
void testEqual(void);
|
||||
void testNotEqual(void);
|
||||
void testCloseEnough(void);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,245 +0,0 @@
|
|||
#include "_atof.h"
|
||||
#include "../../Source/NumberToString.h"
|
||||
|
||||
#ifdef JSON_SAFE
|
||||
#define assertNaN(one) assertNAN(json_number, one)
|
||||
#else
|
||||
#define assertNaN(one)
|
||||
#endif
|
||||
|
||||
testNumberToString__atof::testNumberToString__atof(const std::string & name) : BaseTest(name){
|
||||
//ScopeCoverageHeap(_atof, 14);
|
||||
}
|
||||
testNumberToString__atof::~testNumberToString__atof(){
|
||||
//AssertScopeCoverageHeap(_atof);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests regular positive numbers in various forms
|
||||
*/
|
||||
void testNumberToString__atof::testPositive(void){
|
||||
#ifdef JSON_STRICT
|
||||
assertFloatEquals(123, NumberToString::_atof(JSON_TEXT("123")));
|
||||
assertFloatEquals(12.3, NumberToString::_atof(JSON_TEXT("12.3")));
|
||||
assertFloatEquals(0.123, NumberToString::_atof(JSON_TEXT("0.123")));
|
||||
assertFloatEquals(0, NumberToString::_atof(JSON_TEXT("0")));
|
||||
assertFloatEquals(0, NumberToString::_atof(JSON_TEXT("0.")));
|
||||
assertFloatEquals(1, NumberToString::_atof(JSON_TEXT("1.")));
|
||||
assertFloatEquals(1, NumberToString::_atof(JSON_TEXT("1")));
|
||||
assertFloatEquals(0, NumberToString::_atof(JSON_TEXT("0.0")));
|
||||
assertFloatEquals(1, NumberToString::_atof(JSON_TEXT("1.0")));
|
||||
assertFloatEquals(1.01, NumberToString::_atof(JSON_TEXT("1.01")));
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests negative numbers with regular scientifc notation
|
||||
*/
|
||||
void testNumberToString__atof::testNegative(void){
|
||||
#ifdef JSON_STRICT
|
||||
assertFloatEquals(-123, NumberToString::_atof(JSON_TEXT("-123")));
|
||||
assertFloatEquals(-12.3, NumberToString::_atof(JSON_TEXT("-12.3")));
|
||||
assertFloatEquals(-.123, NumberToString::_atof(JSON_TEXT("-0.123")));
|
||||
assertFloatEquals(0, NumberToString::_atof(JSON_TEXT("-0")));
|
||||
assertFloatEquals(0, NumberToString::_atof(JSON_TEXT("-0.")));
|
||||
assertFloatEquals(-1, NumberToString::_atof(JSON_TEXT("-1")));
|
||||
assertFloatEquals(-1, NumberToString::_atof(JSON_TEXT("-1.")));
|
||||
assertFloatEquals(0, NumberToString::_atof(JSON_TEXT("-0.0")));
|
||||
assertFloatEquals(-1, NumberToString::_atof(JSON_TEXT("-1.0")));
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests positive numbers with scientific notiation that has a sign in it
|
||||
*/
|
||||
void testNumberToString__atof::testPositive_ScientificNotation(void){
|
||||
#ifdef JSON_STRICT
|
||||
assertNAN(json_number, std::numeric_limits<json_number>::signaling_NaN()); //sanity check
|
||||
assertFloatEquals(0e3, NumberToString::_atof(JSON_TEXT("0e3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("0e3.3")));
|
||||
|
||||
assertFloatEquals(1e3, NumberToString::_atof(JSON_TEXT("1.e3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("1.e3.3")));
|
||||
assertFloatEquals(1e3, NumberToString::_atof(JSON_TEXT("1.0e3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("1.0e3.3")));
|
||||
|
||||
assertFloatEquals(0e2, NumberToString::_atof(JSON_TEXT("0e2")));
|
||||
assertFloatEquals(1e2, NumberToString::_atof(JSON_TEXT("1e2")));
|
||||
assertFloatEquals(0e2, NumberToString::_atof(JSON_TEXT("0.e2")));
|
||||
assertFloatEquals(1e2, NumberToString::_atof(JSON_TEXT("1.e2")));
|
||||
assertFloatEquals(0e2, NumberToString::_atof(JSON_TEXT("0.0e2")));
|
||||
assertFloatEquals(1e2, NumberToString::_atof(JSON_TEXT("1.0e2")));
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests negative numbers with regular scientifc notation
|
||||
*/
|
||||
void testNumberToString__atof::testNegative_ScientificNotation(void){
|
||||
#ifdef JSON_STRICT
|
||||
assertFloatEquals(0e3, NumberToString::_atof(JSON_TEXT("-0e3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("-0e3.3")));
|
||||
assertFloatEquals(-1e3, NumberToString::_atof(JSON_TEXT("-1.e3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("-1.e3.3")));
|
||||
assertFloatEquals(-1e3, NumberToString::_atof(JSON_TEXT("-1.0e3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("-1.0e3.3")));
|
||||
|
||||
assertFloatEquals(0e2, NumberToString::_atof(JSON_TEXT("-0e2")));
|
||||
assertFloatEquals(-1e2, NumberToString::_atof(JSON_TEXT("-1e2")));
|
||||
assertFloatEquals(0e2, NumberToString::_atof(JSON_TEXT("-0.e2")));
|
||||
assertFloatEquals(-1e2, NumberToString::_atof(JSON_TEXT("-1.e2")));
|
||||
assertFloatEquals(0e2, NumberToString::_atof(JSON_TEXT("-0.0e2")));
|
||||
assertFloatEquals(-1e2, NumberToString::_atof(JSON_TEXT("-1.0e2")));
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests positive numbers with scientific notiation that has a sign in it
|
||||
*/
|
||||
void testNumberToString__atof::testPositive_SignedScientificNotation(void){
|
||||
#ifdef JSON_STRICT
|
||||
assertFloatEquals(0e-3, NumberToString::_atof(JSON_TEXT("0e-3")));
|
||||
assertFloatEquals(0e+3, NumberToString::_atof(JSON_TEXT("0e+3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("0e-3.3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("0e+3.3")));
|
||||
assertFloatEquals(1e-3, NumberToString::_atof(JSON_TEXT("1.e-3")));
|
||||
assertFloatEquals(1e3, NumberToString::_atof(JSON_TEXT("1.e+3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("1.e-3.3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("1.e+3.3")));
|
||||
assertFloatEquals(1e-3, NumberToString::_atof(JSON_TEXT("1.0e-3")));
|
||||
assertFloatEquals(1e3, NumberToString::_atof(JSON_TEXT("1.0e+3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("1.0e-3.3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("1.0e+3.3")));
|
||||
|
||||
assertFloatEquals(0e2, NumberToString::_atof(JSON_TEXT("0e2")));
|
||||
assertFloatEquals(1e2, NumberToString::_atof(JSON_TEXT("1e2")));
|
||||
assertFloatEquals(0e2, NumberToString::_atof(JSON_TEXT("0.e2")));
|
||||
assertFloatEquals(1e2, NumberToString::_atof(JSON_TEXT("1.e2")));
|
||||
assertFloatEquals(0e2, NumberToString::_atof(JSON_TEXT("0.0e2")));
|
||||
assertFloatEquals(1e2, NumberToString::_atof(JSON_TEXT("1.0e2")));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests negative numbers with scientific notiation that has a sign in it
|
||||
*/
|
||||
void testNumberToString__atof::testNegative_SignedScientificNotation(void){
|
||||
#ifdef JSON_STRICT
|
||||
assertFloatEquals(0e-3, NumberToString::_atof(JSON_TEXT("-0e-3")));
|
||||
assertFloatEquals(0e3, NumberToString::_atof(JSON_TEXT("-0e+3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("-0.e-3.3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("-0.e+3.3")));
|
||||
assertFloatEquals(-1e-3, NumberToString::_atof(JSON_TEXT("-1.e-3")));
|
||||
assertFloatEquals(-1e3, NumberToString::_atof(JSON_TEXT("-1.e+3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("-1.e-3.3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("-1.e+3.3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("-0.0e-3.3")));
|
||||
assertNaN( NumberToString::_atof(JSON_TEXT("-0.0e+3.3")));
|
||||
assertFloatEquals(-1e-3, NumberToString::_atof(JSON_TEXT("-1.0e-3")));
|
||||
assertFloatEquals(-1e3, NumberToString::_atof(JSON_TEXT("-1.0e+3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("-1.0e-3.3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("-1.0e+3.3")));
|
||||
|
||||
assertFloatEquals(0e-2, NumberToString::_atof(JSON_TEXT("-0e-2")));
|
||||
assertFloatEquals(-1e-2, NumberToString::_atof(JSON_TEXT("-1e-2")));
|
||||
assertFloatEquals(0e-2, NumberToString::_atof(JSON_TEXT("-0.e-2")));
|
||||
assertFloatEquals(-1e-2, NumberToString::_atof(JSON_TEXT("-1.e-2")));
|
||||
assertFloatEquals(0e-2, NumberToString::_atof(JSON_TEXT("-0.0e-2")));
|
||||
assertFloatEquals(-1e-2, NumberToString::_atof(JSON_TEXT("-1.0e-2")));
|
||||
assertFloatEquals(0e2, NumberToString::_atof(JSON_TEXT("-0e+2")));
|
||||
assertFloatEquals(-1e2, NumberToString::_atof(JSON_TEXT("-1e+2")));
|
||||
assertFloatEquals(0e2, NumberToString::_atof(JSON_TEXT("-0.e+2")));
|
||||
assertFloatEquals(-1e2, NumberToString::_atof(JSON_TEXT("-1.e+2")));
|
||||
assertFloatEquals(0e2, NumberToString::_atof(JSON_TEXT("-0.0e+2")));
|
||||
assertFloatEquals(-1e2, NumberToString::_atof(JSON_TEXT("-1.0e+2")));
|
||||
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("1e-0123"))); //not valid because of negative and leading zero
|
||||
#endif
|
||||
}
|
||||
|
||||
void testNumberToString__atof::testStrict(void){
|
||||
#if defined(JSON_SAFE) || defined(JSON_DEBUG)
|
||||
#ifdef JSON_STRICT
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("00")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("00.01")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT(".01")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("-.01")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+123")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+12.3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+0.123")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+0")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+0.")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+0e3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+0e-3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+0e+3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+1.e3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+1.e-3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+1.e+3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+1.0e3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+1.0e-3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+1.0e+3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+1.e3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+0e3.3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+0e-3.3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+0e+3.3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+1.e3.3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+1.e-3.3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+1.e+3.3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+1.0e3.3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+1.0e-3.3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+1.0e+3.3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+1.e3.3")));
|
||||
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("0x12FF")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("0128")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("0123")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("-0123")));
|
||||
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("0xABCD")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("0124")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+1")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+1.")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+0.0")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+1.0")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+0e2")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+1e2")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+0.e2")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+1.e2")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+0.0e2")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+1.0e2")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+0e-2")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+1e-2")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+0.e-2")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+1.e-2")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+0.0e-2")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+1.0e-2")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+0e+2")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+1e+2")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+0.e+2")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+1.e+2")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+0.0e+2")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("+1.0e+2")));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void testNumberToString__atof::testNotNumbers(void){
|
||||
#if defined(JSON_SAFE) || defined(JSON_DEBUG)
|
||||
#ifdef JSON_STRICT
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("-.")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("-e3")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("0xABCDv")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("00124")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("09124")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("0no")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("no")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("n1234")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("12no")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("0en5")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("0e")));
|
||||
assertNaN(NumberToString::_atof(JSON_TEXT("0E")));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
#ifndef JSON_TESTSUITE_NUMBER_TO_STRING__ATOF_H
|
||||
#define JSON_TESTSUITE_NUMBER_TO_STRING__ATOF_H
|
||||
|
||||
#include "../BaseTest.h"
|
||||
|
||||
class testNumberToString__atof : public BaseTest {
|
||||
public:
|
||||
testNumberToString__atof(const std::string & name);
|
||||
virtual ~testNumberToString__atof();
|
||||
void testPositive(void);
|
||||
void testNegative(void);
|
||||
void testPositive_ScientificNotation(void);
|
||||
void testNegative_ScientificNotation(void);
|
||||
void testPositive_SignedScientificNotation(void);
|
||||
void testNegative_SignedScientificNotation(void);
|
||||
void testStrict(void);
|
||||
void testNotNumbers(void);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,38 +0,0 @@
|
|||
#include "_ftoa.h"
|
||||
#include "../../Source/NumberToString.h"
|
||||
|
||||
|
||||
/**
|
||||
* Test that the float to string function works
|
||||
*/
|
||||
void testNumberToString__ftoa::testRandomNumbers(void){
|
||||
//random numbers to varying precision
|
||||
assertEquals(NumberToString::_ftoa((json_number) 1.2), JSON_TEXT( "1.2"));
|
||||
assertEquals(NumberToString::_ftoa((json_number) -1.2), JSON_TEXT( "-1.2"));
|
||||
assertEquals(NumberToString::_ftoa((json_number) 1.02), JSON_TEXT( "1.02"));
|
||||
assertEquals(NumberToString::_ftoa((json_number) -1.02), JSON_TEXT( "-1.02"));
|
||||
assertEquals(NumberToString::_ftoa((json_number) 1.002), JSON_TEXT( "1.002"));
|
||||
assertEquals(NumberToString::_ftoa((json_number) -1.002), JSON_TEXT( "-1.002"));
|
||||
assertEquals(NumberToString::_ftoa((json_number) 3.1415), JSON_TEXT( "3.1415"));
|
||||
assertEquals(NumberToString::_ftoa((json_number) -3.1415), JSON_TEXT( "-3.1415"));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function reverts to one of the int functions in case of an int because
|
||||
* they are faster. This tests that.
|
||||
*/
|
||||
void testNumberToString__ftoa::testSpecializedInts(void){
|
||||
assertEquals(NumberToString::_ftoa((json_number) 1.0), JSON_TEXT( "1"));
|
||||
assertEquals(NumberToString::_ftoa((json_number) 10.0), JSON_TEXT( "10"));
|
||||
assertEquals(NumberToString::_ftoa((json_number) -1.0), JSON_TEXT( "-1"));
|
||||
assertEquals(NumberToString::_ftoa((json_number)-10.0), JSON_TEXT("-10"));
|
||||
assertEquals(NumberToString::_ftoa((json_number) 0.0), JSON_TEXT( "0"));
|
||||
assertEquals(NumberToString::_ftoa((json_number) -0.0), JSON_TEXT( "0"));
|
||||
|
||||
//close enough to an int
|
||||
assertEquals(NumberToString::_ftoa((json_number) 1.000000001), JSON_TEXT( "1"));
|
||||
assertEquals(NumberToString::_ftoa((json_number) -1.000000001), JSON_TEXT( "-1"));
|
||||
assertEquals(NumberToString::_ftoa((json_number) 0.000000001), JSON_TEXT( "0"));
|
||||
assertEquals(NumberToString::_ftoa((json_number) -0.000000001), JSON_TEXT( "0"));
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
#ifndef JSON_TESTSUITE_NUMBER_TO_STRING__FTOA_H
|
||||
#define JSON_TESTSUITE_NUMBER_TO_STRING__FTOA_H
|
||||
|
||||
#include "../BaseTest.h"
|
||||
|
||||
class testNumberToString__ftoa : public BaseTest {
|
||||
public:
|
||||
testNumberToString__ftoa(const std::string & name) : BaseTest(name){}
|
||||
void testRandomNumbers(void);
|
||||
void testSpecializedInts(void);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,108 +0,0 @@
|
|||
#include "_itoa.h"
|
||||
#include "../../Source/NumberToString.h"
|
||||
|
||||
|
||||
/**
|
||||
* Test converting a char value into a string
|
||||
*/
|
||||
void testNumberToString__itoa::testChar(void){
|
||||
//GetScopeCoverage(_itoa, true);
|
||||
assertEquals(sizeof(char), 1);
|
||||
assertEquals(NumberToString::_itoa<char>((char)127), JSON_TEXT("127"));
|
||||
assertEquals(NumberToString::_itoa<char>((char)15), JSON_TEXT("15"));
|
||||
assertEquals(NumberToString::_itoa<char>((char)0), JSON_TEXT("0"));
|
||||
assertEquals(NumberToString::_itoa<char>((char)-0), JSON_TEXT("0"));
|
||||
assertEquals(NumberToString::_itoa<char>((char)-15), JSON_TEXT("-15"));
|
||||
assertEquals(NumberToString::_itoa<char>((char)-127), JSON_TEXT("-127"));
|
||||
//AssertScopeCoverage(_itoa);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test converting a short value into a string
|
||||
*/
|
||||
void testNumberToString__itoa::testShort(void){
|
||||
//GetScopeCoverage(_itoa, true);
|
||||
assertEquals(sizeof(short), 2);
|
||||
assertEquals(NumberToString::_itoa<short>((short)32767), JSON_TEXT("32767"));
|
||||
assertEquals(NumberToString::_itoa<short>((short)127), JSON_TEXT("127"));
|
||||
assertEquals(NumberToString::_itoa<short>((short)15), JSON_TEXT("15"));
|
||||
assertEquals(NumberToString::_itoa<short>((short)0), JSON_TEXT("0"));
|
||||
assertEquals(NumberToString::_itoa<short>((short)-0), JSON_TEXT("0"));
|
||||
assertEquals(NumberToString::_itoa<short>((short)-15), JSON_TEXT("-15"));
|
||||
assertEquals(NumberToString::_itoa<short>((short)-127), JSON_TEXT("-127"));
|
||||
assertEquals(NumberToString::_itoa<short>((short)-32767), JSON_TEXT("-32767"));
|
||||
//AssertScopeCoverage(_itoa);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test converting an int value into a string
|
||||
*/
|
||||
void testNumberToString__itoa::testInt(void){
|
||||
//GetScopeCoverage(_itoa, true);
|
||||
assertEquals(sizeof(int), 4);
|
||||
assertEquals(NumberToString::_itoa<int>((int)2147483647), JSON_TEXT("2147483647"));
|
||||
assertEquals(NumberToString::_itoa<int>((int)32767), JSON_TEXT("32767"));
|
||||
assertEquals(NumberToString::_itoa<int>((int)127), JSON_TEXT("127"));
|
||||
assertEquals(NumberToString::_itoa<int>((int)15), JSON_TEXT("15"));
|
||||
assertEquals(NumberToString::_itoa<int>((int)0), JSON_TEXT("0"));
|
||||
assertEquals(NumberToString::_itoa<int>((int)-0), JSON_TEXT("0"));
|
||||
assertEquals(NumberToString::_itoa<int>((int)-15), JSON_TEXT("-15"));
|
||||
assertEquals(NumberToString::_itoa<int>((int)-127), JSON_TEXT("-127"));
|
||||
assertEquals(NumberToString::_itoa<int>((int)-32767), JSON_TEXT("-32767"));
|
||||
assertEquals(NumberToString::_itoa<int>((int)-2147483647), JSON_TEXT("-2147483647"));
|
||||
//AssertScopeCoverage(_itoa);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test converting a long value into a string
|
||||
*/
|
||||
void testNumberToString__itoa::testLong(void){
|
||||
//GetScopeCoverage(_itoa, true);
|
||||
#ifdef TEST_LONG_EXTREMES
|
||||
if (sizeof(long) >= 8){
|
||||
assertEquals(NumberToString::_itoa<long>((long)9223372036854775807L), JSON_TEXT("9223372036854775807"));
|
||||
assertEquals(NumberToString::_itoa<long>((long)-9223372036854775807L), JSON_TEXT("-9223372036854775807"));
|
||||
}
|
||||
#endif
|
||||
assertEquals(NumberToString::_itoa<long>((long)2147483647), JSON_TEXT("2147483647"));
|
||||
assertEquals(NumberToString::_itoa<long>((long)32767), JSON_TEXT("32767"));
|
||||
assertEquals(NumberToString::_itoa<long>((long)127), JSON_TEXT("127"));
|
||||
assertEquals(NumberToString::_itoa<long>((long)15), JSON_TEXT("15"));
|
||||
assertEquals(NumberToString::_itoa<long>((long)0), JSON_TEXT("0"));
|
||||
assertEquals(NumberToString::_itoa<long>((long)-0), JSON_TEXT("0"));
|
||||
assertEquals(NumberToString::_itoa<long>((long)-15), JSON_TEXT("-15"));
|
||||
assertEquals(NumberToString::_itoa<long>((long)-127), JSON_TEXT("-127"));
|
||||
assertEquals(NumberToString::_itoa<long>((long)-32767), JSON_TEXT("-32767"));
|
||||
assertEquals(NumberToString::_itoa<long>((long)-2147483647), JSON_TEXT("-2147483647"));
|
||||
//AssertScopeCoverage(_itoa);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test converting a long long value into a string
|
||||
*/
|
||||
void testNumberToString__itoa::testLongLong(void){
|
||||
#ifndef JSON_ISO_STRICT
|
||||
//GetScopeCoverage(_itoa, true);
|
||||
#ifdef TEST_LONG_EXTREMES
|
||||
if (sizeof(long long) >= 8){
|
||||
assertEquals(NumberToString::_itoa<long long>((long long)9223372036854775807L), JSON_TEXT("9223372036854775807"));
|
||||
assertEquals(NumberToString::_itoa<long long>((long long)-9223372036854775807L), JSON_TEXT("-9223372036854775807"));
|
||||
}
|
||||
#endif
|
||||
assertEquals(NumberToString::_itoa<long long>((long long)2147483647), JSON_TEXT("2147483647"));
|
||||
assertEquals(NumberToString::_itoa<long long>((long long)32767), JSON_TEXT("32767"));
|
||||
assertEquals(NumberToString::_itoa<long long>((long long)127), JSON_TEXT("127"));
|
||||
assertEquals(NumberToString::_itoa<long long>((long long)15), JSON_TEXT("15"));
|
||||
assertEquals(NumberToString::_itoa<long long>((long long)0), JSON_TEXT("0"));
|
||||
assertEquals(NumberToString::_itoa<long long>((long long)-0), JSON_TEXT("0"));
|
||||
assertEquals(NumberToString::_itoa<long long>((long long)-15), JSON_TEXT("-15"));
|
||||
assertEquals(NumberToString::_itoa<long long>((long long)-127), JSON_TEXT("-127"));
|
||||
assertEquals(NumberToString::_itoa<long long>((long long)-32767), JSON_TEXT("-32767"));
|
||||
assertEquals(NumberToString::_itoa<long long>((long long)-2147483647), JSON_TEXT("-2147483647"));
|
||||
//AssertScopeCoverage(_itoa);
|
||||
#endif
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
#ifndef JSON_TESTSUITE_NUMBER_TO_STRING__ITOA_H
|
||||
#define JSON_TESTSUITE_NUMBER_TO_STRING__ITOA_H
|
||||
|
||||
#include "../BaseTest.h"
|
||||
|
||||
class testNumberToString__itoa : public BaseTest {
|
||||
public:
|
||||
testNumberToString__itoa(const std::string & name) : BaseTest(name){}
|
||||
void testChar(void);
|
||||
void testShort(void);
|
||||
void testInt(void);
|
||||
void testLong(void);
|
||||
void testLongLong(void);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,90 +0,0 @@
|
|||
#include "_uitoa.h"
|
||||
#include "../../Source/NumberToString.h"
|
||||
|
||||
|
||||
/**
|
||||
* Test converting a char value into a string
|
||||
*/
|
||||
void testNumberToString__uitoa::testChar(void){
|
||||
#ifndef JSON_LIBRARY
|
||||
assertEquals(sizeof(unsigned char), 1);
|
||||
assertEquals(NumberToString::_uitoa<unsigned char>((unsigned char)255), JSON_TEXT("255"));
|
||||
assertEquals(NumberToString::_uitoa<unsigned char>((unsigned char)127), JSON_TEXT("127"));
|
||||
assertEquals(NumberToString::_uitoa<unsigned char>((unsigned char)15), JSON_TEXT("15"));
|
||||
assertEquals(NumberToString::_uitoa<unsigned char>((unsigned char)0), JSON_TEXT("0"));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test converting a short value into a string
|
||||
*/
|
||||
void testNumberToString__uitoa::testShort(void){
|
||||
#ifndef JSON_LIBRARY
|
||||
assertEquals(sizeof(unsigned short), 2);
|
||||
assertEquals(NumberToString::_uitoa<unsigned short>((unsigned short)65535), JSON_TEXT("65535"));
|
||||
assertEquals(NumberToString::_uitoa<unsigned short>((unsigned short)32767), JSON_TEXT("32767"));
|
||||
assertEquals(NumberToString::_uitoa<unsigned short>((unsigned short)127), JSON_TEXT("127"));
|
||||
assertEquals(NumberToString::_uitoa<unsigned short>((unsigned short)15), JSON_TEXT("15"));
|
||||
assertEquals(NumberToString::_uitoa<unsigned short>((unsigned short)0), JSON_TEXT("0"));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test converting a int value into a string
|
||||
*/
|
||||
void testNumberToString__uitoa::testInt(void){
|
||||
#ifndef JSON_LIBRARY
|
||||
assertEquals(sizeof(unsigned int), 4);
|
||||
assertEquals(NumberToString::_uitoa<unsigned int>((unsigned int)4294967295u), JSON_TEXT("4294967295"));
|
||||
assertEquals(NumberToString::_uitoa<unsigned int>((unsigned int)2147483647), JSON_TEXT("2147483647"));
|
||||
assertEquals(NumberToString::_uitoa<unsigned int>((unsigned int)32767), JSON_TEXT("32767"));
|
||||
assertEquals(NumberToString::_uitoa<unsigned int>((unsigned int)127), JSON_TEXT("127"));
|
||||
assertEquals(NumberToString::_uitoa<unsigned int>((unsigned int)15), JSON_TEXT("15"));
|
||||
assertEquals(NumberToString::_uitoa<unsigned int>((unsigned int)0), JSON_TEXT("0"));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test converting a long value into a string
|
||||
*/
|
||||
void testNumberToString__uitoa::testLong(void){
|
||||
#ifndef JSON_LIBRARY
|
||||
#ifdef TEST_LONG_EXTREMES
|
||||
if (sizeof(unsigned long) >= 8){
|
||||
assertEquals(NumberToString::_uitoa<unsigned long>((unsigned long)18446744073709551615UL), JSON_TEXT("18446744073709551615"));
|
||||
assertEquals(NumberToString::_uitoa<unsigned long>((unsigned long)9223372036854775807L), JSON_TEXT("9223372036854775807"));
|
||||
}
|
||||
#endif
|
||||
assertEquals(NumberToString::_uitoa<unsigned long>((unsigned long)2147483647), JSON_TEXT("2147483647"));
|
||||
assertEquals(NumberToString::_uitoa<unsigned long>((unsigned long)32767), JSON_TEXT("32767"));
|
||||
assertEquals(NumberToString::_uitoa<unsigned long>((unsigned long)127), JSON_TEXT("127"));
|
||||
assertEquals(NumberToString::_uitoa<unsigned long>((unsigned long)15), JSON_TEXT("15"));
|
||||
assertEquals(NumberToString::_uitoa<unsigned long>((unsigned long)0), JSON_TEXT("0"));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test converting a long long value into a string
|
||||
*/
|
||||
void testNumberToString__uitoa::testLongLong(void){
|
||||
#ifndef JSON_LIBRARY
|
||||
#ifndef JSON_ISO_STRICT
|
||||
#ifdef TEST_LONG_EXTREMES
|
||||
if (sizeof(unsigned long long) >= 8){
|
||||
assertEquals(NumberToString::_uitoa<unsigned long>((unsigned long long)18446744073709551615UL), JSON_TEXT("18446744073709551615"));
|
||||
assertEquals(NumberToString::_uitoa<unsigned long long>((unsigned long long)9223372036854775807L), JSON_TEXT("9223372036854775807"));
|
||||
assertEquals(NumberToString::_uitoa<unsigned long long>((unsigned long long)-9223372036854775807L), JSON_TEXT("-9223372036854775807"));
|
||||
}
|
||||
#endif
|
||||
assertEquals(NumberToString::_uitoa<unsigned long long>((unsigned long long)2147483647), JSON_TEXT("2147483647"));
|
||||
assertEquals(NumberToString::_uitoa<unsigned long long>((unsigned long long)32767), JSON_TEXT("32767"));
|
||||
assertEquals(NumberToString::_uitoa<unsigned long long>((unsigned long long)127), JSON_TEXT("127"));
|
||||
assertEquals(NumberToString::_uitoa<unsigned long long>((unsigned long long)15), JSON_TEXT("15"));
|
||||
assertEquals(NumberToString::_uitoa<unsigned long long>((unsigned long long)0), JSON_TEXT("0"));
|
||||
#endif
|
||||
#endif
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
#ifndef JSON_TESTSUITE_NUMBER_TO_STRING__UITOA_H
|
||||
#define JSON_TESTSUITE_NUMBER_TO_STRING__UITOA_H
|
||||
|
||||
#include "../BaseTest.h"
|
||||
|
||||
class testNumberToString__uitoa : public BaseTest {
|
||||
public:
|
||||
testNumberToString__uitoa(const std::string & name) : BaseTest(name){}
|
||||
void testChar(void);
|
||||
void testShort(void);
|
||||
void testInt(void);
|
||||
void testLong(void);
|
||||
void testLongLong(void);
|
||||
};
|
||||
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue