From ad148587dcf5244c2d2011dba339786c765c54c4 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 4 Nov 2020 16:19:54 +0100 Subject: Make Lint Happy --- src/unittest/test_filepath.cpp | 117 +++++++++++++++++++---------------------- 1 file changed, 55 insertions(+), 62 deletions(-) (limited to 'src/unittest/test_filepath.cpp') diff --git a/src/unittest/test_filepath.cpp b/src/unittest/test_filepath.cpp index ac2d69b5a..dea290ab6 100644 --- a/src/unittest/test_filepath.cpp +++ b/src/unittest/test_filepath.cpp @@ -26,7 +26,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "nodedef.h" #include "noise.h" -class TestFilePath : public TestBase { +class TestFilePath : public TestBase +{ public: TestFilePath() { TestManager::registerTestModule(this); } const char *getName() { return "TestFilePath"; } @@ -65,15 +66,14 @@ std::string p(std::string path) } } - #ifdef _WIN32 +#ifdef _WIN32 if (path[0] == '\\') path = "C:" + path; - #endif +#endif return path; } - void TestFilePath::testIsDirDelimiter() { UASSERT(fs::IsDirDelimiter('/') == true); @@ -86,23 +86,22 @@ void TestFilePath::testIsDirDelimiter() #endif } - void TestFilePath::testPathStartsWith() { const int numpaths = 12; std::string paths[numpaths] = { - "", - p("/"), - p("/home/user/minetest"), - p("/home/user/minetest/bin"), - p("/home/user/.minetest"), - p("/tmp/dir/file"), - p("/tmp/file/"), - p("/tmP/file"), - p("/tmp"), - p("/tmp/dir"), - p("/home/user2/minetest/worlds"), - p("/home/user2/minetest/world"), + "", + p("/"), + p("/home/user/minetest"), + p("/home/user/minetest/bin"), + p("/home/user/.minetest"), + p("/tmp/dir/file"), + p("/tmp/file/"), + p("/tmP/file"), + p("/tmp"), + p("/tmp/dir"), + p("/home/user2/minetest/worlds"), + p("/home/user2/minetest/world"), }; /* expected fs::PathStartsWith results @@ -114,55 +113,51 @@ void TestFilePath::testPathStartsWith() FILESYS_CASE_INSENSITIVE is true */ int expected_results[numpaths][numpaths] = { - {1,2,0,0,0,0,0,0,0,0,0,0}, - {1,1,0,0,0,0,0,0,0,0,0,0}, - {1,1,1,0,0,0,0,0,0,0,0,0}, - {1,1,1,1,0,0,0,0,0,0,0,0}, - {1,1,0,0,1,0,0,0,0,0,0,0}, - {1,1,0,0,0,1,0,0,1,1,0,0}, - {1,1,0,0,0,0,1,4,1,0,0,0}, - {1,1,0,0,0,0,4,1,4,0,0,0}, - {1,1,0,0,0,0,0,0,1,0,0,0}, - {1,1,0,0,0,0,0,0,1,1,0,0}, - {1,1,0,0,0,0,0,0,0,0,1,0}, - {1,1,0,0,0,0,0,0,0,0,0,1}, + {1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0}, + {1, 1, 0, 0, 0, 0, 1, 4, 1, 0, 0, 0}, + {1, 1, 0, 0, 0, 0, 4, 1, 4, 0, 0, 0}, + {1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, + {1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0}, + {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0}, + {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, }; for (int i = 0; i < numpaths; i++) - for (int j = 0; j < numpaths; j++){ - /*verbosestream<<"testing fs::PathStartsWith(\"" - <