// Boost.Geometry (aka GGL, Generic Geometry Library) test file // // Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands // Copyright Bruno Lalande 2008, 2009 // 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 #include #include #include #include using namespace boost::geometry; template box

create_box() { P p1; P p2; assign(p1, 1, 2, 5); assign(p2, 3, 4, 6); return box

(p1, p2); } template void check_box(B& to_check, T min_x, T min_y, T min_z, T max_x, T max_y, T max_z) { BOOST_CHECK_EQUAL(get<0>(to_check.min_corner()), min_x); BOOST_CHECK_EQUAL(get<1>(to_check.min_corner()), min_y); BOOST_CHECK_EQUAL(get<2>(to_check.min_corner()), min_z); BOOST_CHECK_EQUAL(get<0>(to_check.max_corner()), max_x); BOOST_CHECK_EQUAL(get<1>(to_check.max_corner()), max_y); BOOST_CHECK_EQUAL(get<2>(to_check.max_corner()), max_z); } template void test_construction() { typedef typename coordinate_type

::type T; box

b1 = make_zero >(); check_box(b1, T(),T(),T(),T(),T(),T()); box

b2(create_box

()); check_box(b2, 1,2,5,3,4,6); box

b3 = make_inverse >(); check_box(b3, boost::numeric::bounds::highest(), boost::numeric::bounds::highest(), boost::numeric::bounds::highest(), boost::numeric::bounds::lowest(), boost::numeric::bounds::lowest(), boost::numeric::bounds::lowest()); } template void test_assignment() { box

b(create_box

()); set<0>(b.min_corner(), 10); set<1>(b.min_corner(), 20); set<2>(b.min_corner(), 30); set<0>(b.max_corner(), 40); set<1>(b.max_corner(), 50); set<2>(b.max_corner(), 60); check_box(b, 10,20,30,40,50,60); } template void test_all() { test_construction

(); test_assignment

(); } int test_main(int, char* []) { test_all(); test_all(); test_all(); test_all(); test_all >(); test_all >(); test_all >(); return 0; }