diff options
author | Lars Wirzenius <liw@liw.fi> | 2013-01-12 12:14:49 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2013-01-12 12:15:30 +0000 |
commit | dae1501f9f33bf26d2fda623dec2daa31fc68485 (patch) | |
tree | 8064fd71183e1ad75a1bb99696b4f816e2f25a6b /tests | |
parent | 87597f9127200ac692e07912f31cf3a0bb643129 (diff) | |
download | dynstr-dae1501f9f33bf26d2fda623dec2daa31fc68485.tar.gz |
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.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unittests.c | 5 |
1 files changed, 5 insertions, 0 deletions
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); |