32#include "DGtal/base/Common.h"
34#include "DGtal/geometry/curves/ArithmeticalDSLKernel.h"
53template <
typename Coordinate,
typename Integer,
unsigned short adj>
56 unsigned int nbok = 0;
64 trace.
info() <<
" step1: " << steps.first << std::endl;
65 trace.
info() <<
" step2: " << steps.second << std::endl;
70 trace.
info() <<
" shift: " << shift << std::endl;
72 if ( (steps.first - steps.second) == shift )
76 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
93template <
typename Coordinate,
typename Integer,
unsigned short adj>
96 unsigned int nbok = 0;
101 trace.
info() <<
" a " << a <<
" b " << b << std::endl;
106 trace.
info() <<
" step1: " << steps.first << std::endl;
107 trace.
info() <<
" step2: " << steps.second << std::endl;
113 trace.
info() <<
" shift: " << shift << std::endl;
115 if ( (a == 0) && (b == 0) )
117 if ( (steps.first ==
Vector(0,0))
118 && (steps.second ==
Vector(0,0))
119 && (shift ==
Vector(0,0)))
125 if ( (a == 0)||(b == 0) )
127 if ( (steps.first !=
Vector(0,0))
128 && (steps.second ==
Vector(0,0))
129 && (shift !=
Vector(0,0)))
136 &&( (a == b)||(a == -b) ) )
138 if ( (steps.first !=
Vector(0,0))
139 && (steps.second ==
Vector(0,0))
140 && (shift !=
Vector(0,0)) )
146 if ( (steps.first !=
Vector(0,0))
147 && (steps.second !=
Vector(0,0))
148 && (shift !=
Vector(0,0)) )
154 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
166int main(
int argc,
char** argv )
170 for (
int i = 0; i < argc; ++i )
176 bool res = test<DGtal::int32_t, DGtal::int32_t, 8>(8,5)
177 && test<DGtal::int32_t, DGtal::int32_t, 8>(5,8)
178 && test<DGtal::int32_t, DGtal::int32_t, 8>(-5,8)
179 && test<DGtal::int32_t, DGtal::int32_t, 8>(-8,5)
180 && test<DGtal::int32_t, DGtal::int32_t, 8>(-8,-5)
181 && test<DGtal::int32_t, DGtal::int32_t, 8>(-5,-8)
182 && test<DGtal::int32_t, DGtal::int32_t, 8>(5,-8)
183 && test<DGtal::int32_t, DGtal::int32_t, 8>(8,-5)
188 && test<DGtal::int32_t, DGtal::int32_t, 4>(8,5)
189 && test<DGtal::int32_t, DGtal::int32_t, 4>(5,8)
190 && test<DGtal::int32_t, DGtal::int32_t, 4>(-5,8)
191 && test<DGtal::int32_t, DGtal::int32_t, 4>(-8,5)
192 && test<DGtal::int32_t, DGtal::int32_t, 4>(-8,-5)
193 && test<DGtal::int32_t, DGtal::int32_t, 4>(-5,-8)
194 && test<DGtal::int32_t, DGtal::int32_t, 4>(5,-8)
195 && test<DGtal::int32_t, DGtal::int32_t, 4>(8,-5)
201 && specialCases<DGtal::int32_t, DGtal::int32_t, 8>(0,0)
202 && specialCases<DGtal::int32_t, DGtal::int32_t, 8>(0,5)
203 && specialCases<DGtal::int32_t, DGtal::int32_t, 8>(0,-5)
204 && specialCases<DGtal::int32_t, DGtal::int32_t, 8>(5,0)
205 && specialCases<DGtal::int32_t, DGtal::int32_t, 8>(-5,0)
206 && specialCases<DGtal::int32_t, DGtal::int32_t, 8>(1,1)
207 && specialCases<DGtal::int32_t, DGtal::int32_t, 8>(1,-1)
208 && specialCases<DGtal::int32_t, DGtal::int32_t, 8>(-1,1)
209 && specialCases<DGtal::int32_t, DGtal::int32_t, 8>(-1,-1)
214 && specialCases<DGtal::int32_t, DGtal::int32_t, 4>(0,0)
215 && specialCases<DGtal::int32_t, DGtal::int32_t, 4>(0,5)
216 && specialCases<DGtal::int32_t, DGtal::int32_t, 4>(0,-5)
217 && specialCases<DGtal::int32_t, DGtal::int32_t, 4>(5,0)
218 && specialCases<DGtal::int32_t, DGtal::int32_t, 4>(-5,0)
219 && specialCases<DGtal::int32_t, DGtal::int32_t, 4>(1,1)
220 && specialCases<DGtal::int32_t, DGtal::int32_t, 4>(1,-1)
221 && specialCases<DGtal::int32_t, DGtal::int32_t, 4>(-1,1)
222 && specialCases<DGtal::int32_t, DGtal::int32_t, 4>(-1,-1)
229#ifdef WITH_BIGINTEGER
231 && test<DGtal::BigInteger, DGtal::BigInteger, 8>(8,5)
232 && test<DGtal::BigInteger, DGtal::BigInteger, 4>(8,5)
236 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
void beginBlock(const std::string &keyword="")
Point::Coordinate Integer
DGtal is the top-level namespace which contains all DGtal functions and types.
static Vector shift(const TInteger &a, const TInteger &b)
std::pair< Vector, Vector > Steps
static Steps steps(const TInteger &a, const TInteger &b)
bool specialCases(const Integer &a, const Integer &b)
bool test(const Integer &a, const Integer &b)
FreemanChain< int >::Vector Vector