[haiku-commits] Change in haiku[master]: tests/net: Fix NetworkAddressTest::TestUnset()

  • From: Gerrit <review@xxxxxxxxxxxxxxxxxxx>
  • To: waddlesplash <waddlesplash@xxxxxxxxx>, haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 22 Mar 2020 00:49:35 +0000

From Kyle Ambroff-Kao <kyle@xxxxxxxxxxxxxx>:

Kyle Ambroff-Kao has uploaded this change for review. ( 
https://review.haiku-os.org/c/haiku/+/2388 ;)


Change subject: tests/net: Fix NetworkAddressTest::TestUnset()
......................................................................

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.
---
M src/tests/kits/net/libnetapi/NetworkAddressTest.cpp
1 file changed, 3 insertions(+), 1 deletion(-)



  git pull ssh://git.haiku-os.org:22/haiku refs/changes/88/2388/1

diff --git a/src/tests/kits/net/libnetapi/NetworkAddressTest.cpp 
b/src/tests/kits/net/libnetapi/NetworkAddressTest.cpp
index 8f2bf56..6497964 100644
--- a/src/tests/kits/net/libnetapi/NetworkAddressTest.cpp
+++ b/src/tests/kits/net/libnetapi/NetworkAddressTest.cpp
@@ -31,10 +31,12 @@
 {
        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);


--
To view, visit https://review.haiku-os.org/c/haiku/+/2388
To unsubscribe, or for help writing mail filters, visit 
https://review.haiku-os.org/settings

Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: Id890110cfa1f3c40a630f9005e2a390e25f6baae
Gerrit-Change-Number: 2388
Gerrit-PatchSet: 1
Gerrit-Owner: Kyle Ambroff-Kao <kyle@xxxxxxxxxxxxxx>
Gerrit-MessageType: newchange

Other related posts:

  • » [haiku-commits] Change in haiku[master]: tests/net: Fix NetworkAddressTest::TestUnset() - Gerrit