DGtal 1.3.0
Loading...
Searching...
No Matches
Functions
testRationalAngle.cpp File Reference
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/math/RationalAngle.h"

Go to the source code of this file.

Functions

bool testRationalAngle ()
 
int main (int argc, char **argv)
 

Detailed Description

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Author
Isabelle Sivignon (isabe.nosp@m.lle..nosp@m.sivig.nosp@m.non@.nosp@m.gipsa.nosp@m.-lab.nosp@m..gren.nosp@m.oble.nosp@m.-inp..nosp@m.fr ) gipsa-lab Grenoble Images Parole Signal Automatique (CNRS, UMR 5216), CNRS, France
Date
2012/12/20

Functions for testing class RationalAngle.

This file is part of the DGtal library.

Definition in file testRationalAngle.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 80 of file testRationalAngle.cpp.

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}
void beginBlock(const std::string &keyword="")
std::ostream & emphase()
std::ostream & info()
double endBlock()
Trace trace
Definition: Common.h:154
bool testRationalAngle()

References DGtal::Trace::beginBlock(), DGtal::Trace::emphase(), DGtal::Trace::endBlock(), DGtal::Trace::info(), testRationalAngle(), and DGtal::trace.

◆ testRationalAngle()

bool testRationalAngle ( )

Example of a test. To be completed.

Definition at line 46 of file testRationalAngle.cpp.

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}

References DGtal::Trace::beginBlock(), DGtal::Trace::endBlock(), DGtal::Trace::info(), and DGtal::trace.

Referenced by main().