blob: 0a5f3153078473b2ae941b495e31af3f43108483 [file] [log] [blame]
w.denge87b5002025-08-20 10:43:03 +08001#ifdef NDEBUG
2#undef NDEBUG
3#endif
4#include <stddef.h>
5#include <stdio.h>
6#include <stdlib.h>
7#include <string.h>
8
9#include "json.h"
10#include "parse_flags.h"
11
12#ifdef TEST_FORMATTED
13#define json_object_to_json_string(obj) json_object_to_json_string_ext(obj, sflags)
14#else
15/* no special define */
16#endif
17
18int main(int argc, char **argv)
19{
20 json_object *new_obj;
21#ifdef TEST_FORMATTED
22 int sflags = 0;
23#endif
24
25 MC_SET_DEBUG(1);
26
27#ifdef TEST_FORMATTED
28 sflags = parse_flags(argc, argv);
29#endif
30
31 new_obj = json_tokener_parse(
32 "/* more difficult test case */"
33 "{ \"glossary\": { \"title\": \"example glossary\", \"GlossDiv\": { \"title\": \"S\", "
34 "\"GlossList\": [ { \"ID\": \"SGML\", \"SortAs\": \"SGML\", \"GlossTerm\": \"Standard "
35 "Generalized Markup Language\", \"Acronym\": \"SGML\", \"Abbrev\": \"ISO 8879:1986\", "
36 "\"GlossDef\": \"A meta-markup language, used to create markup languages such as "
37 "DocBook.\", \"GlossSeeAlso\": [\"GML\", \"XML\", \"markup\"] } ] } } }");
38 printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
39 json_object_put(new_obj);
40
41 return EXIT_SUCCESS;
42}