From 9ee78b6f4d4acc1998fea0b6387c67114fa59fa7 Mon Sep 17 00:00:00 2001 From: Erik Ekman Date: Wed, 29 Jan 2014 21:22:58 +0100 Subject: [PATCH] Fix some warnings in read tests --- tests/read.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/tests/read.c b/tests/read.c index 18cc29c..8190658 100644 --- a/tests/read.c +++ b/tests/read.c @@ -96,6 +96,7 @@ START_TEST(test_read_name_empty_loop) data = (char*) emptyloop + sizeof(HEADER); buf[1023] = 'A'; rv = readname((char *) emptyloop, sizeof(emptyloop), &data, buf, 1023); + fail_unless(rv == 0); fail_unless(buf[1023] == 'A'); } END_TEST @@ -113,6 +114,7 @@ START_TEST(test_read_name_inf_loop) data = (char*) infloop + sizeof(HEADER); buf[4] = '\a'; rv = readname((char*) infloop, sizeof(infloop), &data, buf, 4); + fail_unless(rv == 3); fail_unless(buf[4] == '\a'); } END_TEST @@ -136,6 +138,7 @@ START_TEST(test_read_name_longname) data = (char*) longname + sizeof(HEADER); buf[256] = '\a'; rv = readname((char*) longname, sizeof(longname), &data, buf, 256); + fail_unless(rv == 256); fail_unless(buf[256] == '\a'); } END_TEST @@ -213,11 +216,8 @@ START_TEST(test_putname) char buf[256]; char *domain = "BADGER.BADGER.KRYO.SE"; char *b; - int len; int ret; - len = 256; - memset(buf, 0, 256); b = buf; ret = putname(&b, 256, domain); @@ -234,11 +234,8 @@ START_TEST(test_putname_nodot) "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"; char *b; - int len; int ret; - len = 256; - memset(buf, 0, 256); b = buf; ret = putname(&b, 256, nodot); @@ -259,11 +256,8 @@ START_TEST(test_putname_toolong) "ABCDEFGHIJKLMNOPQRSTUVWXYZ.ABCDEFGHIJKLMNOPQRSTUVWXYZ." "ABCDEFGHIJKLMNOPQRSTUVWXYZ.ABCDEFGHIJKLMNOPQRSTUVWXYZ."; char *b; - int len; int ret; - len = 256; - memset(buf, 0, 256); b = buf; ret = putname(&b, 256, toolong);