DGtal  0.9.3
Functions
testDigitalTopology.cpp File Reference
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/kernel/SpaceND.h"
#include "DGtal/topology/MetricAdjacency.h"
#include "DGtal/topology/DigitalTopology.h"
Include dependency graph for testDigitalTopology.cpp:

Go to the source code of this file.

Functions

bool testDigitalTopologyZ2 ()
 
int main (int argc, char **argv)
 

Detailed Description

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Author
Jacques-Olivier Lachaud (jacqu.nosp@m.es-o.nosp@m.livie.nosp@m.r.la.nosp@m.chaud.nosp@m.@uni.nosp@m.v-sav.nosp@m.oie..nosp@m.fr ) Laboratory of Mathematics (CNRS, UMR 5807), University of Savoie, France
Date
2010/07/07

Functions for testing class DigitalTopology.

This file is part of the DGtal library.

Definition in file testDigitalTopology.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 84 of file testDigitalTopology.cpp.

References DGtal::Trace::beginBlock(), DGtal::Trace::emphase(), DGtal::Trace::endBlock(), DGtal::Trace::info(), testDigitalTopologyZ2(), and DGtal::trace.

85 {
86  trace.beginBlock ( "Testing class DigitalTopology" );
87  trace.info() << "Args:";
88  for ( int i = 0; i < argc; ++i )
89  trace.info() << " " << argv[ i ];
90  trace.info() << endl;
91 
92  bool res = testDigitalTopologyZ2(); // && ... other tests
93  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
94  trace.endBlock();
95  return res ? 0 : 1;
96 }
void beginBlock(const std::string &keyword="")
Trace trace
Definition: Common.h:137
double endBlock()
std::ostream & emphase()
std::ostream & info()
bool testDigitalTopologyZ2()

◆ testDigitalTopologyZ2()

bool testDigitalTopologyZ2 ( )

Example of a test. To be completed.

Definition at line 48 of file testDigitalTopology.cpp.

References DGtal::Trace::beginBlock(), DGtal::Trace::endBlock(), DGtal::Trace::info(), DGtal::JORDAN_DT, and DGtal::trace.

Referenced by main().

49 {
50  unsigned int nbok = 0;
51  unsigned int nb = 0;
52 
53  typedef SpaceND< 2 > Zi2;
56  Adj4 adj4;
57  Adj8 adj8;
58 
59  trace.beginBlock ( "Testing Digital topology (4,8) in Z2." );
60  typedef DigitalTopology< Adj4, Adj8 > DT48;
61  DT48 dt( adj4, adj8, JORDAN_DT );
62  nbok += true ? 1 : 0;
63  nb++;
64  trace.info() << "(" << nbok << "/" << nb << ") "
65  << dt << std::endl;
66  typedef DT48::ReverseTopology DT84;
67  DT84 opp_dt = dt.reverseTopology();
68  nbok += true ? 1 : 0;
69  nb++;
70  trace.info() << "(" << nbok << "/" << nb << ") "
71  << opp_dt << std::endl;
72  trace.endBlock();
73 
74  // should not compile
75  // typedef DigitalTopology< Adj4, bool > DTimpossible;
76  // DTimpossible dti( adj4, true );
77 
78  return nbok == nb;
79 }
void beginBlock(const std::string &keyword="")
MetricAdjacency< Space, 2 > Adj8
Definition: StdDefs.h:92
Trace trace
Definition: Common.h:137
Aim: SpaceND is a utility class that defines the fundamental structure of a Digital Space in ND...
Definition: SpaceND.h:95
double endBlock()
MetricAdjacency< Space, 1 > Adj4
Definition: StdDefs.h:90
Aim: Describes digital adjacencies in digital spaces that are defined with the 1-norm and the infinit...
Aim: Represents a digital topology as a couple of adjacency relations.
std::ostream & info()