| 9 | #include "test.h" |
| 10 | |
| 11 | static int |
| 12 | test_basic_array(void) |
| 13 | { |
| 14 | const char *expected = "[\"meaning of life\",42]"; |
| 15 | char buf[1024]; |
| 16 | int used = 0; |
| 17 | |
| 18 | printf("%s: ", __func__); |
| 19 | used = rte_tel_json_empty_array(buf, sizeof(buf), used); |
| 20 | if (used != 2 || strcmp(buf, "[]")) |
| 21 | return -1; |
| 22 | |
| 23 | used = rte_tel_json_add_array_string(buf, sizeof(buf), used, |
| 24 | "meaning of life"); |
| 25 | used = rte_tel_json_add_array_int(buf, sizeof(buf), used, 42); |
| 26 | |
| 27 | printf("buf = '%s', expected = '%s'\n", buf, expected); |
| 28 | if (used != (int)strlen(expected)) |
| 29 | return -1; |
| 30 | return strncmp(expected, buf, sizeof(buf)); |
| 31 | } |
| 32 | |
| 33 | static int |
| 34 | test_basic_obj(void) |
nothing calls this directly
no test coverage detected