From a4ba1bd73e50eaaa92fec53df6e3362b54eb71d0 Mon Sep 17 00:00:00 2001 From: panran <310762957@qq.com> Date: Fri, 20 Jan 2023 00:48:13 +0800 Subject: [PATCH] test: fix some warnings when compiling tests (#3816) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] note: in expansion of macro 'ASSERT_BASE' #define ASSERT_EQ(a, b) ASSERT_BASE(a, ==, b, int64_t, PRId64) warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint32_t’ {aka ‘unsigned int’} ``` Co-authored-by: Jameson Nash --- test/test-idna.c | 4 ++-- test/test-ip6-addr.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test-idna.c b/test/test-idna.c index f4fad965..9b700281 100644 --- a/test/test-idna.c +++ b/test/test-idna.c @@ -104,13 +104,13 @@ TEST_IMPL(utf8_decode1_overrun) { p = b; b[0] = 0x7F; ASSERT_EQ(0x7F, uv__utf8_decode1(&p, b + 1)); - ASSERT_EQ(p, b + 1); + ASSERT_PTR_EQ(p, b + 1); /* Multi-byte. */ p = b; b[0] = 0xC0; ASSERT_EQ((unsigned) -1, uv__utf8_decode1(&p, b + 1)); - ASSERT_EQ(p, b + 1); + ASSERT_PTR_EQ(p, b + 1); return 0; } diff --git a/test/test-ip6-addr.c b/test/test-ip6-addr.c index 8036c4b1..4c1e1019 100644 --- a/test/test-ip6-addr.c +++ b/test/test-ip6-addr.c @@ -103,7 +103,7 @@ TEST_IMPL(ip6_addr_link_local) { fflush(stderr); ASSERT(0 == uv_ip6_addr(scoped_addr, TEST_PORT, &addr)); - fprintf(stderr, "Got scope_id 0x%02x\n", addr.sin6_scope_id); + fprintf(stderr, "Got scope_id 0x%2x\n", (unsigned)addr.sin6_scope_id); fflush(stderr); ASSERT(iface_index == addr.sin6_scope_id); }