crow_getroutes_test: refactor tests
It's a common practise to put tests to its corresponding namespace. This
commit also removed duplicate namespace scoping (::testing).
Tested: unit test passed
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I447a4c05c4487245b1c31c5e19a8eac2c6086001
diff --git a/src/crow_getroutes_test.cpp b/src/crow_getroutes_test.cpp
index 5352165..f4d375b 100644
--- a/src/crow_getroutes_test.cpp
+++ b/src/crow_getroutes_test.cpp
@@ -1,17 +1,24 @@
-#include <app.hpp>
+#include "app.hpp"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
-using namespace crow;
-using namespace std;
+namespace crow
+{
+namespace
+{
+
+using ::testing::Eq;
+using ::testing::IsEmpty;
+using ::testing::Pointee;
+using ::testing::UnorderedElementsAre;
TEST(GetRoutes, TestEmptyRoutes)
{
App app;
app.validate();
- EXPECT_THAT(app.getRoutes(), testing::IsEmpty());
+ EXPECT_THAT(app.getRoutes(), IsEmpty());
}
// Tests that static urls are correctly passed
@@ -24,7 +31,7 @@
// TODO: "/" doesn't get reported in |getRoutes| today. Uncomment this once
// it is fixed
// EXPECT_THAT(app.getRoutes(),
- // testing::ElementsAre(testing::Pointee(std::string("/"))));
+ // testing::ElementsAre(Pointee(Eq("/"))));
}
// Tests that static urls are correctly passed
@@ -42,11 +49,11 @@
// TODO: "/" doesn't get reported in |getRoutes| today. Uncomment this once
// it is fixed
- EXPECT_THAT(app.getRoutes(), testing::UnorderedElementsAre(
- // testing::Pointee(std::string("/")),
- testing::Pointee(std::string("/foo")),
- testing::Pointee(std::string("/bar")),
- testing::Pointee(std::string("/baz")),
- testing::Pointee(std::string("/boo")),
- testing::Pointee(std::string("/moo"))));
+ EXPECT_THAT(app.getRoutes(), UnorderedElementsAre(
+ // Pointee(Eq("/")),
+ Pointee(Eq("/foo")), Pointee(Eq("/bar")),
+ Pointee(Eq("/baz")), Pointee(Eq("/boo")),
+ Pointee(Eq("/moo"))));
}
+} // namespace
+} // namespace crow
\ No newline at end of file