Unit testing visual studio import
This commit is contained in:
parent
30e6a05aa0
commit
04c2be33a6
|
@ -35,7 +35,7 @@
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
namespace cppcheck {
|
namespace cppcheck {
|
||||||
struct stricmp {
|
struct stricmp {
|
||||||
bool operator()(const std::string &lhs, const std::string &rhs) const {
|
bool operator()(const std::string &lhs, const std::string &rhs) const {
|
||||||
if (lhs.size() != rhs.size())
|
if (lhs.size() != rhs.size())
|
||||||
return lhs.size() < rhs.size();
|
return lhs.size() < rhs.size();
|
||||||
|
@ -47,7 +47,7 @@ struct stricmp {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -34,6 +34,7 @@ private:
|
||||||
TEST_CASE(setDefines);
|
TEST_CASE(setDefines);
|
||||||
TEST_CASE(setIncludePaths1);
|
TEST_CASE(setIncludePaths1);
|
||||||
TEST_CASE(setIncludePaths2);
|
TEST_CASE(setIncludePaths2);
|
||||||
|
TEST_CASE(setIncludePaths3); // macro names are case insensitive
|
||||||
}
|
}
|
||||||
|
|
||||||
void setDefines() const {
|
void setDefines() const {
|
||||||
|
@ -56,7 +57,7 @@ private:
|
||||||
ImportProject::FileSettings fs;
|
ImportProject::FileSettings fs;
|
||||||
std::list<std::string> in;
|
std::list<std::string> in;
|
||||||
in.push_back("../include");
|
in.push_back("../include");
|
||||||
std::map<std::string, std::string> variables;
|
std::map<std::string, std::string, cppcheck::stricmp> variables;
|
||||||
fs.setIncludePaths("abc/def/", in, variables);
|
fs.setIncludePaths("abc/def/", in, variables);
|
||||||
ASSERT_EQUALS(1U, fs.includePaths.size());
|
ASSERT_EQUALS(1U, fs.includePaths.size());
|
||||||
ASSERT_EQUALS("abc/include/", fs.includePaths.front());
|
ASSERT_EQUALS("abc/include/", fs.includePaths.front());
|
||||||
|
@ -66,7 +67,18 @@ private:
|
||||||
ImportProject::FileSettings fs;
|
ImportProject::FileSettings fs;
|
||||||
std::list<std::string> in;
|
std::list<std::string> in;
|
||||||
in.push_back("$(SolutionDir)other");
|
in.push_back("$(SolutionDir)other");
|
||||||
std::map<std::string, std::string> variables;
|
std::map<std::string, std::string, cppcheck::stricmp> variables;
|
||||||
|
variables["SolutionDir"] = "c:/abc/";
|
||||||
|
fs.setIncludePaths("/home/fred", in, variables);
|
||||||
|
ASSERT_EQUALS(1U, fs.includePaths.size());
|
||||||
|
ASSERT_EQUALS("c:/abc/other/", fs.includePaths.front());
|
||||||
|
}
|
||||||
|
|
||||||
|
void setIncludePaths3() const { // macro names are case insensitive
|
||||||
|
ImportProject::FileSettings fs;
|
||||||
|
std::list<std::string> in;
|
||||||
|
in.push_back("$(SOLUTIONDIR)other");
|
||||||
|
std::map<std::string, std::string, cppcheck::stricmp> variables;
|
||||||
variables["SolutionDir"] = "c:/abc/";
|
variables["SolutionDir"] = "c:/abc/";
|
||||||
fs.setIncludePaths("/home/fred", in, variables);
|
fs.setIncludePaths("/home/fred", in, variables);
|
||||||
ASSERT_EQUALS(1U, fs.includePaths.size());
|
ASSERT_EQUALS(1U, fs.includePaths.size());
|
||||||
|
|
Loading…
Reference in New Issue