summaryrefslogtreecommitdiff
path: root/src/Cech_complex/test/test_cech_complex.cpp
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-05-29 19:49:30 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-05-29 19:49:30 +0000
commitcfe5c6b05435cb7d8cbd1d615e0c402f4a5e1674 (patch)
tree7e931f775abe016ec61cc9d2847328bbc51609ee /src/Cech_complex/test/test_cech_complex.cpp
parentaa12266a274c835adef5950a54ebdaa9fb68b89e (diff)
Clang format files
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/cechcomplex_vincent@3488 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 7d1da847f4c39a191afd5d8e56fe34ee79ade495
Diffstat (limited to 'src/Cech_complex/test/test_cech_complex.cpp')
-rw-r--r--src/Cech_complex/test/test_cech_complex.cpp63
1 files changed, 32 insertions, 31 deletions
diff --git a/src/Cech_complex/test/test_cech_complex.cpp b/src/Cech_complex/test/test_cech_complex.cpp
index 5b35735b..9039169c 100644
--- a/src/Cech_complex/test/test_cech_complex.cpp
+++ b/src/Cech_complex/test/test_cech_complex.cpp
@@ -28,7 +28,7 @@
#include <limits>
#include <string>
#include <vector>
-#include <algorithm> // std::max
+#include <algorithm> // std::max
#include <gudhi/Cech_complex.h>
// to construct Cech_complex from a OFF file of points
@@ -57,21 +57,21 @@ BOOST_AUTO_TEST_CASE(Cech_complex_for_documentation) {
//
// ----------------------------------------------------------------------------
Point_cloud points;
- points.push_back({1., 0.}); // 0
- points.push_back({0., 1.}); // 1
- points.push_back({2., 1.}); // 2
- points.push_back({3., 2.}); // 3
- points.push_back({0., 3.}); // 4
- points.push_back({3. + std::sqrt(3.), 3.}); // 5
- points.push_back({1., 4.}); // 6
- points.push_back({3., 4.}); // 7
- points.push_back({2., 4. + std::sqrt(3.)}); // 8
- points.push_back({0., 4.}); // 9
- points.push_back({-0.5, 2.}); // 10
+ points.push_back({1., 0.}); // 0
+ points.push_back({0., 1.}); // 1
+ points.push_back({2., 1.}); // 2
+ points.push_back({3., 2.}); // 3
+ points.push_back({0., 3.}); // 4
+ points.push_back({3. + std::sqrt(3.), 3.}); // 5
+ points.push_back({1., 4.}); // 6
+ points.push_back({3., 4.}); // 7
+ points.push_back({2., 4. + std::sqrt(3.)}); // 8
+ points.push_back({0., 4.}); // 9
+ points.push_back({-0.5, 2.}); // 10
Filtration_value max_radius = 1.0;
- std::cout << "========== NUMBER OF POINTS = " << points.size() << " - Cech max_radius = " <<
- max_radius << "==========" << std::endl;
+ std::cout << "========== NUMBER OF POINTS = " << points.size() << " - Cech max_radius = " << max_radius
+ << "==========" << std::endl;
Cech_complex cech_complex_for_doc(points, max_radius);
@@ -108,24 +108,25 @@ BOOST_AUTO_TEST_CASE(Cech_complex_for_documentation) {
std::cout << vertex << ",";
vp.push_back(points.at(vertex));
}
- std::cout << ") - distance =" << Gudhi::Minimal_enclosing_ball_radius()(vp.at(0), vp.at(1)) <<
- " - filtration =" << st.filtration(f_simplex) << std::endl;
+ std::cout << ") - distance =" << Gudhi::Minimal_enclosing_ball_radius()(vp.at(0), vp.at(1))
+ << " - filtration =" << st.filtration(f_simplex) << std::endl;
BOOST_CHECK(vp.size() == 2);
- GUDHI_TEST_FLOAT_EQUALITY_CHECK(st.filtration(f_simplex), Gudhi::Minimal_enclosing_ball_radius()(vp.at(0), vp.at(1)));
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(st.filtration(f_simplex),
+ Gudhi::Minimal_enclosing_ball_radius()(vp.at(0), vp.at(1)));
}
}
const int DIMENSION_2 = 2;
#ifdef GUDHI_DEBUG
- BOOST_CHECK_THROW (cech_complex_for_doc.create_complex(st, DIMENSION_2), std::invalid_argument);
+ BOOST_CHECK_THROW(cech_complex_for_doc.create_complex(st, DIMENSION_2), std::invalid_argument);
#endif
Simplex_tree st2;
cech_complex_for_doc.create_complex(st2, DIMENSION_2);
std::cout << "st2.dimension()=" << st2.dimension() << std::endl;
BOOST_CHECK(st2.dimension() == DIMENSION_2);
-
+
std::cout << "st2.num_vertices()=" << st2.num_vertices() << std::endl;
BOOST_CHECK(st2.num_vertices() == NUMBER_OF_VERTICES);
@@ -137,7 +138,7 @@ BOOST_AUTO_TEST_CASE(Cech_complex_for_documentation) {
points012.push_back(cech_complex_for_doc.get_point(vertex));
}
std::size_t dimension = points[0].end() - points[0].begin();
- Min_sphere ms012(dimension, points012.begin(),points012.end());
+ Min_sphere ms012(dimension, points012.begin(), points012.end());
Simplex_tree::Filtration_value f012 = st2.filtration(st2.find({0, 1, 2}));
std::cout << "f012= " << f012 << " | ms012_radius= " << std::sqrt(ms012.squared_radius()) << std::endl;
@@ -148,7 +149,7 @@ BOOST_AUTO_TEST_CASE(Cech_complex_for_documentation) {
points1410.push_back(cech_complex_for_doc.get_point(1));
points1410.push_back(cech_complex_for_doc.get_point(4));
points1410.push_back(cech_complex_for_doc.get_point(10));
- Min_sphere ms1410(dimension, points1410.begin(),points1410.end());
+ Min_sphere ms1410(dimension, points1410.begin(), points1410.end());
Simplex_tree::Filtration_value f1410 = st2.filtration(st2.find({1, 4, 10}));
std::cout << "f1410= " << f1410 << " | ms1410_radius= " << std::sqrt(ms1410.squared_radius()) << std::endl;
@@ -159,7 +160,7 @@ BOOST_AUTO_TEST_CASE(Cech_complex_for_documentation) {
points469.push_back(cech_complex_for_doc.get_point(4));
points469.push_back(cech_complex_for_doc.get_point(6));
points469.push_back(cech_complex_for_doc.get_point(9));
- Min_sphere ms469(dimension, points469.begin(),points469.end());
+ Min_sphere ms469(dimension, points469.begin(), points469.end());
Simplex_tree::Filtration_value f469 = st2.filtration(st2.find({4, 6, 9}));
std::cout << "f469= " << f469 << " | ms469_radius= " << std::sqrt(ms469.squared_radius()) << std::endl;
@@ -168,7 +169,6 @@ BOOST_AUTO_TEST_CASE(Cech_complex_for_documentation) {
BOOST_CHECK((st2.find({6, 7, 8}) == st2.null_simplex()));
BOOST_CHECK((st2.find({3, 5, 7}) == st2.null_simplex()));
-
}
BOOST_AUTO_TEST_CASE(Cech_complex_from_points) {
@@ -176,13 +176,13 @@ BOOST_AUTO_TEST_CASE(Cech_complex_from_points) {
// Init of a list of points
// ----------------------------------------------------------------------------
Point_cloud points;
- std::vector<double> coords = { 0.0, 0.0, 0.0, 1.0 };
+ std::vector<double> coords = {0.0, 0.0, 0.0, 1.0};
points.push_back(Point(coords.begin(), coords.end()));
- coords = { 0.0, 0.0, 1.0, 0.0 };
+ coords = {0.0, 0.0, 1.0, 0.0};
points.push_back(Point(coords.begin(), coords.end()));
- coords = { 0.0, 1.0, 0.0, 0.0 };
+ coords = {0.0, 1.0, 0.0, 0.0};
points.push_back(Point(coords.begin(), coords.end()));
- coords = { 1.0, 0.0, 0.0, 0.0 };
+ coords = {1.0, 0.0, 0.0, 0.0};
points.push_back(Point(coords.begin(), coords.end()));
// ----------------------------------------------------------------------------
@@ -204,7 +204,8 @@ BOOST_AUTO_TEST_CASE(Cech_complex_from_points) {
for (auto vertex : st.simplex_vertex_range(f_simplex)) {
std::cout << vertex << " ";
}
- std::cout << ") -> " << "[" << st.filtration(f_simplex) << "] ";
+ std::cout << ") -> "
+ << "[" << st.filtration(f_simplex) << "] ";
std::cout << std::endl;
}
BOOST_CHECK(num_simplices == 15);
@@ -247,8 +248,8 @@ BOOST_AUTO_TEST_CASE(Cech_create_complex_throw) {
// ----------------------------------------------------------------------------
std::string off_file_name("alphacomplexdoc.off");
double max_radius = 12.0;
- std::cout << "========== OFF FILE NAME = " << off_file_name << " - Cech max_radius=" <<
- max_radius << "==========" << std::endl;
+ std::cout << "========== OFF FILE NAME = " << off_file_name << " - Cech max_radius=" << max_radius
+ << "==========" << std::endl;
Gudhi::Points_off_reader<Point> off_reader(off_file_name);
Cech_complex cech_complex_from_file(off_reader.get_point_cloud(), max_radius);
@@ -258,6 +259,6 @@ BOOST_AUTO_TEST_CASE(Cech_create_complex_throw) {
stree.insert_simplex_and_subfaces(simplex);
std::cout << "Check exception throw in debug mode" << std::endl;
// throw excpt because stree is not empty
- BOOST_CHECK_THROW (cech_complex_from_file.create_complex(stree, 1), std::invalid_argument);
+ BOOST_CHECK_THROW(cech_complex_from_file.create_complex(stree, 1), std::invalid_argument);
}
#endif