DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
testProgressBar.cpp
1 
30 
31 #include <iostream>
32 #include "DGtal/base/Common.h"
33 
34 #ifdef UNIX
35 #include <unistd.h>
36 #endif
37 
39 
40 using namespace std;
41 using namespace DGtal;
42 
44 // Functions for testing class ProgressBar.
46 
50 bool testProgressBar()
51 {
52  trace.beginBlock ( "Testing progress ..." );
53 
54  for(unsigned int i=0; i <= 10 ; ++i)
55  {
56  trace.progressBar(i,10);
57 #ifdef UNIX
58  usleep(50000);
59 #endif
60  }
61  trace.info() << std::endl;
62  trace.endBlock();
63 
64  return true;
65 }
66 
68 // Standard services - public :
69 
70 int main( int argc, char** argv )
71 {
72  trace.beginBlock ( "Testing class ProgressBar" );
73  trace.info() << "Args:";
74  for ( int i = 0; i < argc; ++i )
75  trace.info() << " " << argv[ i ];
76  trace.info() << endl;
77 
78  bool res = testProgressBar(); // && ... other tests
79  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
80  trace.endBlock();
81  return res ? 0 : 1;
82 }
83 // //