Removed needless va_str()

This commit is contained in:
Erik Ekman 2008-07-12 20:57:30 +00:00 committed by Erik Ekman
parent 3c3cddee67
commit 06f60e2a3b
6 changed files with 51 additions and 65 deletions

View File

@ -47,7 +47,7 @@ START_TEST(test_base32_encode)
fail_unless(val > 0, strerror(errno)); fail_unless(val > 0, strerror(errno));
fail_unless(strcmp(buf, testpairs[i].b) == 0, fail_unless(strcmp(buf, testpairs[i].b) == 0,
va_str("'%s' != '%s'", buf, testpairs[i].b)); "'%s' != '%s'", buf, testpairs[i].b);
} }
} }
END_TEST END_TEST
@ -66,7 +66,7 @@ START_TEST(test_base32_decode)
fail_unless(val > 0, strerror(errno)); fail_unless(val > 0, strerror(errno));
fail_unless(buf != NULL, "buf == NULL"); fail_unless(buf != NULL, "buf == NULL");
fail_unless(strcmp(buf, testpairs[i].a) == 0, fail_unless(strcmp(buf, testpairs[i].a) == 0,
va_str("'%s' != '%s'", buf, testpairs[i].a)); "'%s' != '%s'", buf, testpairs[i].a);
} }
} }
END_TEST END_TEST

View File

@ -75,7 +75,7 @@ START_TEST(test_base64_encode)
fail_unless(val > 0, strerror(errno)); fail_unless(val > 0, strerror(errno));
fail_unless(strcmp(buf, testpairs[i].b) == 0, fail_unless(strcmp(buf, testpairs[i].b) == 0,
va_str("'%s' != '%s'", buf, testpairs[i].b)); "'%s' != '%s'", buf, testpairs[i].b);
} }
} }
END_TEST END_TEST
@ -94,7 +94,7 @@ START_TEST(test_base64_decode)
fail_unless(val > 0, strerror(errno)); fail_unless(val > 0, strerror(errno));
fail_unless(buf != NULL, "buf == NULL"); fail_unless(buf != NULL, "buf == NULL");
fail_unless(strcmp(buf, testpairs[i].a) == 0, fail_unless(strcmp(buf, testpairs[i].a) == 0,
va_str("'%s' != '%s'", buf, testpairs[i].a)); "'%s' != '%s'", buf, testpairs[i].a);
} }
} }
END_TEST END_TEST

View File

@ -88,7 +88,7 @@ START_TEST(test_encode_query)
dump_packet(buf, ret); dump_packet(buf, ret);
} }
fail_unless(strncmp(queryPacket, buf, sizeof(queryPacket)) == 0, "Did not compile expected packet"); fail_unless(strncmp(queryPacket, buf, sizeof(queryPacket)) == 0, "Did not compile expected packet");
fail_unless(ret == len, va_str("Bad packet length: %d, expected %d", ret, len)); fail_unless(ret == len, "Bad packet length: %d, expected %d", ret, len);
} }
END_TEST END_TEST
@ -112,7 +112,7 @@ START_TEST(test_decode_query)
unpack_data(buf, len, &(q.name[1]), (int) (domain - q.name) - 1, enc); unpack_data(buf, len, &(q.name[1]), (int) (domain - q.name) - 1, enc);
fail_unless(strncmp(buf, innerData, strlen(innerData)) == 0, "Did not extract expected host: '%s'", buf); fail_unless(strncmp(buf, innerData, strlen(innerData)) == 0, "Did not extract expected host: '%s'", buf);
fail_unless(strlen(buf) == strlen(innerData), va_str("Bad host length: %d, expected %d: '%s'", strlen(buf), strlen(innerData), buf)); fail_unless(strlen(buf) == strlen(innerData), "Bad host length: %d, expected %d: '%s'", strlen(buf), strlen(innerData), buf);
} }
END_TEST END_TEST
@ -135,7 +135,7 @@ START_TEST(test_encode_response)
len = sizeof(answerPacket) - 1; /* Skip extra null character */ len = sizeof(answerPacket) - 1; /* Skip extra null character */
fail_unless(strncmp(answerPacket, buf, sizeof(answerPacket)) == 0, "Did not compile expected packet"); fail_unless(strncmp(answerPacket, buf, sizeof(answerPacket)) == 0, "Did not compile expected packet");
fail_unless(ret == len, va_str("Bad packet length: %d, expected %d", ret, len)); fail_unless(ret == len, "Bad packet length: %d, expected %d", ret, len);
} }
END_TEST END_TEST
@ -150,7 +150,7 @@ START_TEST(test_decode_response)
ret = dns_decode(buf, len, NULL, QR_ANSWER, answerPacket, sizeof(answerPacket)-1); ret = dns_decode(buf, len, NULL, QR_ANSWER, answerPacket, sizeof(answerPacket)-1);
fail_unless(strncmp(msgData, buf, sizeof(msgData)) == 0, "Did not extract expected data"); fail_unless(strncmp(msgData, buf, sizeof(msgData)) == 0, "Did not extract expected data");
fail_unless(ret == strlen(msgData), va_str("Bad data length: %d, expected %d", ret, strlen(msgData))); fail_unless(ret == strlen(msgData), "Bad data length: %d, expected %d", ret, strlen(msgData));
} }
END_TEST END_TEST

