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

Go to the source code of this file.

Functions

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

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 64 of file main_vector_pair.cpp.

64  {
66  return 0;
67 }
void testVectorPairDataFile()
Test if data size is Ok.

References testVectorPairDataFile().

+ Here is the call graph for this function:

◆ testSetVectorPairValue()

template<typename T >
void testSetVectorPairValue ( 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 vector

Definition at line 30 of file main_vector_pair.cpp.

30  {
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 }

◆ testSimpleVectorPairValue()

template<typename T , typename U >
void testSimpleVectorPairValue ( 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 vector

Definition at line 14 of file main_vector_pair.cpp.

14  {
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 }
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:

◆ testVectorPairDataFile()

void testVectorPairDataFile ( )

Test if data size is Ok.

Definition at line 47 of file main_vector_pair.cpp.

47  {
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 }

Referenced by main().

+ Here is the caller graph for this function: