OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 addr2 = IPAddress(kIPv4MappedPublicAddr); | 665 addr2 = IPAddress(kIPv4MappedPublicAddr); |
666 addr = addr.AsIPv6Address(); | 666 addr = addr.AsIPv6Address(); |
667 EXPECT_EQ(addr, addr2); | 667 EXPECT_EQ(addr, addr2); |
668 | 668 |
669 addr = IPAddress(kIPv6PublicAddr); | 669 addr = IPAddress(kIPv6PublicAddr); |
670 addr2 = IPAddress(kIPv6PublicAddr); | 670 addr2 = IPAddress(kIPv6PublicAddr); |
671 addr = addr.AsIPv6Address(); | 671 addr = addr.AsIPv6Address(); |
672 EXPECT_EQ(addr, addr2); | 672 EXPECT_EQ(addr, addr2); |
673 } | 673 } |
674 | 674 |
675 // Disabled for UBSan: https://bugs.chromium.org/p/webrtc/issues/detail?id=5491 | 675 TEST(IPAddressTest, TestCountIPMaskBits) { |
676 #ifdef UNDEFINED_SANITIZER | |
677 #define MAYBE_TestCountIPMaskBits DISABLED_TestCountIPMaskBits | |
678 #else | |
679 #define MAYBE_TestCountIPMaskBits TestCountIPMaskBits | |
680 #endif | |
681 TEST(IPAddressTest, MAYBE_TestCountIPMaskBits) { | |
682 IPAddress mask; | 676 IPAddress mask; |
683 // IPv4 on byte boundaries | 677 // IPv4 on byte boundaries |
684 EXPECT_PRED2(CheckMaskCount, "255.255.255.255", 32); | 678 EXPECT_PRED2(CheckMaskCount, "255.255.255.255", 32); |
685 EXPECT_PRED2(CheckMaskCount, "255.255.255.0", 24); | 679 EXPECT_PRED2(CheckMaskCount, "255.255.255.0", 24); |
686 EXPECT_PRED2(CheckMaskCount, "255.255.0.0", 16); | 680 EXPECT_PRED2(CheckMaskCount, "255.255.0.0", 16); |
687 EXPECT_PRED2(CheckMaskCount, "255.0.0.0", 8); | 681 EXPECT_PRED2(CheckMaskCount, "255.0.0.0", 8); |
688 EXPECT_PRED2(CheckMaskCount, "0.0.0.0", 0); | 682 EXPECT_PRED2(CheckMaskCount, "0.0.0.0", 0); |
689 | 683 |
690 // IPv4 not on byte boundaries | 684 // IPv4 not on byte boundaries |
691 EXPECT_PRED2(CheckMaskCount, "128.0.0.0", 1); | 685 EXPECT_PRED2(CheckMaskCount, "128.0.0.0", 1); |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
953 IPAddress *paddr1 = &addr1; | 947 IPAddress *paddr1 = &addr1; |
954 IPAddress *paddr4 = &addr4; | 948 IPAddress *paddr4 = &addr4; |
955 EXPECT_EQ(*paddr1, *paddr4); | 949 EXPECT_EQ(*paddr1, *paddr4); |
956 | 950 |
957 InterfaceAddress addr5(kIPv6LinkLocalAddr, | 951 InterfaceAddress addr5(kIPv6LinkLocalAddr, |
958 IPV6_ADDRESS_FLAG_TEMPORARY); | 952 IPV6_ADDRESS_FLAG_TEMPORARY); |
959 EXPECT_NE(addr1, addr5); | 953 EXPECT_NE(addr1, addr5); |
960 } | 954 } |
961 | 955 |
962 } // namespace rtc | 956 } // namespace rtc |
OLD | NEW |