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 <waddlesplash@gmail.com>
This commit is contained in:
Kyle Ambroff-Kao 2020-03-21 17:42:07 -07:00 committed by waddlesplash
parent 61557c8240
commit 40aa43588d

View File

@ -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);