PhoenixInkscape  2.0.0
Generate multiple png files with svg inkscape files
phoenix_check.cpp
Go to the documentation of this file.
1 /***************************************
2  Auteur : Pierre Aubert
3  Mail : pierre.aubert@lapp.in2p3.fr
4  Licence : CeCILL-C
5 ****************************************/
6 
7 #include "convertToString.h"
8 #include "phoenix_check.h"
9 
11 
16 bool phoenix_check(const std::string & testName, const std::string & val, const std::string & reference){
17  bool b(val == reference);
18  if(!b){
19  std::cout << "phoenix_check : " << testName << " => " << phoenix_isOk(b) << std::endl;
20  std::cout << "\tval = '"<<val<<"'" << std::endl;
21  std::cout << "\treference = '"<<reference<<"'" << std::endl;
22  }
23  return b;
24 }
25 
27 
32 bool phoenix_check(const std::string & testName, const std::vector<std::string> & listVal, const std::vector<std::string> & listRef){
33  bool b(true);
34  //On this implementation, two vectors of different sizes are not comparable
35  b &= phoenix_check(testName + " size", listVal.size(), listRef.size());
36  for(size_t i(0lu); i < listVal.size() && b; ++i){
37  b &= phoenix_check(testName + " str("+valueToString(i)+")", listVal[i], listRef[i]);
38  }
39  return b;
40 }
41 
43 
48 bool phoenix_check(const std::string & testName, const std::list<std::string> & listVal, const std::list<std::string> & listRef){
49  bool b(true);
50  //On this implementation, two list of different sizes are not comparable
51  b &= phoenix_check(testName + " size", listVal.size(), listRef.size());
52  std::list<std::string>::const_iterator itVal(listVal.begin());
53  std::list<std::string>::const_iterator itRef(listRef.begin());
54  size_t i(0lu);
55  while(itVal != listVal.end() && itRef != listRef.end() && b){
56  b &= phoenix_check(testName + " str("+valueToString(i)+")", *itVal, *itRef);
57  ++itVal;
58  ++itRef;
59  ++i;
60  }
61  return b;
62 }
63 
64 
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.
std::string phoenix_isOk(bool b)
Print OK or FAIL depending on the given boolean.