PhoenixPresentation  2.0.0
Set of cmake function to automate presentation generation
main_map.cpp File Reference
+ Include dependency graph for main_map.cpp:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 
void testMapDataFile ()
 Test if data size is Ok. More...
 
template<typename T >
void testSetMapValue (const std::string &firstTypeName, size_t nbValue)
 Abstract check of values stored in a file. More...
 
template<typename T , typename U >
void testSimpleMapValue (const std::string &testName, size_t nbValue)
 Abstract check of values stored in a file. More...
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 63 of file main_map.cpp.

63  {
65  return 0;
66 }
void testMapDataFile()
Test if data size is Ok.
Definition: main_map.cpp:46

References testMapDataFile().

+ Here is the call graph for this function:

◆ testMapDataFile()

void testMapDataFile ( )

Test if data size is Ok.

Definition at line 46 of file main_map.cpp.

46  {
47  size_t nbValue(10lu);
48  testSetMapValue<long unsigned int>("long unsigned int", nbValue);
49  testSetMapValue<unsigned int>("unsigned int", nbValue);
50  testSetMapValue<unsigned short>("unsigned short", nbValue);
51  testSetMapValue<unsigned char>("unsigned char", nbValue);
52  testSetMapValue<long int>("long int", nbValue);
53  testSetMapValue<int>("int", nbValue);
54  testSetMapValue<short>("short", nbValue);
55  testSetMapValue<char>("char", nbValue);
56  testSetMapValue<int8_t>("int8_t", nbValue);
57  testSetMapValue<float>("float", nbValue);
58  testSetMapValue<double>("double", nbValue);
59  testSetMapValue<bool>("bool", nbValue);
60 }

Referenced by main().

+ Here is the caller graph for this function:

◆ testSetMapValue()

template<typename T >
void testSetMapValue ( const std::string &  firstTypeName,
size_t  nbValue 
)

Abstract check of values stored in a file.

Parameters
firstTypeName: name of the first type
nbValue: number of values to put in the reference map

Definition at line 29 of file main_map.cpp.

29  {
30  testSimpleMapValue<T, long unsigned int>("std::map<"+firstTypeName+", long unsigned int>", nbValue);
31  testSimpleMapValue<T, unsigned int>("std::map<"+firstTypeName+", unsigned int>", nbValue);
32  testSimpleMapValue<T, unsigned short>("std::map<"+firstTypeName+", unsigned short>", nbValue);
33  testSimpleMapValue<T, unsigned char>("std::map<"+firstTypeName+", unsigned char>", nbValue);
34  testSimpleMapValue<T, long int>("std::map<"+firstTypeName+", long int>", nbValue);
35  testSimpleMapValue<T, int>("std::map<"+firstTypeName+", int>", nbValue);
36  testSimpleMapValue<T, short>("std::map<"+firstTypeName+", short>", nbValue);
37  testSimpleMapValue<T, char>("std::map<"+firstTypeName+", char>", nbValue);
38  testSimpleMapValue<T, int8_t>("std::map<"+firstTypeName+", int8_t>", nbValue);
39  testSimpleMapValue<T, float>("std::map<"+firstTypeName+", float>", nbValue);
40  testSimpleMapValue<T, double>("std::map<"+firstTypeName+", double>", nbValue);
41  testSimpleMapValue<T, bool>("std::map<"+firstTypeName+", bool>", nbValue);
42 
43 }

◆ testSimpleMapValue()

template<typename T , typename U >
void testSimpleMapValue ( const std::string &  testName,
size_t  nbValue 
)

Abstract check of values stored in a file.

Parameters
testName: name of the test
nbValue: number of values to put in the reference map

Definition at line 14 of file main_map.cpp.

14  {
15  std::string fileName("value_test_map.data");
16  std::map<T, U> vecRef;
17  for(size_t i(0lu); i < nbValue; ++i){vecRef[i] = (U)(2lu*i > nbValue/2lu);}
18  data_stream_assert(data_save(fileName, vecRef));
19  std::map<T, U> vecValue;
20  data_stream_assert(data_load(fileName, vecValue));
21  data_stream_assert(checkValue(testName, vecValue, vecRef));
22 }
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.

References checkValue(), data_load(), data_save(), and data_stream_assert.

+ Here is the call graph for this function: