MCPcopy Create free account
hub / github.com/acl-dev/acl / main

Function main

lib_acl_cpp/samples/json/json11/json.cpp:69–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69int main()
70{
71#if 0
72 acl::string bf;
73 const char* p = "\r\nhello\r\nworld\rzsx\nxsz\r\nzsxxsz\r\n\r\n\r\r\r";
74 bf = p;
75 bf.strip("\r\n", true);
76 bf.strip("l", true);
77 printf("src: |%s|\r\n", p);
78 printf("str:{%s}, len: %d\r\n", bf.c_str(), (int) bf.size());
79 return 0;
80#endif
81
82 const char* ptr =
83 "{\r\n"
84 " \"data\" : \"dGVzdHFxcQ==\", \r\n"
85 " \"receiver_id\" : [\r\n"
86 " \"1442365683\"\r\n"
87 " ],\r\n"
88 " \"extra\" : \"\",\r\n"
89 " \"group_id\" : \"\"\r\n"
90 "}\r\n";
91
92 acl::string buf1, buf2;
93
94 buf1 = ptr;
95
96 if (test(ptr, "receiver_id", false, buf2) == false)
97 return 1;
98
99 buf1.trim_space().trim_line();
100 buf2.trim_space().trim_line().trim_line();
101
102 if (buf1 == buf2)
103 printf("----OK----\r\n");
104 else
105 {
106 printf("----Error----\r\n");
107 printf("|%s|\r\n|%s|\r\n", buf1.c_str(), buf2.c_str());
108 return 1;
109 }
110
111 printf("Enter any key to continue ...");
112 fflush(stdout);
113 getchar();
114
115 ptr = "{ \"forward\": [\r\n"
116 " { \"disable\": \"false\" },\r\n"
117 " { \"disable\": false },\r\n"
118 " { \"status\": [ true, false, true ]},\r\n"
119 " { \"status\": [ \"true\", \"false\", \"true\" ]},\r\n"
120 " { \"status\": [ \"true\", false, \"true\" ]},\r\n"
121 " { \"number\": 123456 },\r\n"
122 " { \"number\": \"123456\" },\r\n"
123 " { \"number\": [ 1, 2, 3, 4, 5, 6 ]},\r\n"
124 " { \"number\": [ \"1\", \"2\", \"3\", \"4\", \"5\", \"6\" ]},\r\n"
125 " { \"number\": [ \"1\", 2, \"3\", 4, \"5\", 6 ]},\r\n"
126 " { \"url\" : \"http://127.0.0.1/\" },\r\n"

Callers

nothing calls this directly

Calls 5

testFunction · 0.70
c_strMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…