DGtal  1.4.beta
testParameters.cpp File Reference
#include <iostream>
#include <string>
#include "DGtal/base/Common.h"
#include "DGtal/helpers/Parameters.h"
#include "DGtalCatch.h"
Include dependency graph for testParameters.cpp:

Go to the source code of this file.

Functions

 SCENARIO ("Parameters decimal conversion tests", "[parameters]")
 

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
Jacques-Olivier Lachaud (jacqu.nosp@m.es-o.nosp@m.livie.nosp@m.r.la.nosp@m.chaud.nosp@m.@uni.nosp@m.v-sav.nosp@m.oie..nosp@m.fr ) Laboratory of Mathematics (CNRS, UMR 5127), University of Savoie, France
Date
2019/05/14

Functions for testing class CubicalComplex.

This file is part of the DGtal library.

Definition in file testParameters.cpp.

Function Documentation

◆ SCENARIO()

SCENARIO ( "Parameters decimal conversion tests"  ,
""  [parameters] 
)

Definition at line 47 of file testParameters.cpp.

48 {
49  GIVEN( "A Parameters object" ) {
50  Parameters params;
51  WHEN( "initialized with strings" ) {
52  params( "foo", "bar" )( "Laurel", "Hardy" );
53  THEN( "it does store strings" ) {
54  REQUIRE( params[ "foo" ].as<string>() == "bar" );
55  REQUIRE( params[ "Laurel" ].as<string>() == "Hardy" );
56  }
57  }
58  WHEN( "initialized with integers" ) {
59  params( "prime", 7 )( "negative-int", -2 );
60  THEN( "it does store ints" ) {
61  REQUIRE( params[ "prime" ].as<int>() == 7 );
62  REQUIRE( params[ "negative-int" ].as<int>() == -2 );
63  }
64  }
65  WHEN( "initialized with doubles" ) {
66  params( "pi", 3.14159 )( "planck", 6.62607004e-34 )( "g", 9.80665 );
67  THEN( "it does store ints" ) {
68  REQUIRE( params[ "pi" ].as<double>() == Approx( 3.14159 ) );
69  REQUIRE( params[ "planck" ].as<double>() == Approx( 6.62607004e-34 ) );
70  REQUIRE( params[ "g" ].as<double>() == Approx( 9.80665 ) );
71  }
72  }
73  }
74 }
GIVEN("A cubical complex with random 3-cells")
REQUIRE(domain.isInside(aPoint))

References GIVEN(), and REQUIRE().