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