summaryrefslogtreecommitdiffstats
path: root/tests/utils/utils_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/utils/utils_test.c')
-rw-r--r--tests/utils/utils_test.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/utils/utils_test.c b/tests/utils/utils_test.c
index 223f67d2..70d017fe 100644
--- a/tests/utils/utils_test.c
+++ b/tests/utils/utils_test.c
@@ -585,7 +585,7 @@ static void str_quote_test(void)
printf("- never passthru:\n");
res = osmo_quote_str(printable, -1);
- if (res != printable)
+ if (strcmp(res, printable))
printf("NOT passed through. '%s'\n", res);
else
printf("passed through unchanged '%s'\n", res);
@@ -596,14 +596,14 @@ static void str_quote_test(void)
printf("- truncation when too long:\n");
memset(in_buf, 'x', sizeof(in_buf));
in_buf[0] = '\a';
- in_buf[5] = 'E';
+ in_buf[6] = 'E';
memset(out_buf, 0x7f, sizeof(out_buf));
printf("'%s'\n", osmo_quote_str_buf((const char *)in_buf, sizeof(in_buf), out_buf, 10));
OSMO_ASSERT(out_buf[10] == 0x7f);
printf("- always truncation, even when no escaping needed:\n");
memset(in_buf, 'x', sizeof(in_buf));
- in_buf[6] = 'E'; /* dst has 10, less 2 quotes and nul, leaves 7, i.e. in[6] is last */
+ in_buf[7] = 'E'; /* dst has 10, less 1 quote and nul, leaves 8, i.e. in[7] is last */
in_buf[20] = '\0';
memset(out_buf, 0x7f, sizeof(out_buf));
printf("'%s'\n", osmo_quote_str_buf((const char *)in_buf, -1, out_buf, 10));