DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
testRationalAngle.cpp
Go to the documentation of this file.
1
16
29
31
#include <iostream>
32
#include "DGtal/base/Common.h"
33
#include "DGtal/math/RationalAngle.h"
35
36
using namespace
std
;
37
using namespace
DGtal
;
38
40
// Functions for testing class RationalAngle.
42
46
bool
testRationalAngle
()
47
{
48
typedef
RationalAngle<DGtal::int32_t > Angle;
49
50
Angle a1(8,-12);
51
Angle a2(4,6);
52
53
trace
.
info
() << (a1==a2) << std::endl;
54
55
trace
.
info
() << (a1<a2) << std::endl;
56
57
Angle a1rot,a2rot;
58
59
a1rot = a1.plusPI();
60
a2rot = a2.minusPI_2();
61
trace
.
info
() << a1rot.myP <<
" "
<< a1rot.myQ << std::endl;
62
trace
.
info
() << a2rot.myP <<
" "
<< a2rot.myQ << std::endl;
63
64
unsigned
int
nbok = 0;
65
unsigned
int
nb = 0;
66
67
trace
.
beginBlock
(
"Testing block ..."
);
68
nbok +=
true
? 1 : 0;
69
nb++;
70
trace
.
info
() <<
"("
<< nbok <<
"/"
<< nb <<
") "
71
<<
"true == true"
<< std::endl;
72
trace
.
endBlock
();
73
74
return
nbok == nb;
75
}
76
78
// Standard services - public :
79
80
int
main
(
int
argc,
char
** argv )
81
{
82
trace
.
beginBlock
(
"Testing class RationalAngle"
);
83
trace
.
info
() <<
"Args:"
;
84
for
(
int
i = 0; i < argc; ++i )
85
trace
.
info
() <<
" "
<< argv[ i ];
86
trace
.
info
() << endl;
87
88
bool
res =
testRationalAngle
();
// && ... other tests
89
trace
.
emphase
() << ( res ?
"Passed."
:
"Error."
) << endl;
90
trace
.
endBlock
();
91
return
res ? 0 : 1;
92
}
93
// //
DGtal::Trace::beginBlock
void beginBlock(const std::string &keyword="")
DGtal::Trace::emphase
std::ostream & emphase()
DGtal::Trace::info
std::ostream & info()
DGtal::Trace::endBlock
double endBlock()
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
DGtal::trace
Trace trace
std
STL namespace.
main
int main(int, char **)
Definition
testIntegerComputer.cpp:331
testRationalAngle
bool testRationalAngle()
Definition
testRationalAngle.cpp:46
tests
math
testRationalAngle.cpp
Generated on
for DGtal by
1.18.0