View File

@ -49,7 +49,7 @@ START_TEST(test_inline_dotify)
inline_dotify(b, sizeof(temp)); inline_dotify(b, sizeof(temp));
fail_unless(strcmp(dottests[i].b, temp) == 0, fail_unless(strcmp(dottests[i].b, temp) == 0,
va_str("'%s' != '%s'", temp, dottests[i].b)); "'%s' != '%s'", temp, dottests[i].b);
i++; i++;
} }
} }
@ -69,7 +69,7 @@ START_TEST(test_inline_undotify)
inline_undotify(b, sizeof(temp)); inline_undotify(b, sizeof(temp));
fail_unless(strcmp(dottests[i].a, temp) == 0, fail_unless(strcmp(dottests[i].a, temp) == 0,
va_str("'%s' != '%s'", temp, dottests[i].a)); "'%s' != '%s'", temp, dottests[i].a);
i++; i++;
} }
} }

View File

@ -45,14 +45,14 @@ START_TEST(test_read_putshort)
p = (char*)&k; p = (char*)&k;
putshort(&p, i); putshort(&p, i);
fail_unless(ntohs(k) == i, fail_unless(ntohs(k) == i,
va_str("Bad value on putshort for %d: %d != %d", "Bad value on putshort for %d: %d != %d",
i, ntohs(k), i)); i, ntohs(k), i);
p = (char*)&k; p = (char*)&k;
readshort(NULL, &p, (short *) &l); readshort(NULL, &p, (short *) &l);
fail_unless(l == i, fail_unless(l == i,
va_str("Bad value on readshort for %d: %d != %d", "Bad value on readshort for %d: %d != %d",
i, l, i)); i, l, i);
} }
} }
END_TEST END_TEST
@ -72,13 +72,13 @@ START_TEST(test_read_putlong)
putlong(&p, j); putlong(&p, j);
fail_unless(ntohl(k) == j, fail_unless(ntohl(k) == j,
va_str("Bad value on putlong for %d: %d != %d", i, ntohl(j), j)); "Bad value on putlong for %d: %d != %d", i, ntohl(j), j);
p = (char*)&k; p = (char*)&k;
readlong(NULL, &p, &l); readlong(NULL, &p, &l);
fail_unless(l == j, fail_unless(l == j,
va_str("Bad value on readlong for %d: %d != %d", i, l, j)); "Bad value on readlong for %d: %d != %d", i, l, j);
} }
} }
END_TEST END_TEST
@ -159,7 +159,7 @@ START_TEST(test_read_name)
fail_unless(rv == 4, NULL); fail_unless(rv == 4, NULL);
fail_unless(strcmp("BA.", buf) == 0, fail_unless(strcmp("BA.", buf) == 0,
va_str("buf is not BA: %s", buf)); "buf is not BA: %s", buf);
} }
free(jumper); free(jumper);
} }

View File

@ -22,20 +22,6 @@
#include "test.h" #include "test.h"
char *
va_str(const char *fmt, ...)
{
static char buf[512];
va_list ap;
memset(buf, 0, sizeof(buf));
va_start(ap, fmt);
vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
return buf;
}
int int
main() main()
{ {
@ -68,7 +54,7 @@ main()
suite_add_tcase(iodine, test); suite_add_tcase(iodine, test);
runner = srunner_create(iodine); runner = srunner_create(iodine);
srunner_run_all(runner, CK_VERBOSE); srunner_run_all(runner, CK_MINIMAL);
failed = srunner_ntests_failed(runner); failed = srunner_ntests_failed(runner);
srunner_free(runner); srunner_free(runner);