summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNan Zhou <nanzhoumails@gmail.com>2022-06-14 01:38:52 +0300
committerEd Tanous <ed@tanous.net>2022-06-21 18:29:24 +0300
commit4dd73a1cfa22ebf9b2ee2fd2aff6767eeb88e1c1 (patch)
tree46d10f458a767ae9c2f0f8aa4f7e03b287978b0a /src
parent5ad7720717807d6cd25b334c11ad117b46c9ee0d (diff)
downloadbmcweb-4dd73a1cfa22ebf9b2ee2fd2aff6767eeb88e1c1.tar.xz
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
Diffstat (limited to 'src')
-rw-r--r--src/crow_getroutes_test.cpp31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/crow_getroutes_test.cpp b/src/crow_getroutes_test.cpp
index 5352165b5b..f4d375b35b 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 @@ TEST(GetRoutes, TestOneRoute)
// 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 @@ TEST(GetRoutes, TestlotsOfRoutes)
// 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