DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
testcpp11.cpp
1 
30 
31 #include <iostream>
32 #include "DGtal/base/Common.h"
34 
35 using namespace std;
36 using namespace DGtal;
37 
39 // Functions for testing class cpp11.
41 
45 bool testcpp11()
46 {
47  unsigned int nbok = 0;
48  unsigned int nb = 0;
49 
50  trace.beginBlock ( "Testing CPP Auto ..." );
51 
52 #ifdef CPP11_AUTO
53  auto a= 5.0;
54  auto mssg = "Message";
55 
56  trace.info() << "Auto value = "<<a<<std::endl;
57  trace.info() << "Auto string = "<< mssg <<std::endl;
58 #endif
59 
60  trace.endBlock();
61 
62 #ifdef CPP11_INITIALIZER_LIST
63  trace.info() << "initializer list ok"<<std::endl;
64 #endif
65 
66 
67 #ifdef CPP11_ARRAY
68  trace.info() << "std::Array ok"<<std::endl;
69 #endif
70 
71 
72 #ifdef CPP11_FORWARD_LIST
73  trace.info() << "Forward list ok"<<std::endl;
74 #endif
75 
76 
77 
78  nbok += true ? 1 : 0;
79  nb++;
80  trace.info() << "(" << nbok << "/" << nb << ") "
81  << "true == true" << std::endl;
82 
83  return nbok == nb;
84 }
85 
87 // Standard services - public :
88 
89 int main( int argc, char** argv )
90 {
91  trace.beginBlock ( "Testing class cpp11" );
92  trace.info() << "Args:";
93  for ( int i = 0; i < argc; ++i )
94  trace.info() << " " << argv[ i ];
95  trace.info() << endl;
96 
97  bool res = testcpp11(); // && ... other tests
98  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
99  trace.endBlock();
100  return res ? 0 : 1;
101 }
102 // //