|
9 | 9 |
|
10 | 10 | #include <catch.hpp> |
11 | 11 |
|
| 12 | +#include "geom-boost-adaptor.hpp" |
12 | 13 | #include "geom-box.hpp" |
13 | 14 |
|
| 15 | +TEST_CASE("box_t getter/setter", "[NoDB]") |
| 16 | +{ |
| 17 | + geom::box_t box{1.0, 2.0, 3.0, 4.0}; |
| 18 | + |
| 19 | + REQUIRE(box.min_x() == Approx(1.0)); |
| 20 | + REQUIRE(box.max_x() == Approx(3.0)); |
| 21 | + REQUIRE(box.min_y() == Approx(2.0)); |
| 22 | + REQUIRE(box.max_y() == Approx(4.0)); |
| 23 | + |
| 24 | + box.set_min_x(1.5); |
| 25 | + box.set_min_y(2.5); |
| 26 | + box.set_max_x(3.5); |
| 27 | + box.set_max_y(4.5); |
| 28 | + |
| 29 | + REQUIRE(box.min_x() == Approx(1.5)); |
| 30 | + REQUIRE(box.max_x() == Approx(3.5)); |
| 31 | + REQUIRE(box.min_y() == Approx(2.5)); |
| 32 | + REQUIRE(box.max_y() == Approx(4.5)); |
| 33 | +} |
| 34 | + |
| 35 | +TEST_CASE("box_t getter/setter through boost", "[NoDB]") |
| 36 | +{ |
| 37 | + geom::box_t box{1.0, 2.0, 3.0, 4.0}; |
| 38 | + |
| 39 | + namespace bg = ::boost::geometry; |
| 40 | + REQUIRE(bg::get<bg::min_corner, 0>(box) == Approx(1.0)); |
| 41 | + REQUIRE(bg::get<bg::min_corner, 1>(box) == Approx(2.0)); |
| 42 | + REQUIRE(bg::get<bg::max_corner, 0>(box) == Approx(3.0)); |
| 43 | + REQUIRE(bg::get<bg::max_corner, 1>(box) == Approx(4.0)); |
| 44 | + |
| 45 | + bg::set<bg::min_corner, 0>(box, 1.5); |
| 46 | + bg::set<bg::min_corner, 1>(box, 2.5); |
| 47 | + bg::set<bg::max_corner, 0>(box, 3.5); |
| 48 | + bg::set<bg::max_corner, 1>(box, 4.5); |
| 49 | + |
| 50 | + REQUIRE(box.min_x() == Approx(1.5)); |
| 51 | + REQUIRE(box.min_y() == Approx(2.5)); |
| 52 | + REQUIRE(box.max_x() == Approx(3.5)); |
| 53 | + REQUIRE(box.max_y() == Approx(4.5)); |
| 54 | +} |
| 55 | + |
14 | 56 | TEST_CASE("Extend box_t with points", "[NoDB]") |
15 | 57 | { |
16 | 58 | geom::box_t box; |
|
0 commit comments