From 5d8801d4687035ae45143f0f3bc3eeaf75dc17ec Mon Sep 17 00:00:00 2001 From: Yves Fischer Date: Mon, 11 Aug 2014 23:26:36 +0200 Subject: Upgrade code to iodine 0.7.0 and improve logging --- jni/iodine/tests/read.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'jni/iodine/tests/read.c') diff --git a/jni/iodine/tests/read.c b/jni/iodine/tests/read.c index 18cc29c..24a5214 100644 --- a/jni/iodine/tests/read.c +++ b/jni/iodine/tests/read.c @@ -1,5 +1,6 @@ /* - * Copyright (c) 2006-2009 Bjorn Andersson , Erik Ekman + * Copyright (c) 2006-2014 Erik Ekman , + * 2006-2009 Bjorn Andersson * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -20,7 +21,8 @@ #include #include #ifdef DARWIN -#include +#define BIND_8_COMPAT +#include #endif #include #include @@ -49,7 +51,7 @@ START_TEST(test_read_putshort) i, ntohs(k), i); p = (char*)&k; - readshort(NULL, &p, (short *) &l); + readshort(NULL, &p, &l); fail_unless(l == i, "Bad value on readshort for %d: %d != %d", i, l, i); @@ -96,6 +98,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 +116,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 +140,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 +218,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 +236,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 +258,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); -- cgit v1.2.1