Refactorizations: Made several test functions const according to cppcheck messages.
This commit is contained in:
parent
c8e40773f1
commit
003a9be3ed
|
@ -50,13 +50,13 @@ private:
|
||||||
TEST_CASE(recursiveAddFiles);
|
TEST_CASE(recursiveAddFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
void isDirectory() {
|
void isDirectory() const {
|
||||||
ASSERT_EQUALS(false, FileLister::isDirectory("readme.txt"));
|
ASSERT_EQUALS(false, FileLister::isDirectory("readme.txt"));
|
||||||
ASSERT_EQUALS(true, FileLister::isDirectory("lib"));
|
ASSERT_EQUALS(true, FileLister::isDirectory("lib"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
void absolutePath() {
|
void absolutePath() const {
|
||||||
std::vector<char> current_dir;
|
std::vector<char> current_dir;
|
||||||
#ifdef PATH_MAX
|
#ifdef PATH_MAX
|
||||||
current_dir.resize(PATH_MAX);
|
current_dir.resize(PATH_MAX);
|
||||||
|
@ -72,7 +72,7 @@ private:
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void recursiveAddFiles() {
|
void recursiveAddFiles() const {
|
||||||
// Recursively add add files..
|
// Recursively add add files..
|
||||||
std::map<std::string, std::size_t> files;
|
std::map<std::string, std::size_t> files;
|
||||||
FileLister::recursiveAddFiles(files, ".");
|
FileLister::recursiveAddFiles(files, ".");
|
||||||
|
|
|
@ -43,42 +43,42 @@ private:
|
||||||
TEST_CASE(isLessEqual)
|
TEST_CASE(isLessEqual)
|
||||||
}
|
}
|
||||||
|
|
||||||
void isGreater() {
|
void isGreater() const {
|
||||||
ASSERT_EQUALS(true , MathLib::isGreater("1.0", "0.001"));
|
ASSERT_EQUALS(true , MathLib::isGreater("1.0", "0.001"));
|
||||||
ASSERT_EQUALS(false, MathLib::isGreater("-1.0", "0.001"));
|
ASSERT_EQUALS(false, MathLib::isGreater("-1.0", "0.001"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void isGreaterEqual() {
|
void isGreaterEqual() const {
|
||||||
ASSERT_EQUALS(true , MathLib::isGreaterEqual("1.00", "1.0"));
|
ASSERT_EQUALS(true , MathLib::isGreaterEqual("1.00", "1.0"));
|
||||||
ASSERT_EQUALS(true , MathLib::isGreaterEqual("1.001", "1.0"));
|
ASSERT_EQUALS(true , MathLib::isGreaterEqual("1.001", "1.0"));
|
||||||
ASSERT_EQUALS(true , MathLib::isGreaterEqual("1.0", "0.001"));
|
ASSERT_EQUALS(true , MathLib::isGreaterEqual("1.0", "0.001"));
|
||||||
ASSERT_EQUALS(false, MathLib::isGreaterEqual("-1.0", "0.001"));
|
ASSERT_EQUALS(false, MathLib::isGreaterEqual("-1.0", "0.001"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void isEqual() {
|
void isEqual() const {
|
||||||
ASSERT_EQUALS(true , MathLib::isEqual("1.0", "1.0"));
|
ASSERT_EQUALS(true , MathLib::isEqual("1.0", "1.0"));
|
||||||
ASSERT_EQUALS(false , MathLib::isEqual("1.", "1.01"));
|
ASSERT_EQUALS(false , MathLib::isEqual("1.", "1.01"));
|
||||||
ASSERT_EQUALS(true , MathLib::isEqual("0.1","1.0E-1"));
|
ASSERT_EQUALS(true , MathLib::isEqual("0.1","1.0E-1"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void isNotEqual() {
|
void isNotEqual() const {
|
||||||
ASSERT_EQUALS(false , MathLib::isNotEqual("1.0", "1.0"));
|
ASSERT_EQUALS(false , MathLib::isNotEqual("1.0", "1.0"));
|
||||||
ASSERT_EQUALS(true , MathLib::isNotEqual("1.", "1.01"));
|
ASSERT_EQUALS(true , MathLib::isNotEqual("1.", "1.01"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void isLess() {
|
void isLess() const {
|
||||||
ASSERT_EQUALS(false , MathLib::isLess("1.0", "0.001"));
|
ASSERT_EQUALS(false , MathLib::isLess("1.0", "0.001"));
|
||||||
ASSERT_EQUALS(true , MathLib::isLess("-1.0", "0.001"));
|
ASSERT_EQUALS(true , MathLib::isLess("-1.0", "0.001"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void isLessEqual() {
|
void isLessEqual() const {
|
||||||
ASSERT_EQUALS(true , MathLib::isLessEqual("1.00", "1.0"));
|
ASSERT_EQUALS(true , MathLib::isLessEqual("1.00", "1.0"));
|
||||||
ASSERT_EQUALS(false , MathLib::isLessEqual("1.001", "1.0"));
|
ASSERT_EQUALS(false , MathLib::isLessEqual("1.001", "1.0"));
|
||||||
ASSERT_EQUALS(false , MathLib::isLessEqual("1.0", "0.001"));
|
ASSERT_EQUALS(false , MathLib::isLessEqual("1.0", "0.001"));
|
||||||
ASSERT_EQUALS(true , MathLib::isLessEqual("-1.0", "0.001"));
|
ASSERT_EQUALS(true , MathLib::isLessEqual("-1.0", "0.001"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void calculate() {
|
void calculate() const {
|
||||||
// addition
|
// addition
|
||||||
ASSERT_EQUALS("256", MathLib::add("0xff", "1"));
|
ASSERT_EQUALS("256", MathLib::add("0xff", "1"));
|
||||||
ASSERT_EQUALS("249", MathLib::add("250", "-1"));
|
ASSERT_EQUALS("249", MathLib::add("250", "-1"));
|
||||||
|
@ -124,7 +124,7 @@ private:
|
||||||
ASSERT_THROW(MathLib::calculate("1","2",'j'),InternalError);
|
ASSERT_THROW(MathLib::calculate("1","2",'j'),InternalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
void calculate1() { // mod
|
void calculate1() const { // mod
|
||||||
ASSERT_EQUALS("0" , MathLib::calculate("2" , "1" , '%'));
|
ASSERT_EQUALS("0" , MathLib::calculate("2" , "1" , '%'));
|
||||||
ASSERT_EQUALS("0" , MathLib::calculate("2.0" , "1.0" , '%'));
|
ASSERT_EQUALS("0" , MathLib::calculate("2.0" , "1.0" , '%'));
|
||||||
ASSERT_EQUALS("2" , MathLib::calculate("12" , "5" , '%'));
|
ASSERT_EQUALS("2" , MathLib::calculate("12" , "5" , '%'));
|
||||||
|
@ -134,7 +134,7 @@ private:
|
||||||
ASSERT_EQUALS("1.7" , MathLib::calculate("18.5" , "4.2" , '%'));
|
ASSERT_EQUALS("1.7" , MathLib::calculate("18.5" , "4.2" , '%'));
|
||||||
}
|
}
|
||||||
|
|
||||||
void convert() {
|
void convert() const {
|
||||||
// ------------------
|
// ------------------
|
||||||
// tolong conversion:
|
// tolong conversion:
|
||||||
// ------------------
|
// ------------------
|
||||||
|
@ -198,7 +198,7 @@ private:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void isint() {
|
void isint() const {
|
||||||
// zero tests
|
// zero tests
|
||||||
ASSERT_EQUALS(true , MathLib::isInt("0"));
|
ASSERT_EQUALS(true , MathLib::isInt("0"));
|
||||||
ASSERT_EQUALS(false, MathLib::isInt("0."));
|
ASSERT_EQUALS(false, MathLib::isInt("0."));
|
||||||
|
@ -275,7 +275,7 @@ private:
|
||||||
ASSERT_EQUALS(false, MathLib::isInt("LL"));
|
ASSERT_EQUALS(false, MathLib::isInt("LL"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void isnegative() {
|
void isnegative() const {
|
||||||
ASSERT_EQUALS(true, MathLib::isNegative("-1"));
|
ASSERT_EQUALS(true, MathLib::isNegative("-1"));
|
||||||
ASSERT_EQUALS(true, MathLib::isNegative("-1."));
|
ASSERT_EQUALS(true, MathLib::isNegative("-1."));
|
||||||
ASSERT_EQUALS(true, MathLib::isNegative("-1.0"));
|
ASSERT_EQUALS(true, MathLib::isNegative("-1.0"));
|
||||||
|
@ -289,7 +289,7 @@ private:
|
||||||
ASSERT_EQUALS(false, MathLib::isNegative("+1.0E-2"));
|
ASSERT_EQUALS(false, MathLib::isNegative("+1.0E-2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void isfloat() {
|
void isfloat() const {
|
||||||
ASSERT_EQUALS(false, MathLib::isFloat("0"));
|
ASSERT_EQUALS(false, MathLib::isFloat("0"));
|
||||||
ASSERT_EQUALS(true , MathLib::isFloat("0."));
|
ASSERT_EQUALS(true , MathLib::isFloat("0."));
|
||||||
ASSERT_EQUALS(true , MathLib::isFloat("0.0"));
|
ASSERT_EQUALS(true , MathLib::isFloat("0.0"));
|
||||||
|
|
|
@ -561,7 +561,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void call_func() {
|
void call_func() const {
|
||||||
// whitelist..
|
// whitelist..
|
||||||
ASSERT_EQUALS(true, CheckMemoryLeakInFunction::test_white_list("qsort"));
|
ASSERT_EQUALS(true, CheckMemoryLeakInFunction::test_white_list("qsort"));
|
||||||
ASSERT_EQUALS(true, CheckMemoryLeakInFunction::test_white_list("scanf"));
|
ASSERT_EQUALS(true, CheckMemoryLeakInFunction::test_white_list("scanf"));
|
||||||
|
|
|
@ -40,56 +40,56 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void which_test() {
|
void which_test() const {
|
||||||
const char* argv[] = {"./test_runner", "TestClass"};
|
const char* argv[] = {"./test_runner", "TestClass"};
|
||||||
options args(sizeof argv / sizeof argv[0], argv);
|
options args(sizeof argv / sizeof argv[0], argv);
|
||||||
ASSERT_EQUALS("TestClass", args.which_test());
|
ASSERT_EQUALS("TestClass", args.which_test());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void which_test_method() {
|
void which_test_method() const {
|
||||||
const char* argv[] = {"./test_runner", "TestClass::TestMethod"};
|
const char* argv[] = {"./test_runner", "TestClass::TestMethod"};
|
||||||
options args(sizeof argv / sizeof argv[0], argv);
|
options args(sizeof argv / sizeof argv[0], argv);
|
||||||
ASSERT_EQUALS("TestClass::TestMethod", args.which_test());
|
ASSERT_EQUALS("TestClass::TestMethod", args.which_test());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void no_test_method() {
|
void no_test_method() const {
|
||||||
const char* argv[] = {"./test_runner"};
|
const char* argv[] = {"./test_runner"};
|
||||||
options args(sizeof argv / sizeof argv[0], argv);
|
options args(sizeof argv / sizeof argv[0], argv);
|
||||||
ASSERT_EQUALS("", args.which_test());
|
ASSERT_EQUALS("", args.which_test());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void not_quiet() {
|
void not_quiet() const {
|
||||||
const char* argv[] = {"./test_runner", "TestClass::TestMethod", "-v"};
|
const char* argv[] = {"./test_runner", "TestClass::TestMethod", "-v"};
|
||||||
options args(sizeof argv / sizeof argv[0], argv);
|
options args(sizeof argv / sizeof argv[0], argv);
|
||||||
ASSERT_EQUALS(false, args.quiet());
|
ASSERT_EQUALS(false, args.quiet());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void quiet() {
|
void quiet() const {
|
||||||
const char* argv[] = {"./test_runner", "TestClass::TestMethod", "-q"};
|
const char* argv[] = {"./test_runner", "TestClass::TestMethod", "-q"};
|
||||||
options args(sizeof argv / sizeof argv[0], argv);
|
options args(sizeof argv / sizeof argv[0], argv);
|
||||||
ASSERT_EQUALS(true, args.quiet());
|
ASSERT_EQUALS(true, args.quiet());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void gcc_errors() {
|
void gcc_errors() const {
|
||||||
const char* argv[] = {"./test_runner", "TestClass::TestMethod", "-g"};
|
const char* argv[] = {"./test_runner", "TestClass::TestMethod", "-g"};
|
||||||
options args(sizeof argv / sizeof argv[0], argv);
|
options args(sizeof argv / sizeof argv[0], argv);
|
||||||
ASSERT_EQUALS(true, args.gcc_style_errors());
|
ASSERT_EQUALS(true, args.gcc_style_errors());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void multiple_testcases() {
|
void multiple_testcases() const {
|
||||||
const char* argv[] = {"./test_runner", "TestClass::TestMethod", "Ignore::ThisOne"};
|
const char* argv[] = {"./test_runner", "TestClass::TestMethod", "Ignore::ThisOne"};
|
||||||
options args(sizeof argv / sizeof argv[0], argv);
|
options args(sizeof argv / sizeof argv[0], argv);
|
||||||
ASSERT_EQUALS("TestClass::TestMethod", args.which_test());
|
ASSERT_EQUALS("TestClass::TestMethod", args.which_test());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void invalid_switches() {
|
void invalid_switches() const {
|
||||||
const char* argv[] = {"./test_runner", "TestClass::TestMethod", "-a", "-v", "-q", "-g"};
|
const char* argv[] = {"./test_runner", "TestClass::TestMethod", "-a", "-v", "-q", "-g"};
|
||||||
options args(sizeof argv / sizeof argv[0], argv);
|
options args(sizeof argv / sizeof argv[0], argv);
|
||||||
ASSERT_EQUALS("TestClass::TestMethod", args.which_test());
|
ASSERT_EQUALS("TestClass::TestMethod", args.which_test());
|
||||||
|
|
|
@ -37,7 +37,7 @@ private:
|
||||||
TEST_CASE(is_csharp);
|
TEST_CASE(is_csharp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void simplify_path() {
|
void simplify_path() const {
|
||||||
// Path::simplifyPath()
|
// Path::simplifyPath()
|
||||||
ASSERT_EQUALS("index.h", Path::simplifyPath("index.h"));
|
ASSERT_EQUALS("index.h", Path::simplifyPath("index.h"));
|
||||||
ASSERT_EQUALS("index.h", Path::simplifyPath("./index.h"));
|
ASSERT_EQUALS("index.h", Path::simplifyPath("./index.h"));
|
||||||
|
@ -65,7 +65,7 @@ private:
|
||||||
ASSERT_EQUALS("the/path to/index.cpp", Path::removeQuotationMarks("\"the/path to/index.cpp\""));
|
ASSERT_EQUALS("the/path to/index.cpp", Path::removeQuotationMarks("\"the/path to/index.cpp\""));
|
||||||
}
|
}
|
||||||
|
|
||||||
void accept_file() {
|
void accept_file() const {
|
||||||
ASSERT(Path::acceptFile("index.cpp"));
|
ASSERT(Path::acceptFile("index.cpp"));
|
||||||
ASSERT(Path::acceptFile("index.invalid.cpp"));
|
ASSERT(Path::acceptFile("index.invalid.cpp"));
|
||||||
ASSERT(Path::acceptFile("index.invalid.Cpp"));
|
ASSERT(Path::acceptFile("index.invalid.Cpp"));
|
||||||
|
@ -77,7 +77,7 @@ private:
|
||||||
ASSERT(Path::acceptFile("C")==false);
|
ASSERT(Path::acceptFile("C")==false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void getRelative() {
|
void getRelative() const {
|
||||||
std::vector<std::string> basePaths;
|
std::vector<std::string> basePaths;
|
||||||
basePaths.push_back(""); // Don't crash with empty paths
|
basePaths.push_back(""); // Don't crash with empty paths
|
||||||
basePaths.push_back("C:/foo");
|
basePaths.push_back("C:/foo");
|
||||||
|
@ -91,7 +91,7 @@ private:
|
||||||
ASSERT_EQUALS("C:/foobar/test.cpp", Path::getRelativePath("C:/foobar/test.cpp", basePaths));
|
ASSERT_EQUALS("C:/foobar/test.cpp", Path::getRelativePath("C:/foobar/test.cpp", basePaths));
|
||||||
}
|
}
|
||||||
|
|
||||||
void is_c() {
|
void is_c() const {
|
||||||
ASSERT(Path::isC("index.cpp")==false);
|
ASSERT(Path::isC("index.cpp")==false);
|
||||||
ASSERT(Path::isC("")==false);
|
ASSERT(Path::isC("")==false);
|
||||||
ASSERT(Path::isC("c")==false);
|
ASSERT(Path::isC("c")==false);
|
||||||
|
@ -106,7 +106,7 @@ private:
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void is_cpp() {
|
void is_cpp() const {
|
||||||
ASSERT(Path::isCPP("index.c")==false);
|
ASSERT(Path::isCPP("index.c")==false);
|
||||||
|
|
||||||
// In unix .C is considered C++
|
// In unix .C is considered C++
|
||||||
|
@ -120,14 +120,14 @@ private:
|
||||||
ASSERT(Path::isCPP("C:\\foo\\index.Cpp"));
|
ASSERT(Path::isCPP("C:\\foo\\index.Cpp"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void is_java() {
|
void is_java() const {
|
||||||
ASSERT(Path::isJava("index.cpp")==false);
|
ASSERT(Path::isJava("index.cpp")==false);
|
||||||
ASSERT(Path::isJava("index.java"));
|
ASSERT(Path::isJava("index.java"));
|
||||||
ASSERT(Path::isJava("C:\\foo\\index.java"));
|
ASSERT(Path::isJava("C:\\foo\\index.java"));
|
||||||
ASSERT(Path::isJava("C:\\foo\\index.Java"));
|
ASSERT(Path::isJava("C:\\foo\\index.Java"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void is_csharp() {
|
void is_csharp() const {
|
||||||
ASSERT(Path::isCSharp("index.cpp")==false);
|
ASSERT(Path::isCSharp("index.cpp")==false);
|
||||||
ASSERT(Path::isCSharp("index.cs"));
|
ASSERT(Path::isCSharp("index.cs"));
|
||||||
ASSERT(Path::isCSharp("C:\\foo\\index.cs"));
|
ASSERT(Path::isCSharp("C:\\foo\\index.cs"));
|
||||||
|
|
|
@ -58,108 +58,108 @@ private:
|
||||||
TEST_CASE(filemaskpath4);
|
TEST_CASE(filemaskpath4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void emptymaskemptyfile() {
|
void emptymaskemptyfile() const {
|
||||||
std::vector<std::string> masks;
|
std::vector<std::string> masks;
|
||||||
PathMatch match(masks);
|
PathMatch match(masks);
|
||||||
ASSERT(!match.Match(""));
|
ASSERT(!match.Match(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
void emptymaskpath1() {
|
void emptymaskpath1() const {
|
||||||
std::vector<std::string> masks;
|
std::vector<std::string> masks;
|
||||||
PathMatch match(masks);
|
PathMatch match(masks);
|
||||||
ASSERT(!match.Match("src/"));
|
ASSERT(!match.Match("src/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void emptymaskpath2() {
|
void emptymaskpath2() const {
|
||||||
std::vector<std::string> masks;
|
std::vector<std::string> masks;
|
||||||
PathMatch match(masks);
|
PathMatch match(masks);
|
||||||
ASSERT(!match.Match("../src/"));
|
ASSERT(!match.Match("../src/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void emptymaskpath3() {
|
void emptymaskpath3() const {
|
||||||
std::vector<std::string> masks;
|
std::vector<std::string> masks;
|
||||||
PathMatch match(masks);
|
PathMatch match(masks);
|
||||||
ASSERT(!match.Match("/home/user/code/src/"));
|
ASSERT(!match.Match("/home/user/code/src/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void onemaskemptypath() {
|
void onemaskemptypath() const {
|
||||||
std::vector<std::string> masks;
|
std::vector<std::string> masks;
|
||||||
masks.push_back("src/");
|
masks.push_back("src/");
|
||||||
PathMatch match(masks);
|
PathMatch match(masks);
|
||||||
ASSERT(!match.Match(""));
|
ASSERT(!match.Match(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
void onemasksamepath() {
|
void onemasksamepath() const {
|
||||||
std::vector<std::string> masks;
|
std::vector<std::string> masks;
|
||||||
masks.push_back("src/");
|
masks.push_back("src/");
|
||||||
PathMatch match(masks);
|
PathMatch match(masks);
|
||||||
ASSERT(match.Match("src/"));
|
ASSERT(match.Match("src/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void onemasksamepathdifferentcase() {
|
void onemasksamepathdifferentcase() const {
|
||||||
std::vector<std::string> masks;
|
std::vector<std::string> masks;
|
||||||
masks.push_back("sRc/");
|
masks.push_back("sRc/");
|
||||||
PathMatch match(masks, false);
|
PathMatch match(masks, false);
|
||||||
ASSERT(match.Match("srC/"));
|
ASSERT(match.Match("srC/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void onemasksamepathwithfile() {
|
void onemasksamepathwithfile() const {
|
||||||
std::vector<std::string> masks;
|
std::vector<std::string> masks;
|
||||||
masks.push_back("src/");
|
masks.push_back("src/");
|
||||||
PathMatch match(masks);
|
PathMatch match(masks);
|
||||||
ASSERT(match.Match("src/file.txt"));
|
ASSERT(match.Match("src/file.txt"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void onemaskdifferentdir1() {
|
void onemaskdifferentdir1() const {
|
||||||
std::vector<std::string> masks;
|
std::vector<std::string> masks;
|
||||||
masks.push_back("src/");
|
masks.push_back("src/");
|
||||||
PathMatch match(masks);
|
PathMatch match(masks);
|
||||||
ASSERT(!match.Match("srcfiles/file.txt"));
|
ASSERT(!match.Match("srcfiles/file.txt"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void onemaskdifferentdir2() {
|
void onemaskdifferentdir2() const {
|
||||||
std::vector<std::string> masks;
|
std::vector<std::string> masks;
|
||||||
masks.push_back("src/");
|
masks.push_back("src/");
|
||||||
PathMatch match(masks);
|
PathMatch match(masks);
|
||||||
ASSERT(!match.Match("proj/srcfiles/file.txt"));
|
ASSERT(!match.Match("proj/srcfiles/file.txt"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void onemaskdifferentdir3() {
|
void onemaskdifferentdir3() const {
|
||||||
std::vector<std::string> masks;
|
std::vector<std::string> masks;
|
||||||
masks.push_back("src/");
|
masks.push_back("src/");
|
||||||
PathMatch match(masks);
|
PathMatch match(masks);
|
||||||
ASSERT(!match.Match("proj/mysrc/file.txt"));
|
ASSERT(!match.Match("proj/mysrc/file.txt"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void onemaskdifferentdir4() {
|
void onemaskdifferentdir4() const {
|
||||||
std::vector<std::string> masks;
|
std::vector<std::string> masks;
|
||||||
masks.push_back("src/");
|
masks.push_back("src/");
|
||||||
PathMatch match(masks);
|
PathMatch match(masks);
|
||||||
ASSERT(!match.Match("proj/mysrcfiles/file.txt"));
|
ASSERT(!match.Match("proj/mysrcfiles/file.txt"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void onemasklongerpath1() {
|
void onemasklongerpath1() const {
|
||||||
std::vector<std::string> masks;
|
std::vector<std::string> masks;
|
||||||
masks.push_back("src/");
|
masks.push_back("src/");
|
||||||
PathMatch match(masks);
|
PathMatch match(masks);
|
||||||
ASSERT(match.Match("/tmp/src/"));
|
ASSERT(match.Match("/tmp/src/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void onemasklongerpath2() {
|
void onemasklongerpath2() const {
|
||||||
std::vector<std::string> masks;
|
std::vector<std::string> masks;
|
||||||
masks.push_back("src/");
|
masks.push_back("src/");
|
||||||
PathMatch match(masks);
|
PathMatch match(masks);
|
||||||
ASSERT(match.Match("src/module/"));
|
ASSERT(match.Match("src/module/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void onemasklongerpath3() {
|
void onemasklongerpath3() const {
|
||||||
std::vector<std::string> masks;
|
std::vector<std::string> masks;
|
||||||
masks.push_back("src/");
|
masks.push_back("src/");
|
||||||
PathMatch match(masks);
|
PathMatch match(masks);
|
||||||
ASSERT(match.Match("project/src/module/"));
|
ASSERT(match.Match("project/src/module/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void twomasklongerpath1() {
|
void twomasklongerpath1() const {
|
||||||
std::vector<std::string> masks;
|
std::vector<std::string> masks;
|
||||||
masks.push_back("src/");
|
masks.push_back("src/");
|
||||||
masks.push_back("module/");
|
masks.push_back("module/");
|
||||||
|
@ -167,7 +167,7 @@ private:
|
||||||
ASSERT(!match.Match("project/"));
|
ASSERT(!match.Match("project/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void twomasklongerpath2() {
|
void twomasklongerpath2() const {
|
||||||
std::vector<std::string> masks;
|
std::vector<std::string> masks;
|
||||||
masks.push_back("src/");
|
masks.push_back("src/");
|
||||||
masks.push_back("module/");
|
masks.push_back("module/");
|
||||||
|
@ -175,7 +175,7 @@ private:
|
||||||
ASSERT(match.Match("project/src/"));
|
ASSERT(match.Match("project/src/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void twomasklongerpath3() {
|
void twomasklongerpath3() const {
|
||||||
std::vector<std::string> masks;
|
std::vector<std::string> masks;
|
||||||
masks.push_back("src/");
|
masks.push_back("src/");
|
||||||
masks.push_back("module/");
|
masks.push_back("module/");
|
||||||
|
@ -183,7 +183,7 @@ private:
|
||||||
ASSERT(match.Match("project/module/"));
|
ASSERT(match.Match("project/module/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void twomasklongerpath4() {
|
void twomasklongerpath4() const {
|
||||||
std::vector<std::string> masks;
|
std::vector<std::string> masks;
|
||||||
masks.push_back("src/");
|
masks.push_back("src/");
|
||||||
masks.push_back("module/");
|
masks.push_back("module/");
|
||||||
|
@ -191,56 +191,56 @@ private:
|
||||||
ASSERT(match.Match("project/src/module/"));
|
ASSERT(match.Match("project/src/module/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void filemask1() {
|
void filemask1() const {
|
||||||
std::vector<std::string> masks;
|
std::vector<std::string> masks;
|
||||||
masks.push_back("foo.cpp");
|
masks.push_back("foo.cpp");
|
||||||
PathMatch match(masks);
|
PathMatch match(masks);
|
||||||
ASSERT(match.Match("foo.cpp"));
|
ASSERT(match.Match("foo.cpp"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void filemaskdifferentcase() {
|
void filemaskdifferentcase() const {
|
||||||
std::vector<std::string> masks;
|
std::vector<std::string> masks;
|
||||||
masks.push_back("foo.cPp");
|
masks.push_back("foo.cPp");
|
||||||
PathMatch match(masks, false);
|
PathMatch match(masks, false);
|
||||||
ASSERT(match.Match("fOo.cpp"));
|
ASSERT(match.Match("fOo.cpp"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void filemask2() {
|
void filemask2() const {
|
||||||
std::vector<std::string> masks;
|
std::vector<std::string> masks;
|
||||||
masks.push_back("foo.cpp");
|
masks.push_back("foo.cpp");
|
||||||
PathMatch match(masks);
|
PathMatch match(masks);
|
||||||
ASSERT(match.Match("../foo.cpp"));
|
ASSERT(match.Match("../foo.cpp"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void filemask3() {
|
void filemask3() const {
|
||||||
std::vector<std::string> masks;
|
std::vector<std::string> masks;
|
||||||
masks.push_back("foo.cpp");
|
masks.push_back("foo.cpp");
|
||||||
PathMatch match(masks);
|
PathMatch match(masks);
|
||||||
ASSERT(match.Match("src/foo.cpp"));
|
ASSERT(match.Match("src/foo.cpp"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void filemaskpath1() {
|
void filemaskpath1() const {
|
||||||
std::vector<std::string> masks;
|
std::vector<std::string> masks;
|
||||||
masks.push_back("src/foo.cpp");
|
masks.push_back("src/foo.cpp");
|
||||||
PathMatch match(masks);
|
PathMatch match(masks);
|
||||||
ASSERT(match.Match("src/foo.cpp"));
|
ASSERT(match.Match("src/foo.cpp"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void filemaskpath2() {
|
void filemaskpath2() const {
|
||||||
std::vector<std::string> masks;
|
std::vector<std::string> masks;
|
||||||
masks.push_back("src/foo.cpp");
|
masks.push_back("src/foo.cpp");
|
||||||
PathMatch match(masks);
|
PathMatch match(masks);
|
||||||
ASSERT(match.Match("proj/src/foo.cpp"));
|
ASSERT(match.Match("proj/src/foo.cpp"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void filemaskpath3() {
|
void filemaskpath3() const {
|
||||||
std::vector<std::string> masks;
|
std::vector<std::string> masks;
|
||||||
masks.push_back("src/foo.cpp");
|
masks.push_back("src/foo.cpp");
|
||||||
PathMatch match(masks);
|
PathMatch match(masks);
|
||||||
ASSERT(!match.Match("foo.cpp"));
|
ASSERT(!match.Match("foo.cpp"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void filemaskpath4() {
|
void filemaskpath4() const {
|
||||||
std::vector<std::string> masks;
|
std::vector<std::string> masks;
|
||||||
masks.push_back("src/foo.cpp");
|
masks.push_back("src/foo.cpp");
|
||||||
PathMatch match(masks);
|
PathMatch match(masks);
|
||||||
|
|
Loading…
Reference in New Issue