PhoenixInkscape  2.0.0
Generate multiple png files with svg inkscape files
main_vector_pair.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 "phoenix_data_stream.h"
8 
10 
13 template<typename T, typename U>
14 void testSimpleVectorPairValue(const std::string & testName, size_t nbValue){
15  std::string fileName("value_test_vector_pair.data");
16 
17  std::vector<std::pair<T, U> > vecRef;
18  for(size_t i(0lu); i < nbValue; ++i){vecRef.push_back(std::pair<T, U>(i,2lu*i));}
19  data_stream_assert(data_save(fileName, vecRef));
20  std::vector<std::pair<T, U> > vecValue;
21  data_stream_assert(data_load(fileName, vecValue));
22  data_stream_assert(checkValue(testName, vecValue, vecRef));
23 }
24 
26 
29 template<typename T>
30 void testSetVectorPairValue(const std::string & firstTypeName, size_t nbValue){
31  testSimpleVectorPairValue<T, long unsigned int>("std::vector<std::pair<"+firstTypeName+", long unsigned int> >", nbValue);
32  testSimpleVectorPairValue<T, unsigned int>("std::vector<std::pair<"+firstTypeName+", unsigned int> >", nbValue);
33  testSimpleVectorPairValue<T, unsigned short>("std::vector<std::pair<"+firstTypeName+", unsigned short> >", nbValue);
34  testSimpleVectorPairValue<T, unsigned char>("std::vector<std::pair<"+firstTypeName+", unsigned char> >", nbValue);
35 
36  testSimpleVectorPairValue<T, long int>("std::vector<std::pair<"+firstTypeName+", long int> >", nbValue);
37  testSimpleVectorPairValue<T, int>("std::vector<std::pair<"+firstTypeName+", int> >", nbValue);
38  testSimpleVectorPairValue<T, short>("std::vector<std::pair<"+firstTypeName+", short> >", nbValue);
39  testSimpleVectorPairValue<T, char>("std::vector<std::pair<"+firstTypeName+", char> >", nbValue);
40  testSimpleVectorPairValue<T, int8_t>("std::vector<std::pair<"+firstTypeName+", int8_t> >", nbValue);
41  testSimpleVectorPairValue<T, float>("std::vector<std::pair<"+firstTypeName+", float> >", nbValue);
42  testSimpleVectorPairValue<T, double>("std::vector<std::pair<"+firstTypeName+", double> >", nbValue);
43  testSimpleVectorPairValue<T, bool>("std::vector<std::pair<"+firstTypeName+", bool> >", nbValue);
44 }
45 
48  size_t nbValue(10lu);
49  testSetVectorPairValue<long unsigned int>("long unsigned int", nbValue);
50  testSetVectorPairValue<unsigned int>("unsigned int", nbValue);
51  testSetVectorPairValue<unsigned short>("unsigned short", nbValue);
52  testSetVectorPairValue<unsigned char>("unsigned char", nbValue);
53  testSetVectorPairValue<long int>("long int", nbValue);
54  testSetVectorPairValue<int>("int", nbValue);
55  testSetVectorPairValue<short>("short", nbValue);
56  testSetVectorPairValue<char>("char", nbValue);
57  testSetVectorPairValue<int8_t>("int8_t", nbValue);
58  testSetVectorPairValue<float>("float", nbValue);
59  testSetVectorPairValue<double>("double", nbValue);
60  testSetVectorPairValue<bool>("bool", nbValue);
61 }
62 
63 
64 int main(int argc, char** argv){
66  return 0;
67 }
68 
69 
int main(int argc, char **argv)
void testSimpleVectorPairValue(const std::string &testName, size_t nbValue)
Abstract check of values stored in a file.
void testSetVectorPairValue(const std::string &firstTypeName, size_t nbValue)
Abstract check of values stored in a file.
void testVectorPairDataFile()
Test if data size is Ok.
bool data_load(FILE *iter, T &data)
Load data from a message.
Definition: data_file.h:39
bool data_save(FILE *iter, const T &data)
Save data in a message.
Definition: data_file.h:18
#define data_stream_assert(isOk)
bool checkValue(const std::string &testName, const T &givenSize, const T &referenceSize)
Check given value compare to the reference value.