32#include "DGtal/base/Common.h"
33#include "DGtal/arithmetic/ModuloComputer.h"
34#include "DGtal/kernel/NumberTraits.h"
50 unsigned int nbok = 0;
53 trace.beginBlock (
"Testing block ..." );
62 a = modular.
cast( 2 );
63 nbok += (a == 2) ? 1 : 0;
65 trace.info() <<
"a= "<<a<<std::endl;
67 a = modular.
cast( -1 );
68 nbok += (a== 14) ? 1 : 0;
70 trace.info() <<
"a= "<<a<<std::endl;
73 nbok += (a== 0) ? 1 : 0;
75 trace.info() <<
"a= "<<a<<std::endl;
79 trace.info() <<
"(" << nbok <<
"/" << nb <<
") " << std::endl;
88int main(
int argc,
char** argv )
90 trace.beginBlock (
"Testing class ModuloComputer" );
91 trace.info() <<
"Args:";
92 for (
int i = 0; i < argc; ++i )
93 trace.info() <<
" " << argv[ i ];
97 trace.emphase() << ( res ?
"Passed." :
"Error." ) << endl;
88int main(
int argc,
char** argv ) {
…}
implements basic functions on modular arithmetic.
void increment(UnsignedInteger &i) const
UnsignedInteger cast(IntegerParamType i) const
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: The traits class for all models of Cinteger.
bool testModuloComputer()