32 #include "DGtal/base/Common.h"
33 #include "DGtal/arithmetic/ModuloComputer.h"
34 #include "DGtal/kernel/NumberTraits.h"
39 using namespace DGtal;
48 bool testModuloComputer()
50 unsigned int nbok = 0;
62 a = modular.cast( 2 );
63 nbok += (a == 2) ? 1 : 0;
67 a = modular.cast( -1 );
68 nbok += (a== 14) ? 1 : 0;
72 modular.increment( a );
73 nbok += (a== 0) ? 1 : 0;
79 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << std::endl;
88 int main(
int argc,
char** argv )
92 for (
int i = 0; i < argc; ++i )
96 bool res = testModuloComputer();
97 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
void beginBlock(const std::string &keyword="")
implements basic functions on modular arithmetic.
DGtal is the top-level namespace which contains all DGtal functions and types.