PhoenixInkscape  2.0.0
Generate multiple png files with svg inkscape files
phoenix_check.h File Reference
#include <vector>
#include <list>
#include "phoenix_isOk.h"
#include "phoenix_check_impl.h"
+ Include dependency graph for phoenix_check.h:
+ This graph shows which files directly or indirectly include this file:

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...
 
template<typename T >
bool phoenix_check (const std::string &testName, const std::vector< T > &vecVal, const std::vector< T > &vecRef)
 Check two vector of values. More...
 
template<typename T >
bool phoenix_check (const std::string &testName, const T &val, const T &reference)
 Check two value. More...
 

Function Documentation

◆ phoenix_check() [1/4]

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 31 of file phoenix_check.cpp.

31  {
32  bool b(true);
33  //On this implementation, two list of different sizes are not comparable
34  b &= phoenix_check(testName + " size", listVal.size(), listRef.size());
35  std::list<std::string>::const_iterator itVal(listVal.begin());
36  std::list<std::string>::const_iterator itRef(listRef.begin());
37  size_t i(0lu);
38  while(itVal != listVal.end() && itRef != listRef.end() && b){
39  b &= phoenix_check(testName + " str("+valueToString(i)+")", *itVal, *itRef);
40  ++itVal;
41  ++itRef;
42  ++i;
43  }
44  return b;
45 }
std::string valueToString(const T &val)
Convert a type into a string.
bool phoenix_check(const std::string &testName, const std::string &val, const std::string &reference)
Check two string.

References phoenix_check(), and valueToString().

+ Here is the call graph for this function:

◆ phoenix_check() [2/4]

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 15 of file phoenix_check.cpp.

15  {
16  bool b(val == reference);
17  if(!b){
18  std::cout << "phoenix_check : " << testName << " => " << phoenix_isOk(b) << std::endl;
19  std::cout << "\tval = '"<<val<<"'" << std::endl;
20  std::cout << "\treference = '"<<reference<<"'" << std::endl;
21  }
22  return b;
23 }
std::string phoenix_isOk(bool b)
Print OK or FAIL depending on the given boolean.

References phoenix_isOk().

Referenced by checkEraseFirstChars(), checkEraseFirstLastChars(), checkEraseLastChars(), checkFindPatternIndex(), checkGetBetweenDelimiter(), checkLoadFromConfig(), checkOpenVecFileStream(), checkOptionCompletion(), checkParser(), checkParseXmlFile(), checkPhoenixCheck(), checkResultConvertToString(), checkString(), checkVarReplaceStr(), checkXmlString(), main(), phoenix_check(), printValueOfOpt(), printValueOfOptConst(), testCheck(), testCheckList(), testCheckVector(), testDicoValueKey(), testEscapeString(), testFromJSonToJSon(), testIsOk(), testPFileParserGetUntilKey(), testPFileParserPartern(), testPFileParserParternExclude(), testPFileParserParternRecurse(), testPFileParserParternRecurse2(), testPFileParserParternRecurseAllowChar(), testPFileParserParternRecurseExcludeEnd(), testPFileParserParternRecurseExcludeEnd2(), testPFileParserSeq(), testPFileParserSeqOneStep(), testPPathGetExtention(), testPPathGetFileDirName(), testPPathGetUnderPath(), testPPathListAllFileInDir(), testPPathOperator(), testPPathRemoveDots(), and testRemaningArgument().

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

◆ phoenix_check() [3/4]

template<typename T >
bool phoenix_check ( const std::string &  testName,
const std::vector< T > &  vecVal,
const std::vector< T > &  vecRef 
)

Check two vector of values.

Parameters
testName: name of the current test
vecVal: vector of values to be checked
vecRef: vector of reference values
Returns
true if val == reference, false otherwise

Definition at line 23 of file phoenix_check_impl.h.

23  {
24  bool b(true);
25  //On this implementation, two vectors of different sizes are not comparable
26  b &= phoenix_check(testName + " size", vecVal.size(), vecRef.size());
27  for(size_t i(0lu); i < vecVal.size() && b; ++i){
28  b &= phoenix_check(testName + " str("+PString::toString(i)+")", vecVal[i], vecRef[i]);
29  }
30  return b;
31 }
static PString toString(const T &value)
Convert a value to a PString.
Definition: PString_impl.h:18
bool phoenix_check(const std::string &testName, const std::vector< T > &vecVal, const std::vector< T > &vecRef)
Check two vector of values.

References phoenix_check(), and PString::toString().

Referenced by phoenix_check().

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

◆ phoenix_check() [4/4]

template<typename T >
bool phoenix_check ( const std::string &  testName,
const T &  val,
const T &  reference 
)

Check two value.

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

Definition at line 40 of file phoenix_check_impl.h.

40  {
41  bool b(val == reference);
42  if(!b){
43  std::cout << "phoenix_check : " << testName << " => " << phoenix_isOk(b) << std::endl;
44  std::cout << "\tval = '"<<PString::toString(val)<<"'" << std::endl;
45  std::cout << "\treference = '"<<PString::toString(reference)<<"'" << std::endl;
46  }
47  return b;
48 }

References phoenix_isOk(), and PString::toString().

+ Here is the call graph for this function: