summaryrefslogtreecommitdiff
path: root/http/ut
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2022-03-09 05:01:18 +0300
committerEd Tanous <ed@tanous.net>2022-03-10 19:02:07 +0300
commit4456f0812c415f7cb9bad12b27f1c1f9af24f9c3 (patch)
treefc9412f1f322e11e4b6751038ea341a27a53f5e0 /http/ut
parent56d2396d090ee873d58c58737382758d2afea8b9 (diff)
downloadbmcweb-4456f0812c415f7cb9bad12b27f1c1f9af24f9c3.tar.xz
Add back getParameterTag unit tests
These unit tests existed a long time ago and were shut off a while back. Might as well enable them before we do some cleanup. Tested: Unit tests pass Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I8211b8c3f53b979bfde27691a89a52c058718e67
Diffstat (limited to 'http/ut')
-rw-r--r--http/ut/utility_test.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/http/ut/utility_test.cpp b/http/ut/utility_test.cpp
index 5fdfcb5c4e..2f19fca010 100644
--- a/http/ut/utility_test.cpp
+++ b/http/ut/utility_test.cpp
@@ -164,5 +164,24 @@ TEST(Utility, ValidateAndSplitUrlPositive)
#endif
}
+TEST(Router, ParameterTagging)
+{
+ EXPECT_EQ(6 * 6 + 6 * 3 + 2,
+ crow::black_magic::getParameterTag("<uint><double><int>"));
+ EXPECT_EQ(1, crow::black_magic::getParameterTag("<int>"));
+ EXPECT_EQ(2, crow::black_magic::getParameterTag("<uint>"));
+ EXPECT_EQ(3, crow::black_magic::getParameterTag("<float>"));
+ EXPECT_EQ(3, crow::black_magic::getParameterTag("<double>"));
+ EXPECT_EQ(4, crow::black_magic::getParameterTag("<str>"));
+ EXPECT_EQ(4, crow::black_magic::getParameterTag("<string>"));
+ EXPECT_EQ(5, crow::black_magic::getParameterTag("<path>"));
+ EXPECT_EQ(6 * 6 + 6 + 1,
+ crow::black_magic::getParameterTag("<int><int><int>"));
+ EXPECT_EQ(6 * 6 + 6 + 2,
+ crow::black_magic::getParameterTag("<uint><int><int>"));
+ EXPECT_EQ(6 * 6 + 6 * 3 + 2,
+ crow::black_magic::getParameterTag("<uint><double><int>"));
+}
+
} // namespace
} // namespace crow::utility