1 | /* |
2 | * Sphere_unit_test.cpp |
3 | * |
4 | * Created on: Feb 26, 2020 |
5 | * Author: i-bird |
6 | */ |
7 | |
8 | |
9 | #define BOOST_TEST_DYN_LINK |
10 | #include <boost/test/unit_test.hpp> |
11 | #include "Grid/map_grid.hpp" |
12 | #include "data_type/aggregate.hpp" |
13 | #include "Vector/map_vector.hpp" |
14 | |
15 | BOOST_AUTO_TEST_SUITE( sphere_test ) |
16 | |
17 | |
18 | BOOST_AUTO_TEST_CASE( Sphere_test_use) |
19 | { |
20 | Point<3,double> p({0.1,0.1,0.1}); |
21 | Point<3,double> p1({0.12,0.12,0.12}); |
22 | Point<3,double> p3({0.25,0.25,0.25}); |
23 | |
24 | Sphere<3,double> s(p,0.1); |
25 | |
26 | BOOST_REQUIRE_EQUAL(s.isInside(p1),true); |
27 | BOOST_REQUIRE_EQUAL(s.isInside(p3),false); |
28 | |
29 | double dist = s.distance(p3); |
30 | BOOST_REQUIRE_EQUAL(dist,0.15980762113533162); |
31 | } |
32 | |
33 | BOOST_AUTO_TEST_SUITE_END() |
34 | |