Browse Source

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.
Peter Brottveit Bock 2 years ago
parent
commit
43a8a38f57
1 changed files with 4 additions and 1 deletions
  1. 4 1
      Tests/AK/TestIPv6Address.cpp

+ 4 - 1
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);
 }