PhoenixMock  1.8.7
Tools to split/merge/print mock used in Phoenix
phoenix_check.cpp File Reference
#include "convertToString.h"
#include "string_filename.h"
#include "phoenix_check.h"
+ Include dependency graph for phoenix_check.cpp:

Go to the source code of this file.

Functions

bool phoenix_check (const std::string &testName, const std::list< std::string > &listVal, const std::list< std::string > &listRef)
 Check two list of string. More...
 
bool phoenix_check (const std::string &testName, const std::string &val, const std::string &reference)
 Check two string. More...
 
bool phoenix_check (const std::string &testName, const std::vector< std::string > &listVal, const std::vector< std::string > &listRef)
 Check two vector of string. More...
 
bool phoenix_check_fileContent (const std::string &testName, const std::string &fileName, const std::string &expectedContent)
 Check the content of a file. More...
 

Function Documentation

◆ phoenix_check() [1/3]

bool phoenix_check ( const std::string &  testName,
const std::list< std::string > &  listVal,
const std::list< std::string > &  listRef 
)

Check two list of string.

Parameters
testName: name of the current test
listVal: list of std::string to be checked
listRef: list of reference std::string
Returns
true if val == reference, false otherwise

Definition at line 49 of file phoenix_check.cpp.

49  {
50  bool b(true);
51  //On this implementation, two list of different sizes are not comparable
52  b &= phoenix_check(testName + " size", listVal.size(), listRef.size());
53  std::list<std::string>::const_iterator itVal(listVal.begin());
54  std::list<std::string>::const_iterator itRef(listRef.begin());
55  size_t i(0lu);
56  while(itVal != listVal.end() && itRef != listRef.end() && b){
57  b &= phoenix_check(testName + " str("+convertToString(i)+")", *itVal, *itRef);
58  ++itVal;
59  ++itRef;
60  ++i;
61  }
62  return b;
63 }

References convertToString(), and phoenix_check().

+ Here is the call graph for this function:

◆ phoenix_check() [2/3]

bool phoenix_check ( const std::string &  testName,
const std::string &  val,
const std::string &  reference 
)

Check two string.

Parameters
testName: name of the current test
val: std::string to be checked
reference: reference std::string
Returns
true if val == reference, false otherwise

Definition at line 17 of file phoenix_check.cpp.

17  {
18  bool b(val == reference);
19  if(!b){
20  std::cout << "phoenix_check : " << testName << " => " << phoenix_isOk(b) << std::endl;
21  std::cout << "\tval = '"<<val<<"'" << std::endl;
22  std::cout << "\treference = '"<<reference<<"'" << std::endl;
23  }
24  return b;
25 }

References phoenix_isOk().

Referenced by checkEraseFirstChars(), checkEraseFirstLastChars(), checkEraseFirstLastCharsVector(), checkEraseLastChars(), checkOptionCompletion(), checkPhoenixCheck(), checkReplaceListStrInStr(), checkReplaceVectorStrInStr(), checkResultConvertToString(), checkResultFirstLower(), checkResultFirstUpper(), checkResultLower(), checkResultLowerUnderscore(), checkResultUpper(), checkString(), main(), phoenix_check(), phoenix_check_fileContent(), testCheckList(), testCheckVector(), testEscapeString(), testIsOk(), and testStringFilename().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ phoenix_check() [3/3]

bool phoenix_check ( const std::string &  testName,
const std::vector< std::string > &  listVal,
const std::vector< std::string > &  listRef 
)

Check two vector of string.

Parameters
testName: name of the current test
listVal: list of std::string to be checked
listRef: list of reference std::string
Returns
true if val == reference, false otherwise

Definition at line 33 of file phoenix_check.cpp.

33  {
34  bool b(true);
35  //On this implementation, two vectors of different sizes are not comparable
36  b &= phoenix_check(testName + " size", listVal.size(), listRef.size());
37  for(size_t i(0lu); i < listVal.size() && b; ++i){
38  b &= phoenix_check(testName + " str("+convertToString(i)+")", listVal[i], listRef[i]);
39  }
40  return b;
41 }

References convertToString(), and phoenix_check().

+ Here is the call graph for this function:

◆ phoenix_check_fileContent()

bool phoenix_check_fileContent ( const std::string &  testName,
const std::string &  fileName,
const std::string &  expectedContent 
)

Check the content of a file.

Parameters
testName: name of the current test
fileName: name of the file to be checked
expectedContent: expected content of the file
Returns
true if the file content is correct, false otherwise

Definition at line 71 of file phoenix_check.cpp.

71  {
72  return phoenix_check(testName, getFileContent(fileName), expectedContent);
73 }

References getFileContent(), and phoenix_check().

Referenced by testCheckFileContent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:
convertToString
std::string convertToString(const T &val)
Convert a type into a string.
Definition: convertToString_impl.h:17
getFileContent
std::string getFileContent(const std::string &filename)
Get the file content in a string.
Definition: string_filename.cpp:268
phoenix_check
bool phoenix_check(const std::string &testName, const std::string &val, const std::string &reference)
Check two string.
Definition: phoenix_check.cpp:17
phoenix_isOk
std::string phoenix_isOk(bool b)
Print OK or FAIL depending on the given boolean.
Definition: phoenix_isOk.cpp:14