DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
testMeasureSet.cpp
1 
30 
31 #include <iostream>
32 #include "DGtal/base/Common.h"
33 #include "DGtal/helpers/StdDefs.h"
34 #include "DGtal/shapes/Shapes.h"
35 #include "DGtal/shapes/ShapeFactory.h"
36 
37 #include "DGtal/geometry/volumes/estimation/Measure.h"
38 
40 
41 using namespace std;
42 using namespace DGtal;
43 
45 // Functions for testing class Measure.
47 
48 bool testConcept()
49 {
50 
51  return true;
52 }
53 
54 
55 
60 bool testMeasure()
61 {
62  unsigned int nbok = 0;
63  unsigned int nb = 0;
64 
65  trace.beginBlock ( "Testing Measure ..." );
66 
67 
68  Z3i::Point a(0,0);
69  Z3i::Point b(64,64,64);
70  Z3i::Point c(32,32,32);
71  Z3i::Domain domain(a,b);
72  Z3i::DigitalSet set(domain);
73 
75  ImplicitBall<Z3i::Space>( c, 10));
76 
78 
79  trace.info() << "Input set= "<<set<<std::endl;
80 
81  trace.info()<<measure<<std::endl;
82 
83 
84  measure.init(10, set);
85  trace.info() << "Volume (h=10) "<<measure.eval()<<std::endl;
86  measure.init(100, set);
87  trace.info() << "Volume (h=100) "<<measure.eval()<<std::endl;
88 
89  trace.info()<<measure<<std::endl;
90 
91  nbok += true ? 1 : 0;
92  nb++;
93  trace.info() << "(" << nbok << "/" << nb << ") "
94  << "true == true" << std::endl;
95  trace.endBlock();
96 
97  return nbok == nb;
98 }
99 
101 // Standard services - public :
102 
103 int main( int argc, char** argv )
104 {
105  trace.beginBlock ( "Testing class Measure" );
106  trace.info() << "Args:";
107  for ( int i = 0; i < argc; ++i )
108  trace.info() << " " << argv[ i ];
109  trace.info() << endl;
110 
111  bool res = testConcept() && testMeasure(); // && ... other tests
112  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
113  trace.endBlock();
114  return res ? 0 : 1;
115 }
116 // //