dovecot-2.2: lib: remove uintmax tests from uint64 tests

dovecot at dovecot.org dovecot at dovecot.org
Tue Sep 16 10:38:48 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/138fd3ccc9da
changeset: 17812:138fd3ccc9da
user:      Phil Carmody <phil at dovecot.fi>
date:      Tue Sep 16 13:38:30 2014 +0300
description:
lib: remove uintmax tests from uint64 tests
These log a warning on OSX with clang.

Signed-off-by: Phil Carmody <phil at dovecot.fi>

diffstat:

 src/lib/test-strnum.c |  16 +++-------------
 1 files changed, 3 insertions(+), 13 deletions(-)

diffs (57 lines):

diff -r 9899cc178d0d -r 138fd3ccc9da src/lib/test-strnum.c
--- a/src/lib/test-strnum.c	Tue Sep 16 13:38:30 2014 +0300
+++ b/src/lib/test-strnum.c	Tue Sep 16 13:38:30 2014 +0300
@@ -7,14 +7,13 @@
 #define INVALID(n) { #n, -1, 0 }
 #define VALID(n) { #n, 0, n }
 
-/* Assumes uintmax_t is 64 bit */
 static void test_str_to_u64(void)
 {
 	unsigned int i;
 	const struct {
 		const char *input;
 		int ret;
-		uintmax_t val;
+		uint64_t val;
 	} u64tests[] = {
 		INVALID(-1),
 		INVALID(foo),
@@ -29,7 +28,7 @@
 	};
 	test_begin("str_to_uint64");
 	for (i = 0; i < N_ELEMENTS(u64tests); ++i) {
-		uintmax_t val = 0xBADBEEF15BADF00D;
+		uint64_t val = 0xBADBEEF15BADF00D;
 		int ret = str_to_uint64(u64tests[i].input, &val);
 		test_assert_idx(ret == u64tests[i].ret, i);
 		if (ret == 0)
@@ -37,17 +36,11 @@
 		else
 			test_assert_idx(val == 0xBADBEEF15BADF00D, i);
 
-		/* This stanza totally assumes that uintmax_t == uint64_t */
 		if (ret == 0)
 			T_BEGIN {
 				const char *longer = t_strconcat(u64tests[i].input, "x", NULL);
-				const char *endp;
-				ret = str_to_uintmax(longer, &val);
+				ret = str_to_uint64(longer, &val);
 				test_assert_idx(ret < 0, i);
-				ret = str_parse_uintmax(longer, &val, &endp);
-				test_assert_idx(ret == 0, i);
-				test_assert_idx(val == u64tests[i].val, i);
-				test_assert_idx(*endp == 'x', i);
 			} T_END;
 	}
 	test_end();
@@ -146,9 +139,6 @@
 
 void test_strnum(void)
 {
-	test_begin("test_strnum - size check");
-	test_assert(sizeof(uintmax_t) == sizeof(uint64_t));
-	test_end();
 	/* If the above isn't true, then we do expect some failures possibly */
 	test_str_to_u64();
 	test_str_to_u32();


More information about the dovecot-cvs mailing list