DGtal 1.4.0
Loading...
Searching...
No Matches
testRationalAngle.cpp
Go to the documentation of this file.
1
31#include <iostream>
32#include "DGtal/base/Common.h"
33#include "DGtal/math/RationalAngle.h"
35
36using namespace std;
37using namespace DGtal;
38
40// Functions for testing class RationalAngle.
42
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;
73
74 return nbok == nb;
75}
76
78// Standard services - public :
79
80int 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;
91 return res ? 0 : 1;
92}
93// //
void beginBlock(const std::string &keyword="")
std::ostream & emphase()
std::ostream & info()
double endBlock()
DGtal is the top-level namespace which contains all DGtal functions and types.
Trace trace
Definition Common.h:153
STL namespace.
int main()
Definition testBits.cpp:56
bool testRationalAngle()