| 172 | } |
| 173 | |
| 174 | static void test_json_data(const char* data) |
| 175 | { |
| 176 | ACL_JSON* json = acl_json_alloc(); |
| 177 | const char* ptr = data; |
| 178 | char buf[2]; |
| 179 | ACL_VSTRING *tmp; |
| 180 | |
| 181 | json->flag |= ACL_JSON_FLAG_PART_WORD; |
| 182 | |
| 183 | if (1) { |
| 184 | while (*ptr) |
| 185 | { |
| 186 | buf[0] = *ptr++; |
| 187 | buf[1] = 0; |
| 188 | acl_json_update(json, buf); |
| 189 | /* |
| 190 | if (json->finish) |
| 191 | break; |
| 192 | */ |
| 193 | } |
| 194 | } |
| 195 | else |
| 196 | acl_json_update(json, data); |
| 197 | |
| 198 | test_json_foreach1(json); |
| 199 | test_json_foreach2(json); |
| 200 | test_json_find1(json); |
| 201 | test_json_find2(json); |
| 202 | |
| 203 | tmp = acl_vstring_alloc(128); |
| 204 | acl_json_build(json, tmp); |
| 205 | printf(">>>source: |%s|\r\n", data); |
| 206 | printf(">>>result: |%s|\r\n", acl_vstring_str(tmp)); |
| 207 | acl_vstring_free(tmp); |
| 208 | acl_json_free(json); |
| 209 | } |
| 210 | |
| 211 | static void test_json_build(void) |
| 212 | { |
no test coverage detected
searching dependent graphs…