Mercurial > mxe-octave
diff src/json-c-test.c @ 2678:010e74541aca
Test application for json-c.
Squashed commit of the following:
commit 1ad29ec164b9f07781f68fbe39276428105e3d8e
Author: Thomas Mayer <thomas@residuum.org>
Date: Fri Aug 10 20:51:42 2012 +0200
Test for json-c actually outputs something instead of just return 0 or 1.
commit 2650c38c79a627f25c7dda9e89dd1acaca8d3663
Author: Thomas Mayer <thomas@residuum.org>
Date: Sat Aug 4 16:46:28 2012 +0200
Test case for json-c.
author | Thomas Mayer <thomas@residuum.org> |
---|---|
date | Fri, 10 Aug 2012 21:05:20 +0200 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/json-c-test.c Fri Aug 10 21:05:20 2012 +0200 @@ -0,0 +1,23 @@ +/* + * This file is part of MXE. + * See index.html for further information. + */ + +#include <json/json.h> +#include <stdio.h> + +int main(int argc, char *argv[]) +{ + json_object *jobj; + + (void)argc; + (void)argv; + + jobj = json_object_new_object(); + if (!jobj) { + return 1; + } + json_object_object_add(jobj, "key", json_object_new_string("value")); + printf("%s", json_object_to_json_string(jobj)); + return 0; +}