Skip to content

Commit

Permalink
Update testcase to match what it covers
Browse files Browse the repository at this point in the history
Use new testcase info text since the previous seemed copy&pasted.
The seeked coverage was the handling of the parent-chaining
for a Double object, which the testcase now focus on.
  • Loading branch information
bjosv committed Oct 14, 2022
1 parent 82026c5 commit 66b7987
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions test.c
Original file line number Diff line number Diff line change
Expand Up @@ -783,14 +783,17 @@ static void test_reply_reader(void) {
freeReplyObject(reply);
redisReaderFree(reader);

/* Test type in array. */
test("Don't do empty allocation for empty multi bulk: ");
test("Can parse RESP3 doubles in an array: ");
reader = redisReaderCreate();
redisReaderFeed(reader,(char*)"*4\r\n#t\r\n:1\r\n,1.23\r\n_\r\n",22);
redisReaderFeed(reader, "*1\r\n,3.14159265358979323846\r\n",31);
ret = redisReaderGetReply(reader,&reply);
test_cond(ret == REDIS_OK &&
((redisReply*)reply)->type == REDIS_REPLY_ARRAY &&
((redisReply*)reply)->elements == 4);
((redisReply*)reply)->elements == 1 &&
((redisReply*)reply)->element[0]->type == REDIS_REPLY_DOUBLE &&
fabs(((redisReply*)reply)->element[0]->dval - 3.14159265358979323846) < 0.00000001 &&
((redisReply*)reply)->element[0]->len == 22 &&
strcmp(((redisReply*)reply)->element[0]->str, "3.14159265358979323846") == 0);
freeReplyObject(reply);
redisReaderFree(reader);
}
Expand Down

0 comments on commit 66b7987

Please sign in to comment.