From cf6cfa2bc7f03c2f324c09147abf3611d2acefe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 1 Nov 2016 17:19:19 +0100 Subject: [PATCH] Added additional tests for CGAL::Unique_hash_map and for the overload of boost::associative_property_map with Unique_hash_map. --- .../test/Hash_map/Unique_hash_map_test.cpp | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Hash_map/test/Hash_map/Unique_hash_map_test.cpp b/Hash_map/test/Hash_map/Unique_hash_map_test.cpp index 57690dd377f..4980a550334 100644 --- a/Hash_map/test/Hash_map/Unique_hash_map_test.cpp +++ b/Hash_map/test/Hash_map/Unique_hash_map_test.cpp @@ -6,6 +6,11 @@ using namespace std; typedef list::iterator Iterator; +struct Integer_hash_function +{ + int operator()(int i) const { return i; } +}; + int main() { CGAL_TEST_START; list L; @@ -50,6 +55,26 @@ int main() { CGAL_TEST( H4[k] == *k); } hash = H4.hash_function(); + + // test the overload of boost::associative_property_map for CGAL::Unique_hash_map + typedef CGAL::Unique_hash_map Iterator_hmap; + typedef boost::associative_property_map Iterator_pmap; + Iterator_pmap H4_pmap = boost::make_assoc_property_map(H4); + for(Iterator k=L.begin(); k!=L.end(); ++k){ + CGAL_TEST(get(H4_pmap, k) == *k); + } + L.push_front(0); + put(H4_pmap, L.begin(), 0); + CGAL_TEST(get(H4_pmap, L.begin()) == 0); + + typedef CGAL::Unique_hash_map Int_hmap; + typedef boost::associative_property_map Int_pmap; + Int_hmap H5(-1); + Int_pmap H5_pmap(H5); + put(H5_pmap, -1, 1); + CGAL_TEST(get(H5_pmap, -1) == 1); + CGAL_TEST(H5_pmap[0] == -1); + std::cerr << "done" << std::endl; CGAL_TEST_END; }