PhoenixPresentation  2.0.0
Set of cmake function to automate presentation generation
main_map.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 checkMapDataSize(const std::string & testTypeName){
14  size_t nbValue(10lu);
15  std::map<T, T> mapData;
16  for(size_t i(0lu); i < nbValue; ++i){mapData[i] = i;}
17  size_t sizeData = data_size(mapData);
18  data_stream_assert(checkValue(testTypeName, sizeData, 2lu*sizeof(T)*nbValue + sizeof(size_t)));
19 }
20 
23  checkMapDataSize<long unsigned int>("long unsigned int");
24  checkMapDataSize<unsigned int>("unsigned int");
25  checkMapDataSize<unsigned short>("unsigned short");
26  checkMapDataSize<unsigned char>("unsigned char");
27  checkMapDataSize<long int>("long int");
28  checkMapDataSize<long>("long");
29  checkMapDataSize<int>("int");
30  checkMapDataSize<short>("short");
31  checkMapDataSize<char>("char");
32  checkMapDataSize<int8_t>("int8_t");
33 }
34 
35 int main(int argc, char** argv){
37  return 0;
38 }
39 
int main(int argc, char **argv)
Definition: main_map.cpp:63
void testMapDataSize()
Test if data size is Ok.
Definition: main_map.cpp:22
void checkMapDataSize(const std::string &testTypeName)
Check the size of given map of data.
Definition: main_map.cpp:13
size_t data_size(T &data)
Get size of data.
Definition: data_size.h:17
#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.