summaryrefslogtreecommitdiff
path: root/src/Alpha_complex/test
diff options
context:
space:
mode:
authorROUVREAU Vincent <vincent.rouvreau@inria.fr>2021-06-22 17:34:27 +0200
committerROUVREAU Vincent <vincent.rouvreau@inria.fr>2021-06-22 17:34:27 +0200
commit6d7c79a352023dd380b7361057cb7db371c5d269 (patch)
tree7a5c5b53c651cf51b98c2481bec70b06d5d66ab2 /src/Alpha_complex/test
parent7cce5bc6778053ba6c2c3cce2bd9442c4e063e0d (diff)
Fix #448. Add Alpha complex 3d python module unitary tests accordingly.
Diffstat (limited to 'src/Alpha_complex/test')
-rw-r--r--src/Alpha_complex/test/Alpha_complex_3d_unit_test.cpp30
-rw-r--r--src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp2
2 files changed, 31 insertions, 1 deletions
diff --git a/src/Alpha_complex/test/Alpha_complex_3d_unit_test.cpp b/src/Alpha_complex/test/Alpha_complex_3d_unit_test.cpp
index a4ecb6ad..94021954 100644
--- a/src/Alpha_complex/test/Alpha_complex_3d_unit_test.cpp
+++ b/src/Alpha_complex/test/Alpha_complex_3d_unit_test.cpp
@@ -11,6 +11,7 @@
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE "alpha_complex_3d"
#include <boost/test/unit_test.hpp>
+#include <boost/mpl/list.hpp>
#include <cmath> // float comparison
#include <limits>
@@ -36,6 +37,7 @@ using Safe_alpha_complex_3d =
using Exact_alpha_complex_3d =
Gudhi::alpha_complex::Alpha_complex_3d<Gudhi::alpha_complex::complexity::EXACT, false, false>;
+
template <typename Point>
std::vector<Point> get_points() {
std::vector<Point> points;
@@ -197,3 +199,31 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_3d_from_points) {
++safe_sh;
}
}
+
+typedef boost::mpl::list<Fast_alpha_complex_3d, Safe_alpha_complex_3d, Exact_alpha_complex_3d> list_of_alpha_variants;
+
+BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_complex_3d_exceptions_points_on_plane, Alpha, list_of_alpha_variants) {
+ std::vector<typename Alpha::Bare_point_3> points_on_plane;
+ points_on_plane.emplace_back(1.0, 1.0 , 0.0);
+ points_on_plane.emplace_back(7.0, 0.0 , 0.0);
+ points_on_plane.emplace_back(4.0, 6.0 , 0.0);
+ points_on_plane.emplace_back(9.0, 6.0 , 0.0);
+ points_on_plane.emplace_back(0.0, 14.0, 0.0);
+ points_on_plane.emplace_back(2.0, 19.0, 0.0);
+ points_on_plane.emplace_back(9.0, 17.0, 0.0);
+
+ Alpha alpha_complex(points_on_plane);
+ Gudhi::Simplex_tree<> stree;
+
+ BOOST_CHECK_THROW(alpha_complex.create_complex(stree), std::domain_error);
+}
+
+BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_complex_3d_exceptions_non_empty_simplex_tree, Alpha, list_of_alpha_variants) {
+ Alpha alpha_complex(get_points<typename Alpha::Bare_point_3>());
+ Gudhi::Simplex_tree<> stree;
+ stree.insert_simplex_and_subfaces({2,1,0}, 3.0);
+
+#ifdef GUDHI_DEBUG
+ BOOST_CHECK_THROW(alpha_complex.create_complex(stree), std::invalid_argument);
+#endif // GUDHI_DEBUG
+} \ No newline at end of file
diff --git a/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp b/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp
index 875704ee..4e1a38df 100644
--- a/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp
+++ b/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp
@@ -83,7 +83,7 @@ BOOST_AUTO_TEST_CASE(Weighted_alpha_complex_3d_comparison) {
// Weighted alpha complex for 3D version
Exact_weighted_alpha_complex_3d alpha_complex_3D_from_weighted_points(w_points_3);
Gudhi::Simplex_tree<> w_simplex_3;
- BOOST_CHECK(alpha_complex_3D_from_weighted_points.create_complex(w_simplex_3));
+ alpha_complex_3D_from_weighted_points.create_complex(w_simplex_3);
std::clog << "Iterator on weighted alpha complex 3D simplices in the filtration order, with [filtration value]:"
<< std::endl;