1 #!/bin/ksh
2 #
3 # This file and its contents are supplied under the terms of the
4 # Common Development and Distribution License ("CDDL"), version 1.0.
5 # You may only use this file in accordance with the terms of version
6 # 1.0 of the CDDL.
7 #
8 # A full copy of the text of the CDDL should have accompanied this
9 # source. A copy of the CDDL is also available via the Internet at
10 # http://www.illumos.org/license/CDDL.
11 #
12
13 #
14 # Copyright (c) 2014, Joyent, Inc.
15 #
16
17 DIR=$(dirname $(whence $0))
18 . ${DIR}/json_common
19
20 BASELINE="$(cat <<EOF
21 {\
22 "a":{},\
23 "b":{\
24 "name":"Roger","age":35\
25 },\
26 "c":{\
27 "d":{\
28 "name":"Stephen","age":27},\
29 "e":{\
30 "name":"Roberta","age":43,"pet":{\
31 "name":"Mister Bumberscratch",\
32 "species":"cat",\
33 "alive":true,\
34 "available_legs":[1,2,3,4]\
35 }\
36 }\
37 }\
38 }
39 EOF)"
40
41 OUTPUT="$(${DIR}/../../bin/print_json <<'EOF'
42 add_object "a";
43 end;
44
45 add_object "b";
46 add_string "name" "Roger";
47 add_uint16 "age" "35";
48 end;
49
50 add_object "c";
51 add_object "d";
52 add_string "name" "Stephen";
53 add_uint16 "age" "27";
54 end;
55 add_object "e";
56 add_string "name" "Roberta";
57 add_uint16 "age" "43";
58 add_object "pet";
59 add_string "name" "Mister Bumberscratch";
60 add_string "species" "cat";
61 add_boolean_value "alive" "true";
62 add_uint8_array "available_legs" "1" "2" "3" "4";
63 end;
64 end;
65 end;
66 EOF)"
67
68 complete