1
0
mirror of https://github.com/yarrick/iodine.git synced 2024-11-25 22:46:05 +03:00

Fix some warnings in read tests

This commit is contained in:
Erik Ekman 2014-01-29 21:22:58 +01:00
parent c352286deb
commit 9ee78b6f4d

View File

@ -96,6 +96,7 @@ START_TEST(test_read_name_empty_loop)
data = (char*) emptyloop + sizeof(HEADER); data = (char*) emptyloop + sizeof(HEADER);
buf[1023] = 'A'; buf[1023] = 'A';
rv = readname((char *) emptyloop, sizeof(emptyloop), &data, buf, 1023); rv = readname((char *) emptyloop, sizeof(emptyloop), &data, buf, 1023);
fail_unless(rv == 0);
fail_unless(buf[1023] == 'A'); fail_unless(buf[1023] == 'A');
} }
END_TEST END_TEST
@ -113,6 +114,7 @@ START_TEST(test_read_name_inf_loop)
data = (char*) infloop + sizeof(HEADER); data = (char*) infloop + sizeof(HEADER);
buf[4] = '\a'; buf[4] = '\a';
rv = readname((char*) infloop, sizeof(infloop), &data, buf, 4); rv = readname((char*) infloop, sizeof(infloop), &data, buf, 4);
fail_unless(rv == 3);
fail_unless(buf[4] == '\a'); fail_unless(buf[4] == '\a');
} }
END_TEST END_TEST
@ -136,6 +138,7 @@ START_TEST(test_read_name_longname)
data = (char*) longname + sizeof(HEADER); data = (char*) longname + sizeof(HEADER);
buf[256] = '\a'; buf[256] = '\a';
rv = readname((char*) longname, sizeof(longname), &data, buf, 256); rv = readname((char*) longname, sizeof(longname), &data, buf, 256);
fail_unless(rv == 256);
fail_unless(buf[256] == '\a'); fail_unless(buf[256] == '\a');
} }
END_TEST END_TEST
@ -213,11 +216,8 @@ START_TEST(test_putname)
char buf[256]; char buf[256];
char *domain = "BADGER.BADGER.KRYO.SE"; char *domain = "BADGER.BADGER.KRYO.SE";
char *b; char *b;
int len;
int ret; int ret;
len = 256;
memset(buf, 0, 256); memset(buf, 0, 256);
b = buf; b = buf;
ret = putname(&b, 256, domain); ret = putname(&b, 256, domain);
@ -234,11 +234,8 @@ START_TEST(test_putname_nodot)
"ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
"ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"; "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";
char *b; char *b;
int len;
int ret; int ret;
len = 256;
memset(buf, 0, 256); memset(buf, 0, 256);
b = buf; b = buf;
ret = putname(&b, 256, nodot); ret = putname(&b, 256, nodot);
@ -259,11 +256,8 @@ START_TEST(test_putname_toolong)
"ABCDEFGHIJKLMNOPQRSTUVWXYZ.ABCDEFGHIJKLMNOPQRSTUVWXYZ." "ABCDEFGHIJKLMNOPQRSTUVWXYZ.ABCDEFGHIJKLMNOPQRSTUVWXYZ."
"ABCDEFGHIJKLMNOPQRSTUVWXYZ.ABCDEFGHIJKLMNOPQRSTUVWXYZ."; "ABCDEFGHIJKLMNOPQRSTUVWXYZ.ABCDEFGHIJKLMNOPQRSTUVWXYZ.";
char *b; char *b;
int len;
int ret; int ret;
len = 256;
memset(buf, 0, 256); memset(buf, 0, 256);
b = buf; b = buf;
ret = putname(&b, 256, toolong); ret = putname(&b, 256, toolong);