DGtal  1.5.beta
testPointHashFunctions.cpp File Reference
#include <iostream>
#include "DGtal/base/Common.h"
#include "ConfigTest.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtalCatch.h"
#include "DGtal/kernel/PointVector.h"
#include "DGtal/kernel/PointHashFunctions.h"
Include dependency graph for testPointHashFunctions.cpp:

Go to the source code of this file.

Functions

 TEST_CASE ("Hash functions on DGtal::Point")
 

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
David Coeurjolly (david.nosp@m..coe.nosp@m.urjol.nosp@m.ly@l.nosp@m.iris..nosp@m.cnrs.nosp@m..fr ) Laboratoire d'InfoRmatique en Image et Systemes d'information - LIRIS (CNRS, UMR 5205), CNRS, France
Date
2015/06/14

Functions for testing class PointHashFunctions.

This file is part of the DGtal library.

Definition in file testPointHashFunctions.cpp.

Function Documentation

◆ TEST_CASE()

TEST_CASE ( "Hash functions on DGtal::Point )

Definition at line 48 of file testPointHashFunctions.cpp.

49 {
50  Z3i::Point p(0,0,0);
51  Z3i::Point q(10,0,0);
52  Z3i::Point p_copy(0,0,0);
53  std::hash<Z3i::Point> myhashcpp11;
54 
55  SECTION("Identity test")
56  {
57  REQUIRE( myhashcpp11(p) == myhashcpp11(p_copy) );
58  }
59 
60 
61  SECTION("Difference test")
62  {
63  REQUIRE( myhashcpp11(p) != myhashcpp11(q) );
64  }
65 
66  SECTION("Higher dimension identity test")
67  {
68  typedef PointVector<26,int> Point26;
69  Point26 pp=Point26::diagonal(12),
70  qq=(Point26::diagonal(11) + Point26::diagonal(1)),
71  rr=Point26::diagonal(13);
72 
73  std::hash<Point26> myhash26cpp11;
74 
75  REQUIRE( myhash26cpp11(pp) == myhash26cpp11(qq) );
76  REQUIRE( myhash26cpp11(pp) != myhash26cpp11(rr) );
77  }
78 }
SECTION("Testing constant forward iterators")
REQUIRE(domain.isInside(aPoint))

References REQUIRE(), and SECTION().