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