diff options
author | Alex Smith <aes7mv@virginia.edu> | 2020-10-15 20:13:25 -0400 |
---|---|---|
committer | michael-grunder <michael.grunder@gmail.com> | 2021-02-25 21:25:17 -0800 |
commit | 0f92518847cbc7c83357a48059a273db8fe078a3 (patch) | |
tree | a687f204a4cc091fe5f7777bbaef279e51eb73b9 | |
parent | 33c06dd5036014b2ded7f2ef6fb994f2f3eadbe5 (diff) |
test: Add test case for RESP3 set
-rw-r--r-- | test.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -683,6 +683,28 @@ static void test_reply_reader(void) { ((redisReply*)reply)->element[3]->integer); freeReplyObject(reply); redisReaderFree(reader); + + test("Can parse RESP3 set: "); + reader = redisReaderCreate(); + redisReaderFeed(reader, "~5\r\n+orange\r\n$5\r\napple\r\n#f\r\n:100\r\n:999\r\n",40); + ret = redisReaderGetReply(reader,&reply); + test_cond(ret == REDIS_OK && + ((redisReply*)reply)->type == REDIS_REPLY_SET && + ((redisReply*)reply)->elements == 5 && + ((redisReply*)reply)->element[0]->type == REDIS_REPLY_STATUS && + ((redisReply*)reply)->element[0]->len == 6 && + !strcmp(((redisReply*)reply)->element[0]->str,"orange") && + ((redisReply*)reply)->element[1]->type == REDIS_REPLY_STRING && + ((redisReply*)reply)->element[1]->len == 5 && + !strcmp(((redisReply*)reply)->element[1]->str,"apple") && + ((redisReply*)reply)->element[2]->type == REDIS_REPLY_BOOL && + !((redisReply*)reply)->element[2]->integer && + ((redisReply*)reply)->element[3]->type == REDIS_REPLY_INTEGER && + ((redisReply*)reply)->element[3]->integer == 100 && + ((redisReply*)reply)->element[4]->type == REDIS_REPLY_INTEGER && + ((redisReply*)reply)->element[4]->integer == 999); + freeReplyObject(reply); + redisReaderFree(reader); } static void test_free_null(void) { |