Skip to content
This repository was archived by the owner on Dec 20, 2023. It is now read-only.

Commit 4c6da69

Browse files
committed
Make the nl::Inet::IPAddress tests more robust
A set of unit tests used addresses that had multiple representations: addresses with `:0:` quad in them could be also be represented with `::`. On a number of Mac OS machines, the underlying library call has been emitting the `::` notation, breaking tests. We modify the tests to avoid the problem.
1 parent e1ecc3f commit 4c6da69

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/test-apps/TestInetAddress.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ static const struct IPAddressExpandedContext sIPAddressContext[] = {
160160
0x0, 0x0, 0x0
161161
},
162162
{
163-
{ { 0x26200000, 0x10e70400, 0xe83fb28f, 0x9c3a1941 }, kIPAddressType_IPv6,
164-
"2620:0:10e7:400:e83f:b28f:9c3a:1941" } ,
163+
{ { 0x26200001, 0x10e70400, 0xe83fb28f, 0x9c3a1941 }, kIPAddressType_IPv6,
164+
"2620:1:10e7:400:e83f:b28f:9c3a:1941" } ,
165165
kTestIsIPv6, kTestIsNotIPv4Multicast, kTestIsNotIPv4Broadcast, kTestIsNotMulticast, kTestIsNotIPv6Multicast, kTestIsNotIPv6ULA, kTestIsNotIPv6LLA,
166166
0x0, 0x0, 0x0
167167
},
@@ -553,13 +553,13 @@ static const IPAddressContext sIPv6PrefixMulticastContext[] = {
553553

554554
// 56-bit Prefix with Short Group in Various Scopes
555555

556-
{ { 0xff310038, 0x373acba4, 0xd2ad8d00, 0x00000001 }, kIPAddressType_IPv6, "ff31:38:373a:cba4:d2ad:8d00:0:1" },
557-
{ { 0xff320038, 0x373acba4, 0xd2ad8d00, 0x00000001 }, kIPAddressType_IPv6, "ff32:38:373a:cba4:d2ad:8d00:0:1" },
558-
{ { 0xff330038, 0x373acba4, 0xd2ad8d00, 0x00000001 }, kIPAddressType_IPv6, "ff33:38:373a:cba4:d2ad:8d00:0:1" },
559-
{ { 0xff340038, 0x373acba4, 0xd2ad8d00, 0x00000001 }, kIPAddressType_IPv6, "ff34:38:373a:cba4:d2ad:8d00:0:1" },
560-
{ { 0xff350038, 0x373acba4, 0xd2ad8d00, 0x00000001 }, kIPAddressType_IPv6, "ff35:38:373a:cba4:d2ad:8d00:0:1" },
561-
{ { 0xff380038, 0x373acba4, 0xd2ad8d00, 0x00000001 }, kIPAddressType_IPv6, "ff38:38:373a:cba4:d2ad:8d00:0:1" },
562-
{ { 0xff3e0038, 0x373acba4, 0xd2ad8d00, 0x00000001 }, kIPAddressType_IPv6, "ff3e:38:373a:cba4:d2ad:8d00:0:1" },
556+
{ { 0xff310038, 0x373acba4, 0xd2ad8d00, 0x00010001 }, kIPAddressType_IPv6, "ff31:38:373a:cba4:d2ad:8d00:1:1" },
557+
{ { 0xff320038, 0x373acba4, 0xd2ad8d00, 0x00010001 }, kIPAddressType_IPv6, "ff32:38:373a:cba4:d2ad:8d00:1:1" },
558+
{ { 0xff330038, 0x373acba4, 0xd2ad8d00, 0x00010001 }, kIPAddressType_IPv6, "ff33:38:373a:cba4:d2ad:8d00:1:1" },
559+
{ { 0xff340038, 0x373acba4, 0xd2ad8d00, 0x00010001 }, kIPAddressType_IPv6, "ff34:38:373a:cba4:d2ad:8d00:1:1" },
560+
{ { 0xff350038, 0x373acba4, 0xd2ad8d00, 0x00010001 }, kIPAddressType_IPv6, "ff35:38:373a:cba4:d2ad:8d00:1:1" },
561+
{ { 0xff380038, 0x373acba4, 0xd2ad8d00, 0x00010001 }, kIPAddressType_IPv6, "ff38:38:373a:cba4:d2ad:8d00:1:1" },
562+
{ { 0xff3e0038, 0x373acba4, 0xd2ad8d00, 0x00010001 }, kIPAddressType_IPv6, "ff3e:38:373a:cba4:d2ad:8d00:1:1" },
563563

564564
// 56-bit Prefix with Long Group in Various Scopes
565565

@@ -573,13 +573,13 @@ static const IPAddressContext sIPv6PrefixMulticastContext[] = {
573573

574574
// 64-bit Prefix with Short Group in Various Scopes
575575

576-
{ { 0xff310040, 0x66643dfb, 0xafa4385b, 0x00000001 }, kIPAddressType_IPv6, "ff31:40:6664:3dfb:afa4:385b:0:1" },
577-
{ { 0xff320040, 0x66643dfb, 0xafa4385b, 0x00000001 }, kIPAddressType_IPv6, "ff32:40:6664:3dfb:afa4:385b:0:1" },
578-
{ { 0xff330040, 0x66643dfb, 0xafa4385b, 0x00000001 }, kIPAddressType_IPv6, "ff33:40:6664:3dfb:afa4:385b:0:1" },
579-
{ { 0xff340040, 0x66643dfb, 0xafa4385b, 0x00000001 }, kIPAddressType_IPv6, "ff34:40:6664:3dfb:afa4:385b:0:1" },
580-
{ { 0xff350040, 0x66643dfb, 0xafa4385b, 0x00000001 }, kIPAddressType_IPv6, "ff35:40:6664:3dfb:afa4:385b:0:1" },
581-
{ { 0xff380040, 0x66643dfb, 0xafa4385b, 0x00000001 }, kIPAddressType_IPv6, "ff38:40:6664:3dfb:afa4:385b:0:1" },
582-
{ { 0xff3e0040, 0x66643dfb, 0xafa4385b, 0x00000001 }, kIPAddressType_IPv6, "ff3e:40:6664:3dfb:afa4:385b:0:1" },
576+
{ { 0xff310040, 0x66643dfb, 0xafa4385b, 0x00010001 }, kIPAddressType_IPv6, "ff31:40:6664:3dfb:afa4:385b:1:1" },
577+
{ { 0xff320040, 0x66643dfb, 0xafa4385b, 0x00010001 }, kIPAddressType_IPv6, "ff32:40:6664:3dfb:afa4:385b:1:1" },
578+
{ { 0xff330040, 0x66643dfb, 0xafa4385b, 0x00010001 }, kIPAddressType_IPv6, "ff33:40:6664:3dfb:afa4:385b:1:1" },
579+
{ { 0xff340040, 0x66643dfb, 0xafa4385b, 0x00010001 }, kIPAddressType_IPv6, "ff34:40:6664:3dfb:afa4:385b:1:1" },
580+
{ { 0xff350040, 0x66643dfb, 0xafa4385b, 0x00010001 }, kIPAddressType_IPv6, "ff35:40:6664:3dfb:afa4:385b:1:1" },
581+
{ { 0xff380040, 0x66643dfb, 0xafa4385b, 0x00010001 }, kIPAddressType_IPv6, "ff38:40:6664:3dfb:afa4:385b:1:1" },
582+
{ { 0xff3e0040, 0x66643dfb, 0xafa4385b, 0x00010001 }, kIPAddressType_IPv6, "ff3e:40:6664:3dfb:afa4:385b:1:1" },
583583

584584
// 64-bit Prefix with Long Group in Various Scopes
585585

@@ -1596,7 +1596,7 @@ static void CheckMakeIPv6PrefixMulticast(nlTestSuite *inSuite, void *inContext)
15961596

15971597
lPrefixLength = 56;
15981598
lPrefix = 0x373acba4d2ad8d00;
1599-
lGroup = 0x1;
1599+
lGroup = 0x00010001;
16001600

16011601
for (lScopeIndex = 0; lScopeIndex < NUM_MCAST_SCOPES && (lCurrent != lEnd); lScopeIndex++)
16021602
{
@@ -1630,7 +1630,7 @@ static void CheckMakeIPv6PrefixMulticast(nlTestSuite *inSuite, void *inContext)
16301630

16311631
lPrefixLength = 64;
16321632
lPrefix = 0x66643dfbafa4385b;
1633-
lGroup = 0x1;
1633+
lGroup = 0x00010001;
16341634

16351635
for (lScopeIndex = 0; lScopeIndex < NUM_MCAST_SCOPES && (lCurrent != lEnd); lScopeIndex++)
16361636
{

0 commit comments

Comments
 (0)