diff options
author | Matt Stancliff <matt@genges.com> | 2015-02-17 11:28:45 -0500 |
---|---|---|
committer | Matt Stancliff <matt@genges.com> | 2015-02-17 11:33:08 -0500 |
commit | 552e5908bb0dc7e9c7db20db20315e961612db33 (patch) | |
tree | b4ad059a16c7e068969fec9cf60b461248f918b8 /src | |
parent | 395e11255cc924c2ee4cc4ddcbf30d269b193316 (diff) | |
download | redis-552e5908bb0dc7e9c7db20db20315e961612db33.tar.gz |
Fix quicklist tests for Pop()
Now the tests actually compare return values instead of just
verifying _something_ got returned.
Diffstat (limited to 'src')
-rw-r--r-- | src/quicklist.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/quicklist.c b/src/quicklist.c index d2371a9b5..be02e3276 100644 --- a/src/quicklist.c +++ b/src/quicklist.c @@ -1757,7 +1757,8 @@ int quicklistTest(int argc, char *argv[]) { TEST("pop 1 string from 1") { quicklist *ql = quicklistNew(-2, options[_i]); - quicklistPushHead(ql, genstr("hello", 331), 32); + char *populate = genstr("hello", 331); + quicklistPushHead(ql, populate, 32); unsigned char *data; unsigned int sz; long long lv; @@ -1765,6 +1766,9 @@ int quicklistTest(int argc, char *argv[]) { quicklistPop(ql, QUICKLIST_HEAD, &data, &sz, &lv); assert(data != NULL); assert(sz == 32); + if (strcmp(populate, (char *)data)) + ERR("Pop'd value (%.*s) didn't equal original value (%s)", sz, + data, populate); zfree(data); ql_verify(ql, 0, 0, 0, 0); quicklistRelease(ql); @@ -1797,6 +1801,9 @@ int quicklistTest(int argc, char *argv[]) { assert(ret == 1); assert(data != NULL); assert(sz == 32); + if (strcmp(genstr("hello", 499 - i), (char *)data)) + ERR("Pop'd value (%.*s) didn't equal original value (%s)", + sz, data, genstr("hello", 499 - i)); zfree(data); } ql_verify(ql, 0, 0, 0, 0); @@ -1816,6 +1823,10 @@ int quicklistTest(int argc, char *argv[]) { assert(ret == 1); assert(data != NULL); assert(sz == 32); + if (strcmp(genstr("hello", 499 - i), (char *)data)) + ERR("Pop'd value (%.*s) didn't equal original value " + "(%s)", + sz, data, genstr("hello", 499 - i)); zfree(data); } else { assert(ret == 0); |