PhoenixInkscape  2.0.0
Generate multiple png files with svg inkscape files
phoenix_check_impl.h
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 #ifndef __PHOENIX_CHECK_IMPL_H__
8 #define __PHOENIX_CHECK_IMPL_H__
9 
10 #include <iostream>
11 #include "PString.h"
12 #include "convertToString.h"
13 
14 #include "phoenix_check.h"
15 
17 
22 template<typename T>
23 bool phoenix_check(const std::string & testName, const std::vector<T> & vecVal, const std::vector<T> & vecRef){
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 }
32 
34 
39 template<typename T>
40 bool phoenix_check(const std::string & testName, const T & val, const T & reference){
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 }
49 
50 
51 
52 
53 #endif
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.
std::string phoenix_isOk(bool b)
Print OK or FAIL depending on the given boolean.