From af730ddd195521fd25b7c1dd13fd10c349dd4a7c Mon Sep 17 00:00:00 2001
From: Richard Walters <rwalters@digitalstirling.com>
Date: Tue, 6 Oct 2020 19:06:13 -0700
Subject: Add more test cases for IPvFuture syntax

---
 test/src/UriTests.cpp | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/test/src/UriTests.cpp b/test/src/UriTests.cpp
index 34e3483..2fec3a0 100644
--- a/test/src/UriTests.cpp
+++ b/test/src/UriTests.cpp
@@ -767,6 +767,36 @@ TEST(UriTests, IPv6Address) {
     }
 }
 
+TEST(UriTests, IPvFutureAddress) {
+    struct TestVector {
+        std::string uriString;
+        std::string expectedHost;
+        bool isValid;
+    };
+    const std::vector< TestVector > testVectors{
+        // valid
+        {"http://[v1.x]/", "v1.x", true},
+        {"http://[vf.xy]/", "vf.xy", true},
+        {"http://[vf.x:y]/", "vf.x:y", true},
+
+        // invalid
+        {"http://[vx]/", "", false},
+        {"http://[v12]/", "", false},
+        {"http://[v1.?]/", "", false},
+        {"http://[v1.x?]/", "", false},
+    };
+    size_t index = 0;
+    for (const auto& testVector : testVectors) {
+        Uri::Uri uri;
+        const bool parseResult = uri.ParseFromString(testVector.uriString);
+        ASSERT_EQ(testVector.isValid, parseResult) << index;
+        if (parseResult) {
+            ASSERT_EQ(testVector.expectedHost, uri.GetHost());
+        }
+        ++index;
+    }
+}
+
 TEST(UriTests, GenerateString) {
     struct TestVector {
         std::string scheme;
-- 
cgit v1.2.3