From 40aa43588d31e301eefbf5ce6f0d3f55b32c8aad Mon Sep 17 00:00:00 2001 From: Kyle Ambroff-Kao Date: Sat, 21 Mar 2020 17:42:07 -0700 Subject: [PATCH] tests/net: Fix NetworkAddressTest::TestUnset() This test just checks a default-constructed BNetworkAddress and a BNetworkAddress that has had its Unset method invoked are in the same state. It also compares against a BNetworkAddress that has been constructed with the AF_INET family. In BeOS R5 this worked because you could construct a BNetworkAddress with nullptr for the host parameter, but in Haiku this this leads to Unset() being invoked. So BNetworkAddress(AF_INET, NULL) is the same as a default-constructed BNetworkAddress object. This patch just changes the test to construct the BNetworkAddress used for comparison with a valid host using the IPv4 loopback address instead. Change-Id: Id890110cfa1f3c40a630f9005e2a390e25f6baae Reviewed-on: https://review.haiku-os.org/c/haiku/+/2388 Reviewed-by: waddlesplash --- src/tests/kits/net/libnetapi/NetworkAddressTest.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tests/kits/net/libnetapi/NetworkAddressTest.cpp b/src/tests/kits/net/libnetapi/NetworkAddressTest.cpp index 8f2bf56226..649796428d 100644 --- a/src/tests/kits/net/libnetapi/NetworkAddressTest.cpp +++ b/src/tests/kits/net/libnetapi/NetworkAddressTest.cpp @@ -31,10 +31,12 @@ NetworkAddressTest::TestUnset() { BNetworkAddress unset; + CPPUNIT_ASSERT(unset.InitCheck() == B_OK); CPPUNIT_ASSERT(unset.Family() == AF_UNSPEC); CPPUNIT_ASSERT(unset.Port() == 0); - BNetworkAddress set(AF_INET, NULL); + BNetworkAddress set(AF_INET, "127.0.0.1"); + CPPUNIT_ASSERT(set.InitCheck() == B_OK); CPPUNIT_ASSERT(set.Family() == AF_INET); CPPUNIT_ASSERT(unset != set);