DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
testSTLMapToVertexMapAdapter.cpp
1 
30 
31 #include <iostream>
32 #include <vector>
33 #include "DGtal/helpers/StdDefs.h"
34 
35 #include "DGtal/base/Common.h"
36 #include "DGtal/topology/CVertexMap.h"
37 #include "DGtal/topology/STLMapToVertexMapAdapter.h"
38 #include <map>
40 
41 
42 
43 using namespace std;
44 using namespace DGtal;
45 
52 
53 // Functions for testing class Adjacency.
55 
56 bool testMapToVertexMap()
57 {
58  typedef Z2i::Point Point;
59  typedef Z2i::Point Vertex;
60  typedef int Value;
61  typedef map<Vertex, Value> Map;
62  typedef STLMapToVertexMapAdapter<Map> VertexMap;
63  VertexMap myMap;
64  BOOST_CONCEPT_ASSERT((CVertexMap<VertexMap>));
65  myMap.setValue(Point(1,1), 10);
66  myMap.setValue(Point(2,3), 2);
67 
68  return (myMap(Point(1,1)) == 10 && myMap(Point(2,3)) == 2);
69 }
70 
71 
72 
74 // Standard services - public :
75 
76 int main( int /*argc*/, char** /*argv*/ )
77 {
78  trace.beginBlock ( "Testing class STLMapToVertexMapAdapter" );
79 
80  bool res = testMapToVertexMap(); // && ... other tests
81  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
82  trace.endBlock();
83  return res ? 0 : 1;
84 }
85 // //