DGtal 1.3.0
Loading...
Searching...
No Matches
testParameters.cpp
Go to the documentation of this file.
1
31#include <iostream>
32#include <string>
33#include "DGtal/base/Common.h"
34#include "DGtal/helpers/Parameters.h"
35
36#include "DGtalCatch.h"
38
39using namespace std;
40using namespace DGtal;
41
42
44// Functions for testing class Parameters
46
47SCENARIO( "Parameters decimal conversion tests", "[parameters]" )
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}
DGtal is the top-level namespace which contains all DGtal functions and types.
STL namespace.
GIVEN("A cubical complex with random 3-cells")
REQUIRE(domain.isInside(aPoint))
SCENARIO("UnorderedSetByBlock< PointVector< 2, int > unit tests with 32 bits blocks", "[unorderedsetbyblock][2d]")