PhoenixPresentation  2.0.0
Set of cmake function to automate presentation generation
main_vector.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 
12 template<typename T>
13 void testSimpleVectorValue(const std::string & testTypeName){
14  std::string fileName("value_test_vector.data");
15  size_t nbValue(10lu);
16  std::vector<T> vecRef;
17  for(size_t i(0lu); i < nbValue; ++i){vecRef.push_back(i);}
18  data_stream_assert(data_save(fileName, vecRef));
19  std::vector<T> vecValue;
20  data_stream_assert(data_load(fileName, vecValue));
21  data_stream_assert(checkValue("std::vector<"+testTypeName+">", vecValue, vecRef));
22 }
23 
26  testSimpleVectorValue<long unsigned int>("long unsigned int");
27  testSimpleVectorValue<unsigned int>("unsigned int");
28  testSimpleVectorValue<unsigned short>("unsigned short");
29  testSimpleVectorValue<unsigned char>("unsigned char");
30  testSimpleVectorValue<long int>("long int");
31  testSimpleVectorValue<int>("int");
32  testSimpleVectorValue<short>("short");
33  testSimpleVectorValue<char>("char");
34  testSimpleVectorValue<int8_t>("int8_t");
35  testSimpleVectorValue<float>("float");
36  testSimpleVectorValue<double>("double");
37 }
38 
39 int main(int argc, char** argv){
41  return 0;
42 }
43 
44 
void testVectorDataFile()
Test if data size is Ok.
Definition: main_vector.cpp:25
int main(int argc, char **argv)
Definition: main_vector.cpp:39
void testSimpleVectorValue(const std::string &testTypeName)
Abstract check a vector of values stored in a file.
Definition: main_vector.cpp:13
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.