From 1af6861f8db57b54ba19b80964eb00c5f7340bfb Mon Sep 17 00:00:00 2001
From: Richard Walters <rwalters@digitalstirling.com>
Date: Mon, 2 Jul 2018 21:21:48 -0700
Subject: Add capability to compare Uri objects.

* Code the neat example in section 6.2.2 of the RFC.
* Add equality/inequality operators for Uri.
---
 test/src/UriTests.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)

(limited to 'test/src')

diff --git a/test/src/UriTests.cpp b/test/src/UriTests.cpp
index cbc8b8a..4275de6 100644
--- a/test/src/UriTests.cpp
+++ b/test/src/UriTests.cpp
@@ -603,3 +603,14 @@ TEST(UriTests, NormalizePath) {
         ++index;
     }
 }
+
+TEST(UriTests, ConstructNormalizeAndCompareEquivalentUris) {
+    // This was inspired by section 6.2.2
+    // of RFC 3986 (https://tools.ietf.org/html/rfc3986).
+    Uri::Uri uri1, uri2;
+    ASSERT_TRUE(uri1.ParseFromString("example://a/b/c/%7Bfoo%7D"));
+    ASSERT_TRUE(uri2.ParseFromString("eXAMPLE://a/./b/../b/%63/%7bfoo%7d"));
+    ASSERT_NE(uri1, uri2);
+    uri2.NormalizePath();
+    ASSERT_EQ(uri1, uri2);
+}
-- 
cgit v1.2.3