From f80b0aee604bb95630c233f8803c4d265dc5d84c Mon Sep 17 00:00:00 2001 From: YAMAMOTO Atsushi Date: Mon, 20 Feb 2023 11:45:47 +0900 Subject: Add test function for private network Add a function QHostAddress::isPrivateUse to test for IPv4 private networks and IPv6 unique local unicast addresses. Task-number: QTBUG-111211 Change-Id: Ic8abefa7aa974fa83118aeb9f2506a5713f79f0d Reviewed-by: Tasuku Suzuki Reviewed-by: Thiago Macieira --- tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests/auto/network') diff --git a/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp b/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp index f735c3897f..1135420c47 100644 --- a/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp +++ b/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp @@ -703,6 +703,7 @@ void tst_QHostAddress::classification() bool isUniqueLocalAddress = (result == UniqueLocalAddress); bool isMulticast = (result == MulticastAddress); bool isBroadcast = (result == BroadcastAddress); + bool isPrivateUse = (result == PrivateNetworkAddress || result == UniqueLocalAddress); QCOMPARE(address.isLoopback(), isLoopback); QCOMPARE(address.isGlobal(), isGlobal); @@ -711,6 +712,7 @@ void tst_QHostAddress::classification() QCOMPARE(address.isUniqueLocalUnicast(), isUniqueLocalAddress); QCOMPARE(address.isMulticast(), isMulticast); QCOMPARE(address.isBroadcast(), isBroadcast); + QCOMPARE(address.isPrivateUse(), isPrivateUse); } void tst_QHostAddress::convertv4v6_data() -- cgit v1.2.3