aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/src/UriTests.cpp37
1 files changed, 36 insertions, 1 deletions
diff --git a/test/src/UriTests.cpp b/test/src/UriTests.cpp
index bb541d0..4242885 100644
--- a/test/src/UriTests.cpp
+++ b/test/src/UriTests.cpp
@@ -275,6 +275,23 @@ TEST(UriTests, ParseFromStringSchemeBarelyLegal) {
}
}
+TEST(UriTests, ParseFromStringSchemeMixedCase) {
+ const std::vector< std::string > testVectors{
+ {"http://www.example.com/"},
+ {"hTtp://www.example.com/"},
+ {"HTTP://www.example.com/"},
+ {"Http://www.example.com/"},
+ {"HttP://www.example.com/"},
+ };
+ size_t index = 0;
+ for (const auto& testVector : testVectors) {
+ Uri::Uri uri;
+ ASSERT_TRUE(uri.ParseFromString(testVector)) << index;
+ ASSERT_EQ("http", uri.GetScheme()) << ">>> Failed for test vector element " << index << " <<<";
+ ++index;
+ }
+}
+
TEST(UriTests, ParseFromStringUserInfoIllegalCharacters) {
const std::vector< std::string > testVectors{
{"//%X@www.example.com/"},
@@ -331,7 +348,7 @@ TEST(UriTests, ParseFromStringHostBarelyLegal) {
std::string host;
};
const std::vector< TestVector > testVectors{
- {"//%41/", "A"},
+ {"//%41/", "a"},
{"///", ""},
{"//!/", "!"},
{"//'/", "'"},
@@ -339,6 +356,7 @@ TEST(UriTests, ParseFromStringHostBarelyLegal) {
{"//;/", ";"},
{"//1.2.3.4/", "1.2.3.4"},
{"//[v7.:]/", "[v7.:]"},
+ {"//[v7.aB]/", "[v7.aB]"},
};
size_t index = 0;
for (const auto& testVector : testVectors) {
@@ -349,6 +367,23 @@ TEST(UriTests, ParseFromStringHostBarelyLegal) {
}
}
+TEST(UriTests, ParseFromStringHostMixedCase) {
+ const std::vector< std::string > testVectors{
+ {"http://www.example.com/"},
+ {"http://www.EXAMPLE.com/"},
+ {"http://www.exAMple.com/"},
+ {"http://www.example.cOM/"},
+ {"http://wWw.exampLe.Com/"},
+ };
+ size_t index = 0;
+ for (const auto& testVector : testVectors) {
+ Uri::Uri uri;
+ ASSERT_TRUE(uri.ParseFromString(testVector)) << index;
+ ASSERT_EQ("www.example.com", uri.GetHost()) << ">>> Failed for test vector element " << index << " <<<";
+ ++index;
+ }
+}
+
TEST(UriTests, ParseFromStringDontMisinterpretColonInOtherPlacesAsSchemeDelimiter) {
const std::vector< std::string > testVectors{
{"//foo:bar@www.example.com/"},