From 4ac55be9b58b48a602ba23f536092eb644775f05 Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Sat, 9 Jul 2011 14:54:01 +0200 Subject: Update printf-formatting tests to fail --- test.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/test.c b/test.c index bac10a7..d3a3dbd 100644 --- a/test.c +++ b/test.c @@ -142,16 +142,18 @@ static void test_format_commands(void) { len == 4+4+(3+2)+4+(1+2)+4+(1+2)); free(cmd); + /* sizeof(long long) is 8 bytes regardless of architecture */ test("Format command with printf-delegation (long long): "); - len = redisFormatCommand(&cmd,"key:%08lld",1234ll); - test_cond(strncmp(cmd,"*1\r\n$12\r\nkey:00001234\r\n",len) == 0 && - len == 4+5+(12+2)); + len = redisFormatCommand(&cmd,"key:%08lld str:%s",1234ll, "hello"); + test_cond(strncmp(cmd,"*2\r\n$12\r\nkey:00001234\r\n$9\r\nstr:hello\r\n",len) == 0 && + len == 4+5+(12+2)+4+(9+2)); free(cmd); + /* sizeof(float) is 4 bytes regardless of architecture */ test("Format command with printf-delegation (float): "); - len = redisFormatCommand(&cmd,"v:%06.1f",12.34f); - test_cond(strncmp(cmd,"*1\r\n$8\r\nv:0012.3\r\n",len) == 0 && - len == 4+4+(8+2)); + len = redisFormatCommand(&cmd,"v:%06.1f str:%s",12.34f,"hello"); + test_cond(strncmp(cmd,"*2\r\n$8\r\nv:0012.3\r\n$9\r\nstr:hello\r\n",len) == 0 && + len == 4+4+(8+2)+4+(9+2)); free(cmd); test("Format command with printf-delegation and extra interpolation: "); -- cgit v1.2.3