DGtal  1.5.beta
testProgressBar.cpp
Go to the documentation of this file.
1 
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 
51 {
52  trace.beginBlock ( "Testing progress ..." );
53 
55  for(unsigned int i=0; i <= 10 ; ++i)
56  {
57  trace.progressBar(i,10);
58 #ifdef UNIX
59  usleep(50000);
60 #endif
61  }
62  trace.info() << std::endl;
63  trace.endBlock();
64 
65  return true;
66 }
67 
69 // Standard services - public :
70 
71 int main( int argc, char** argv )
72 {
73  trace.beginBlock ( "Testing class ProgressBar" );
74  trace.info() << "Args:";
75  for ( int i = 0; i < argc; ++i )
76  trace.info() << " " << argv[ i ];
77  trace.info() << endl;
78 
79  bool res = testProgressBar(); // && ... other tests
80  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
81  trace.endBlock();
82  return res ? 0 : 1;
83 }
84 // //
void beginBlock(const std::string &keyword="")
std::ostream & emphase()
std::ostream & info()
void progressBar(const double currentValue, const double maximalValue)
double endBlock()
DGtal is the top-level namespace which contains all DGtal functions and types.
Trace trace
Definition: Common.h:153
int main(int argc, char **argv)
bool testProgressBar()