]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/polygon/test/polygon_rectangle_formation_test.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / polygon / test / polygon_rectangle_formation_test.cpp
1 // Boost.Polygon library polygon_rectangle_formation_test.cpp file
2
3 // Copyright Andrii Sydorchuk 2015.
4 // Distributed under the Boost Software License, Version 1.0.
5 // (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
7
8 // See http://www.boost.org for updates, documentation, and revision history.
9
10 #include <boost/core/lightweight_test.hpp>
11 #include <boost/polygon/polygon.hpp>
12
13 using namespace boost::polygon;
14
15 void rectangle_formation_test1()
16 {
17 typedef polygon_90_with_holes_data<int> polygon_type;
18 typedef polygon_traits<polygon_type>::point_type point_type;
19
20 polygon_type poly;
21 point_type points[] = {
22 boost::polygon::construct<point_type>(0, 0),
23 boost::polygon::construct<point_type>(0, 10),
24 boost::polygon::construct<point_type>(10, 10),
25 boost::polygon::construct<point_type>(10, 0),
26 };
27 boost::polygon::set_points(poly, points, points + 4);
28
29 std::vector< rectangle_data<int> > rects;
30 boost::polygon::get_rectangles(rects, poly);
31
32 BOOST_TEST_EQ(1, rects.size());
33 const rectangle_data<int>& rect = rects[0];
34 BOOST_TEST_EQ(0, rect.get(WEST));
35 BOOST_TEST_EQ(10, rect.get(EAST));
36 BOOST_TEST_EQ(10, rect.get(NORTH));
37 BOOST_TEST_EQ(0, rect.get(SOUTH));
38 }
39
40 int main()
41 {
42 rectangle_formation_test1();
43 return boost::report_errors();
44 }