| 125 | } |
| 126 | |
| 127 | static int |
| 128 | test_string_char_escaping(void) |
| 129 | { |
| 130 | static const char str[] = "A string across\ntwo lines and \"with quotes\"!"; |
| 131 | const char *expected = "\"A string across\\ntwo lines and \\\"with quotes\\\"!\""; |
| 132 | char buf[sizeof(str) + 10] = ""; |
| 133 | int used = 0; |
| 134 | |
| 135 | used = rte_tel_json_str(buf, sizeof(buf), used, str); |
| 136 | printf("%s: buf = '%s', expected = '%s'\n", __func__, buf, expected); |
| 137 | if (used != (int)strlen(expected)) |
| 138 | return -1; |
| 139 | |
| 140 | return strncmp(expected, buf, sizeof(buf)); |
| 141 | } |
| 142 | |
| 143 | static int |
| 144 | test_array_char_escaping(void) |
nothing calls this directly
no test coverage detected