From ace06a41da51b1196eef411669343cdf7e8665e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ste=CC=81phane=20Vale=CC=80s?= <7755128+stvales@users.noreply.github.com> Date: Tue, 15 Sep 2020 20:02:47 +0200 Subject: [PATCH] edit test to properly check encoding/decoding of empty strings --- src/zarmour.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/zarmour.c b/src/zarmour.c index a0ecc4c2c6e241d693749a0f8651708502f2742c..2860f975c7d9ef6d4b25330a4b0867fa528c37a4 100644 --- a/src/zarmour.c +++ b/src/zarmour.c @@ -655,8 +655,10 @@ s_armour_decode (zarmour_t *self, const char *test_string, const char *expected, assert (chunk); if (verbose) zsys_debug (" decoded '%s' into '%s'", test_string, (char *) zchunk_data (chunk)); - assert (zchunk_size (chunk) == strlen (expected) + 1); - assert (streq ((char *) zchunk_data (chunk), expected)); + assert (zchunk_size (chunk) == strlen (expected) + 1 + || (strlen (expected) == 0 && zchunk_size (chunk) == 0)); + assert (streq ((char *) zchunk_data (chunk), expected) + || (strlen (expected) == 0 && zchunk_size (chunk) == 0)); zchunk_destroy (&chunk); }