-
Notifications
You must be signed in to change notification settings - Fork 0
/
print_test.c
41 lines (30 loc) · 1.28 KB
/
print_test.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include<stdio.h>
#include<string.h>
#include"parse.h"
#include"print.h"
const char * parseValue(JsonItem *item, const char * json);
char * printValue(JsonItem *item,int depth);
JsonItem * newItem();
int main(){
// char test1[] = "{}";
// JsonItem * item1 = newItem();
// const char * ptr1 = parseValue(item1,test1);
// const char * t1 = printValue(item1,0);
// printf("%s\n",t1);
// char test2[] = "{ \"name\" : \"wdl\" , \"age\" : 18 , \"major\" : \"software engering\" }";
// JsonItem * item2 = newItem();
// const char * ptr2 = parseValue(item2,test2);
// const char * t2 = printValue(item2,0);
// printf("%s\n",t2);
// char test3[] = "[ \"nihao\" , 100 , false , true , null,{ \"hello\" : \"world\" } ]";
// JsonItem * item3 = newItem();
// const char * ptr3 = parseValue(item3,test3);
// const char * t3 = printValue(item3,0);
// printf("%s\n",t3);
char test4[] = "[ \"nihao\" , 100 , false , true , null , { \"hello\" : \"world\" },{ \"name\" : \"wdl\" , \"age\" : 18 , \"major\" : \"software engering\" }]";
JsonItem * item4 = newItem();
const char * ptr4 = parseValue(item4,test4);
const char * t4 = printValue(item4,0);
printf("%s\n",t4);
return 0;
}