From 6ccb5835ff55d85156be91473c598eca9d6cb9a6 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 4 Nov 2020 16:57:41 +0100 Subject: Revert "Make Lint Happy" This reverts commit ad148587dcf5244c2d2011dba339786c765c54c4. --- src/unittest/test_filepath.cpp | 117 ++++++++++++++++++++++------------------- 1 file changed, 62 insertions(+), 55 deletions(-) (limited to 'src/unittest/test_filepath.cpp') diff --git a/src/unittest/test_filepath.cpp b/src/unittest/test_filepath.cpp index dea290ab6..ac2d69b5a 100644 --- a/src/unittest/test_filepath.cpp +++ b/src/unittest/test_filepath.cpp @@ -26,8 +26,7 @@ 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"; } @@ -66,14 +65,15 @@ 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,22 +86,23 @@ 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 @@ -113,51 +114,55 @@ 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(\"" - <