mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 09:00:51 +00:00
Fix quicklist tests for Pop()
Now the tests actually compare return values instead of just verifying _something_ got returned.
This commit is contained in:
parent
395e11255c
commit
552e5908bb
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user