Files
json-c/tests/test_deep_copy.expected
Alexandru Ardelean 1eab22f0da tests: add test_deep_copy test
Seems to perform better than outputting to string
and re-parsing it.

BENCHMARK - 1000000 iterations of 'dst2 = json_tokener_parse(json_object_get_string(src2))' took 20 seconds
BENCHMARK - 1000000 iterations of 'dst2 = json_tokener_parse(json_object_get_string(src2))' took 7 seconds

It should make a difference on embedded systems.
The test was performed on a i5 desktop CPU [~3.5 years of age].

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
2017-11-27 16:17:48 +02:00

141 lines
2.8 KiB
Plaintext

PASSED - loaded input data
PASSED - all json_object_deep_copy() returned succesful
PASSED - all json_object_deep_copy() returned EINVAL for non-null pointer
PASSED - all json_object_equal() tests returned succesful
PASSED - comparison of string output
PASSED - trying to overrwrite an object that has refcount > 1
Printing JSON objects for visual inspection
------------------------------------------------
JSON1
{
"glossary":{
"title":"example glossary",
"GlossDiv":{
"title":"S",
"null_obj":null,
"GlossList":{
"GlossEntry":{
"ID":"SGML",
"SortAs":"SGML",
"GlossTerm":"Standard Generalized Markup Language",
"Acronym":"SGML",
"Abbrev":"ISO 8879:1986",
"GlossDef":{
"para":"A meta-markup language, used to create markup languages such as DocBook.",
"GlossSeeAlso":[
"GML",
"XML"
]
},
"GlossSee":"markup"
}
}
}
}
}------------------------------------------------
------------------------------------------------
JSON2
{
"menu":{
"header":"SVG Viewer",
"items":[
{
"id":"Open"
},
{
"id":"OpenNew",
"label":"Open New"
},
null,
{
"id":"ZoomIn",
"label":"Zoom In"
},
{
"id":"ZoomOut",
"label":"Zoom Out"
},
{
"id":"OriginalView",
"label":"Original View"
},
null,
{
"id":"Quality",
"another_null":null
},
{
"id":"Pause"
},
{
"id":"Mute"
},
null,
{
"id":"Find",
"label":"Find..."
},
{
"id":"FindAgain",
"label":"Find Again"
},
{
"id":"Copy"
},
{
"id":"CopyAgain",
"label":"Copy Again"
},
{
"id":"CopySVG",
"label":"Copy SVG"
},
{
"id":"ViewSVG",
"label":"View SVG"
},
{
"id":"ViewSource",
"label":"View Source"
},
{
"id":"SaveAs",
"label":"Save As"
},
null,
{
"id":"Help"
},
{
"id":"About",
"label":"About Adobe CVG Viewer..."
}
]
}
}------------------------------------------------
------------------------------------------------
JSON3
------------------------------------------------
{
"menu":{
"id":"file",
"value":"File",
"popup":{
"menuitem":[
{
"value":"New",
"onclick":"CreateNewDoc()"
},
{
"value":"Open",
"onclick":"OpenDoc()"
},
{
"value":"Close",
"onclick":"CloseDoc()"
}
]
}
}
}------------------------------------------------