// Boost.Geometry (aka GGL, Generic Geometry Library) test file // // Copyright (c) 2009 Mateusz Loskot, (mateusz@loskot.net) // 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 void test_2d() { P p1; boost::geometry::assign(p1, 20, 30); P p2; boost::geometry::assign(p2, 45, 70); P c = boost::geometry::cross_product(p1, p2); typedef typename boost::geometry::coordinate_type

::type scalar_type; BOOST_CHECK_EQUAL(boost::geometry::get<0>(c), scalar_type(50)); } template void test_3d() { P p1; boost::geometry::assign(p1, 20, 30, 10); P p2; boost::geometry::assign(p2, 45, 70, 20); P c = boost::geometry::cross_product(p1, p2); typedef typename boost::geometry::coordinate_type

::type scalar_type; BOOST_CHECK_EQUAL(boost::geometry::get<0>(c), scalar_type(-100)); BOOST_CHECK_EQUAL(boost::geometry::get<1>(c), scalar_type(50)); BOOST_CHECK_EQUAL(boost::geometry::get<2>(c), scalar_type(50)); } #ifdef TEST_FAIL_CROSS_PRODUCT template void test_4d() { P p1; boost::geometry::assign(p1, 20, 30, 10, 15); P p2; boost::geometry::assign(p2, 45, 70, 20, 35); P c = boost::geometry::cross_product(p1, p2); } #endif int test_main(int, char* []) { test_2d >(); test_2d >(); test_2d >(); test_3d >(); test_3d >(); test_3d >(); #ifdef TEST_FAIL_CROSS_PRODUCT test_4d >(); test_4d >(); test_4d >(); #endif return 0; }