From bea6c4bde2c1ac647d2d3ccbda2828946d075782 Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Wed, 3 Nov 2010 11:43:01 +0100 Subject: Check replies in throughput test --- test.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/test.c b/test.c index ccc9850..9afc6fa 100644 --- a/test.c +++ b/test.c @@ -224,7 +224,10 @@ static void test_throughput() { replies = malloc(sizeof(redisReply*)*1000); t1 = usec(); - for (i = 0; i < 1000; i++) assert((replies[i] = redisCommand(c,"PING")) != NULL); + for (i = 0; i < 1000; i++) { + replies[i] = redisCommand(c,"PING"); + assert(replies[i] != NULL && replies[i]->type == REDIS_REPLY_STATUS); + } t2 = usec(); for (i = 0; i < 1000; i++) freeReplyObject(replies[i]); free(replies); @@ -232,7 +235,11 @@ static void test_throughput() { replies = malloc(sizeof(redisReply*)*1000); t1 = usec(); - for (i = 0; i < 1000; i++) assert((replies[i] = redisCommand(c,"LRANGE mylist 0 499")) != NULL); + for (i = 0; i < 1000; i++) { + replies[i] = redisCommand(c,"LRANGE mylist 0 499"); + assert(replies[i] != NULL && replies[i]->type == REDIS_REPLY_ARRAY); + assert(replies[i] != NULL && replies[i]->elements == 500); + } t2 = usec(); for (i = 0; i < 1000; i++) freeReplyObject(replies[i]); free(replies); @@ -350,7 +357,12 @@ static void cleanup() { // redisFree(c); // } -int main(void) { +int main(int argc, char **argv) { + if (argc > 1) { + if (strcmp(argv[1],"-s") == 0) + use_unix = 1; + } + signal(SIGPIPE, SIG_IGN); test_format_commands(); test_blocking_connection(); -- cgit v1.2.3