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
diff --git a/http/ut/utility_test.cpp b/http/ut/utility_test.cpp
index 5fdfcb5..2f19fca 100644
--- a/http/ut/utility_test.cpp
+++ b/http/ut/utility_test.cpp
@@ -164,5 +164,24 @@
#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