// Boost.Geometry Index // Unit Test // Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include #include #include template void test_rtree(unsigned vcount) { typedef bg::model::point point_t; bgi::rtree rt; BOOST_CHECK(rt.remove(point_t(0)) == 0); for ( unsigned i = 0 ; i < vcount ; ++i ) { rt.insert(point_t(static_cast(i))); } BOOST_CHECK(rt.size() == vcount); BOOST_CHECK(rt.count(point_t(vcount / 2)) == 1); for ( unsigned i = 0 ; i < vcount + 3 ; ++i ) { rt.remove(point_t((i + 3) % vcount)); } BOOST_CHECK(rt.size() == 0); BOOST_CHECK(rt.count(point_t(vcount / 2)) == 0); for ( unsigned i = 0 ; i < vcount ; ++i ) { rt.insert(point_t((i + 5) % vcount)); } BOOST_CHECK(rt.size() == vcount); BOOST_CHECK(rt.count(point_t(vcount / 2)) == 1); for ( unsigned i = 0 ; i < vcount + 3 ; ++i ) { rt.remove(point_t((i + 7) % vcount)); } BOOST_CHECK(rt.size() == 0); BOOST_CHECK(rt.count(point_t(vcount / 2)) == 0); } template void test_rtree_all() { int pow = Max; for (int l = 0 ; l < 3 ; ++l) { pow *= Max; int vcount = (pow * 8) / 10; //std::cout << Max << " " << Min << " " << vcount << std::endl; test_rtree< bgi::linear >(vcount); test_rtree< bgi::quadratic >(vcount); test_rtree< bgi::rstar >(vcount); } } int test_main(int, char* []) { test_rtree_all<2, 1>(); test_rtree_all<4, 1>(); test_rtree_all<4, 2>(); test_rtree_all<5, 3>(); return 0; }