From 43a8a38f57ea9c46006413f41b74a2139e151a38 Mon Sep 17 00:00:00 2001 From: Peter Brottveit Bock Date: Tue, 30 May 2023 00:18:41 +0200 Subject: [PATCH] AK: Test that IPv6Address::operator== only looks at bytes in address This commit extends the test to ensure that different objects with the same inet6-address are considered equal. --- Tests/AK/TestIPv6Address.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Tests/AK/TestIPv6Address.cpp b/Tests/AK/TestIPv6Address.cpp index 1ee50f8b0cb..250d225762e 100644 --- a/Tests/AK/TestIPv6Address.cpp +++ b/Tests/AK/TestIPv6Address.cpp @@ -105,14 +105,17 @@ TEST_CASE(should_make_empty_optional_from_out_of_range_values) EXPECT(!addr.has_value()); } -TEST_CASE(should_compare) +TEST_CASE(should_only_compare_bytes_from_address) { constexpr IPv6Address addr_a({ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }); constexpr IPv6Address addr_b({ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17 }); + constexpr IPv6Address addr_c({ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17 }); static_assert(addr_a != addr_b); static_assert(addr_a == addr_a); + static_assert(addr_b == addr_c); EXPECT(addr_a != addr_b); EXPECT(addr_a == addr_a); + EXPECT(addr_b == addr_c); }