 |
PhoenixMock
1.8.7
Tools to split/merge/print mock used in Phoenix
|
Go to the documentation of this file.
21 bool checkString(
const std::string & testName,
const std::string & strValue,
const std::string & strReference){
27 std::list<std::string> listStrRef;
29 listStrRef.push_back(
"one");
33 listStrRef.push_back(
"two");
36 listStrRef.push_back(
"three");
41 std::vector<std::string> vecStrRef;
43 vecStrRef.push_back(
"one");
47 vecStrRef.push_back(
"two");
50 vecStrRef.push_back(
"three");
64 std::string testString(
"some string to be used");
70 std::vector<std::string> vecStringToReplace;
71 vecStringToReplace.push_back(testString);
72 std::vector<std::string> vecReplacedString =
replaceStrInStr(vecStringToReplace,
"string",
"text");
84 std::vector<std::string> vecStrRef;
85 vecStrRef.push_back(
"one");
86 vecStrRef.push_back(
"two");
87 vecStrRef.push_back(
"three");
89 std::list<std::string> listStr(
cutStringList(
"one two three",
' '));
95 std::list<std::string>::iterator itList(listStr.begin());
96 std::list<std::string>::iterator itSpaceList(listSpaceStr.begin());
97 std::vector<std::string>::iterator itVec(vecStr.begin());
98 std::vector<std::string>::iterator itSpaceVec(vecSpaceStr.begin());
99 std::vector<std::string>::iterator itVecRef(vecStrRef.begin());
101 while(itList != listStr.end() && itVec != vecStr.end() && itVecRef != vecStrRef.end() && itSpaceList != listSpaceStr.end() && itSpaceVec != vecSpaceStr.end()){
156 const std::string & strReference)
164 std::vector<std::string> vecStrPattern;
167 vecStrPattern.push_back(
"key");
170 vecStrPattern.push_back(
"value");
181 bool checkReplaceListStrInStr(
const std::string & inputStr,
const std::list<std::string> & vecPattern,
const std::string & replace,
182 const std::string & strReference)
190 std::list<std::string> vecStrPattern;
193 vecStrPattern.push_back(
"key");
196 vecStrPattern.push_back(
"value");
202 std::map<std::string, std::string> mapReplace;
204 mapReplace[
"string"] =
"value";
205 mapReplace[
"convert"] =
"replace";
229 int main(
int argc,
char** argv){
void testCharToString()
Test the phoenix_charToString function.
std::vector< std::string > cutStringOnSpacesVector(const std::string &str)
Cut a string on white characters ('\t' ou ' ')
void testStringFunction()
Test the string filename function.
std::string eraseCharInStr(const std::string &str, char ch)
copie la string str en effaçant le caractère ch
bool findInVectorString(const std::vector< std::string > &vecStr, const std::string &str)
Find a string in a vector of string.
void replaceListStrInStr(std::string &srcDest, const std::list< std::string > &listPatern, const std::string &replace)
Replace all the list patern in the string srcDest by the replace string.
std::string phoenix_charToString(const char *ch)
Convert a char pointer into a string (event if the char pointer is NULL)
std::list< std::string > cutStringOnSpacesList(const std::string &str)
Cut a string on white characters ('\t' ou ' ')
bool findCharsInString(const std::string &str, const std::string &chars)
Find multiple chars in a string.
void testFindInListString()
Test the find in list string filename function.
bool findInString(const std::string &str, char ch)
Find a char in a string.
std::string replaceCharInStr(const std::string &str, char find, char replace)
fonction qui remplace un caractère par un autre dans une string
bool phoenix_check(const std::string &testName, const std::string &val, const std::string &reference)
Check two string.
bool isSameBegining(const std::string &str, const std::string &beginig)
Check if two string start the same way.
bool checkReplaceVectorStrInStr(const std::string &inputStr, const std::vector< std::string > &vecPattern, const std::string &replace, const std::string &strReference)
Check the replaceVectorStrInStr function.
std::list< std::string > cutStringList(const std::string &str, char separator)
Cut a string the the given separator char.
void replaceVectorStrInStr(std::string &srcDest, const std::vector< std::string > &vecPatern, const std::string &replace)
Replace all the vector patern in the string srcDest by the replace string.
std::string copyStr(const std::string &str, long unsigned int begin, long unsigned int nbCh)
Copy a string of nbCh starting from begin char.
std::string eraseCharsInStr(const std::string &str, const std::string &rmchs)
copie la string str en effaçant les caractères rmchs
void testReplaceVectorStrInStr()
Test the replaceVectorStrInStr function.
void testReplaceStrInStrMap()
Test the replace of str in str with map.
bool findInListString(const std::list< std::string > &listStr, const std::string &str)
Find a string in a list of string.
void testEscapeString()
Test the phoenix_escapeStr function.
size_t countStrInStr(const std::string &src, const std::string &patern)
Count the number of patern in string.
void testReplaceListStrInStr()
Test the replaceVectorStrInStr function.
std::string replaceCharsInStr(const std::string &str, const std::string &strFind, char replace)
Replace all char in the strFind by char replace.
#define phoenix_assert(isOk)
std::string eraseLastCharsInStr(const std::string &str, const std::string &chars)
Erase first and last char in a string.
std::string phoenix_escapeStr(const std::string &src, const std::string &strCharToEscape, const std::string &escapeStr)
Escape given string with passed characters.
std::vector< std::string > cutStringVector(const std::string &str, char separator)
Cut a string the the given separator char.
void replaceStrInStr(std::string &out, const std::string &src, const std::string &patern, const std::string &replace)
Replace a patern by an other in the input string.
std::string phoenix_getCommonBegining(const std::string &str1, const std::string &str2)
Get the common begining between str1 and str2.
size_t countNbChar(const std::string &str, char ch)
Count number of chararacters ch in string.
bool checkString(const std::string &testName, const std::string &strValue, const std::string &strReference)
Check string lower expression.
bool checkReplaceListStrInStr(const std::string &inputStr, const std::list< std::string > &vecPattern, const std::string &replace, const std::string &strReference)
Check the replaceVectorStrInStr function.
int main(int argc, char **argv)
void testGetCommonBegning()
Test the phoenix_getCommonBegining function.