From dae1501f9f33bf26d2fda623dec2daa31fc68485 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 12 Jan 2013 12:14:49 +0000 Subject: Add clarifying comment to test case The test case is currently failing, for reasons that are unclear to me. I already almost "fixed" it by reversing the sense of the test condition, but that would have been wrong. This is reason enough to clarify what is going in a comment. --- tests/unittests.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/unittests.c b/tests/unittests.c index 0ba5b33..e754b1d 100644 --- a/tests/unittests.c +++ b/tests/unittests.c @@ -60,6 +60,7 @@ } while (0) + #define MAX_STRINGS 128 static Dynstr *strings[MAX_STRINGS]; static int num_strings; @@ -304,6 +305,10 @@ static int test_creates_from_constant_cstring(void) FAIL_UNLESS_EQUAL(size, strlen(bytes)); FAIL_UNLESS_EQUAL(memcmp(bytes, newbytes, strlen(bytes)), 0); + /* Creating a dynstr from a supposedly constant C string should + make the dynstr re-use the C string's memory area. Thus, + if we modify the C string (even though we should not), the + dynstr should also change. */ bytes[0] = 'x'; dynstr_memcpy(newbytes, dynstr, 0, strlen(bytes)); FAIL_UNLESS_EQUAL(memcmp(bytes, newbytes, strlen(bytes)), 0); -- cgit v1.2.1