PhoenixMock  1.8.7
Tools to split/merge/print mock used in Phoenix
main.cpp
Go to the documentation of this file.
1 
2 /***************************************
3  Auteur : Pierre Aubert
4  Mail : pierre.aubert@lapp.in2p3.fr
5  Licence : CeCILL-C
6 ****************************************/
7 
8 #include <iostream>
9 #include <vector>
10 #include "phoenix_assert.h"
11 #include "print_string.h"
12 #include "phoenix_vector_split.h"
13 
16  std::vector<int> vecInt;
17  for(size_t i(0lu); i < 10lu; ++i){
18  vecInt.push_back((int)i);
19  }
20 
21  std::vector<std::vector<int> > vecVecInt;
22 
23  phoenix_vector_split(vecVecInt, vecInt, 2lu);
24  std::cout << "testVectorSplit : vecInt :" << std::endl;
25  phoenix_print(vecInt);
26  std::cout << "testVectorSplit : vecVecInt :" << std::endl;
27  phoenix_print(vecVecInt);
28 
29  for(int i(0); i < 5; ++i){
30  phoenix_assert(vecVecInt[0][i] == 2*i);
31  phoenix_assert(vecVecInt[1][i] == 2*i + 1);
32  }
33 }
34 
37  std::vector<int> vecInt;
38  for(size_t i(0lu); i < 2lu; ++i){
39  vecInt.push_back((int)i);
40  }
41 
42  std::vector<std::vector<int> > vecVecInt;
43 
44  phoenix_vector_split(vecVecInt, vecInt, 6lu);
45  std::cout << "testVectorSplit2 : vecInt :" << std::endl;
46  phoenix_print(vecInt);
47  std::cout << "testVectorSplit2 : vecVecInt :" << std::endl;
48  phoenix_print(vecVecInt);
49 
50  for(int i(0); i < 1; ++i){
51  phoenix_assert(vecVecInt[0][i] == 2*i);
52  phoenix_assert(vecVecInt[1][i] == 2*i + 1);
53  }
54 }
55 
56 int main(int argc, char** argv){
59  return 0;
60 }
61 
62 
phoenix_print
void phoenix_print(const T &data, const std::string &suffix="", const std::string &prefix="")
Print data.
Definition: print_string_impl.h:18
phoenix_vector_split
void phoenix_vector_split(std::vector< std::vector< T > > &vecVecOutput, const std::vector< T > &vecInput, size_t nbPart)
Split a list in a list of lists, keep the order of the input file if the output is used for std::thre...
Definition: phoenix_vector_split.h:19
testVectorSplit
void testVectorSplit()
Test the string filename function.
Definition: main.cpp:15
print_string.h
phoenix_vector_split.h
phoenix_assert
#define phoenix_assert(isOk)
Definition: phoenix_assert.h:19
testVectorSplit2
void testVectorSplit2()
Test the string filename function.
Definition: main.cpp:36
phoenix_assert.h
main
int main(int argc, char **argv)
Definition: main.cpp:85