summaryrefslogtreecommitdiff
path: root/src/Persistence_representations/test
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-01-08 14:04:26 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-01-08 14:04:26 +0000
commit97a6bdd67d8cff9bc8c0126df86be044d393583c (patch)
tree499987f6d0484e2ecccebc846ae288938c1da704 /src/Persistence_representations/test
parent8ce961c5d86845613a196e2a5b1e3ea724698d88 (diff)
clang-format files
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@3118 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: c8371fc65da4f9912b602a4f3a6701661e46580e
Diffstat (limited to 'src/Persistence_representations/test')
-rw-r--r--src/Persistence_representations/test/persistence_heat_maps_test.cpp14
-rw-r--r--src/Persistence_representations/test/persistence_intervals_test.cpp6
-rw-r--r--src/Persistence_representations/test/persistence_lanscapes_on_grid_test.cpp10
-rw-r--r--src/Persistence_representations/test/persistence_lanscapes_test.cpp60
-rw-r--r--src/Persistence_representations/test/read_persistence_from_file_test.cpp10
-rw-r--r--src/Persistence_representations/test/vector_representation_test.cpp6
6 files changed, 35 insertions, 71 deletions
diff --git a/src/Persistence_representations/test/persistence_heat_maps_test.cpp b/src/Persistence_representations/test/persistence_heat_maps_test.cpp
index 4da13b86..e36108b7 100644
--- a/src/Persistence_representations/test/persistence_heat_maps_test.cpp
+++ b/src/Persistence_representations/test/persistence_heat_maps_test.cpp
@@ -142,15 +142,15 @@ BOOST_AUTO_TEST_CASE(check_distance_for_heat_maps) {
Persistence_heat_maps<constant_scaling_function> q("data/file_with_diagram_1", filter, false, 1000, 0, 1);
Persistence_heat_maps<constant_scaling_function> r("data/file_with_diagram_2", filter, false, 1000, 0, 1);
- GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.distance(p), 0., epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.distance(p), 0., epsilon);
GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.distance(q), 624.183, epsilon);
GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.distance(r), 415.815, epsilon);
GUDHI_TEST_FLOAT_EQUALITY_CHECK(q.distance(p), 624.183, epsilon);
- GUDHI_TEST_FLOAT_EQUALITY_CHECK(q.distance(q), 0., epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(q.distance(q), 0., epsilon);
GUDHI_TEST_FLOAT_EQUALITY_CHECK(q.distance(r), 528.066, epsilon);
GUDHI_TEST_FLOAT_EQUALITY_CHECK(r.distance(p), 415.815, epsilon);
GUDHI_TEST_FLOAT_EQUALITY_CHECK(r.distance(q), 528.066, epsilon);
- GUDHI_TEST_FLOAT_EQUALITY_CHECK(r.distance(r), 0., epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(r.distance(r), 0., epsilon);
}
BOOST_AUTO_TEST_CASE(check_projections_to_R_for_heat_maps) {
@@ -174,11 +174,11 @@ BOOST_AUTO_TEST_CASE(check_scalar_products_for_heat_maps) {
GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_scalar_product(q), 0.0509357, epsilon);
GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_scalar_product(r), 0.0375608, epsilon);
GUDHI_TEST_FLOAT_EQUALITY_CHECK(q.compute_scalar_product(p), 0.0509357, epsilon);
- GUDHI_TEST_FLOAT_EQUALITY_CHECK(q.compute_scalar_product(q), 1.31293 , epsilon);
- GUDHI_TEST_FLOAT_EQUALITY_CHECK(q.compute_scalar_product(r), 0.536799 , epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(q.compute_scalar_product(q), 1.31293, epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(q.compute_scalar_product(r), 0.536799, epsilon);
GUDHI_TEST_FLOAT_EQUALITY_CHECK(r.compute_scalar_product(p), 0.0375608, epsilon);
- GUDHI_TEST_FLOAT_EQUALITY_CHECK(r.compute_scalar_product(q), 0.536799 , epsilon);
- GUDHI_TEST_FLOAT_EQUALITY_CHECK(r.compute_scalar_product(r), 0.672907 , epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(r.compute_scalar_product(q), 0.536799, epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(r.compute_scalar_product(r), 0.672907, epsilon);
}
BOOST_AUTO_TEST_CASE(check_arythmetic_operations_for_heat_maps) {
diff --git a/src/Persistence_representations/test/persistence_intervals_test.cpp b/src/Persistence_representations/test/persistence_intervals_test.cpp
index c8f67966..f555e243 100644
--- a/src/Persistence_representations/test/persistence_intervals_test.cpp
+++ b/src/Persistence_representations/test/persistence_intervals_test.cpp
@@ -266,8 +266,7 @@ BOOST_AUTO_TEST_CASE(check_compute_persistent_betti_numbers) {
std::vector<std::pair<double, size_t> > pbns_new = p.compute_persistent_betti_numbers();
for (size_t i = 0; i != pbns.size(); ++i) {
- GUDHI_TEST_FLOAT_EQUALITY_CHECK(pbns[i].first, pbns_new[i].first,
- Gudhi::Persistence_representations::epsi);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(pbns[i].first, pbns_new[i].first, Gudhi::Persistence_representations::epsi);
BOOST_CHECK(pbns[i].second == pbns_new[i].second);
}
}
@@ -288,7 +287,6 @@ BOOST_AUTO_TEST_CASE(check_k_n_n) {
knn_template.push_back(0.786945);
for (size_t i = 0; i != knn.size(); ++i) {
- GUDHI_TEST_FLOAT_EQUALITY_CHECK(knn[i], knn_template[i],
- Gudhi::Persistence_representations::epsi);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(knn[i], knn_template[i], Gudhi::Persistence_representations::epsi);
}
}
diff --git a/src/Persistence_representations/test/persistence_lanscapes_on_grid_test.cpp b/src/Persistence_representations/test/persistence_lanscapes_on_grid_test.cpp
index 8e2808d0..130ac8cc 100644
--- a/src/Persistence_representations/test/persistence_lanscapes_on_grid_test.cpp
+++ b/src/Persistence_representations/test/persistence_lanscapes_on_grid_test.cpp
@@ -179,8 +179,8 @@ BOOST_AUTO_TEST_CASE(check_computations_of_maxima_and_norms) {
Persistence_landscape_on_grid sum = p + second;
GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_maximum(), 0.46, epsilon);
- GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_norm_of_landscape(1), 27.3373 , epsilon);
- GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_norm_of_landscape(2), 1.84143 , epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_norm_of_landscape(1), 27.3373, epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_norm_of_landscape(2), 1.84143, epsilon);
GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_norm_of_landscape(3), 0.927067, epsilon);
GUDHI_TEST_FLOAT_EQUALITY_CHECK(compute_distance_of_landscapes_on_grid(p, sum, 1), 16.8519, epsilon);
GUDHI_TEST_FLOAT_EQUALITY_CHECK(compute_distance_of_landscapes_on_grid(p, sum, 2), 1.44542, epsilon);
@@ -189,12 +189,10 @@ BOOST_AUTO_TEST_CASE(check_computations_of_maxima_and_norms) {
}
BOOST_AUTO_TEST_CASE(check_default_parameters_of_distances) {
- std::vector<std::pair<double, double> > diag =
- read_persistence_intervals_in_dimension("data/file_with_diagram");
+ std::vector<std::pair<double, double> > diag = read_persistence_intervals_in_dimension("data/file_with_diagram");
Persistence_landscape_on_grid p(diag, 0., 1., 100);
- std::vector<std::pair<double, double> > diag1 =
- read_persistence_intervals_in_dimension("data/file_with_diagram_1");
+ std::vector<std::pair<double, double> > diag1 = read_persistence_intervals_in_dimension("data/file_with_diagram_1");
Persistence_landscape_on_grid q(diag1, 0., 1., 100);
double dist_numeric_limit_max = p.distance(q, std::numeric_limits<double>::max());
diff --git a/src/Persistence_representations/test/persistence_lanscapes_test.cpp b/src/Persistence_representations/test/persistence_lanscapes_test.cpp
index e7267bec..e98ef894 100644
--- a/src/Persistence_representations/test/persistence_lanscapes_test.cpp
+++ b/src/Persistence_representations/test/persistence_lanscapes_test.cpp
@@ -35,12 +35,12 @@ using namespace Gudhi::Persistence_representations;
double epsilon = 0.0005;
-BOOST_AUTO_TEST_CASE(check_construction_of_landscape) {
+BOOST_AUTO_TEST_CASE(check_construction_of_landscape) {
std::vector<std::pair<double, double> > diag =
- read_persistence_intervals_in_one_dimension_from_file("data/file_with_diagram");
+ read_persistence_intervals_in_one_dimension_from_file("data/file_with_diagram");
Persistence_landscape p(diag);
- Persistence_landscape q;
- q.load_landscape_from_file("data/file_with_landscape_from_file_with_diagram");
+ Persistence_landscape q;
+ q.load_landscape_from_file("data/file_with_landscape_from_file_with_diagram");
BOOST_CHECK(p == q);
}
@@ -48,12 +48,10 @@ BOOST_AUTO_TEST_CASE(check_construction_of_landscape_form_gudhi_style_file) {
Persistence_landscape p("data/persistence_file_with_four_entries_per_line", 1);
// p.print_to_file("persistence_file_with_four_entries_per_line_landscape");
Persistence_landscape q;
- q.load_landscape_from_file("data/persistence_file_with_four_entries_per_line_landscape");
+ q.load_landscape_from_file("data/persistence_file_with_four_entries_per_line_landscape");
BOOST_CHECK(p == q);
}
-
-
BOOST_AUTO_TEST_CASE(check_computations_of_integrals) {
std::vector<std::pair<double, double> > diag =
read_persistence_intervals_in_one_dimension_from_file("data/file_with_diagram");
@@ -123,18 +121,18 @@ BOOST_AUTO_TEST_CASE(check_computations_of_values_on_different_points) {
read_persistence_intervals_in_one_dimension_from_file("data/file_with_diagram");
Persistence_landscape p(diag);
- GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_value_at_a_given_point(1, 0.0), 0. , epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_value_at_a_given_point(1, 0.0), 0., epsilon);
GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_value_at_a_given_point(1, 0.1), 0.0692324, epsilon);
- GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_value_at_a_given_point(1, 0.2), 0.163369 , epsilon);
- GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_value_at_a_given_point(1, 0.3), 0.217115 , epsilon);
- GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_value_at_a_given_point(2, 0.0), 0. , epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_value_at_a_given_point(1, 0.2), 0.163369, epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_value_at_a_given_point(1, 0.3), 0.217115, epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_value_at_a_given_point(2, 0.0), 0., epsilon);
GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_value_at_a_given_point(2, 0.1), 0.0633688, epsilon);
- GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_value_at_a_given_point(2, 0.2), 0.122361 , epsilon);
- GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_value_at_a_given_point(2, 0.3), 0.195401 , epsilon);
- GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_value_at_a_given_point(3, 0.0), 0. , epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_value_at_a_given_point(2, 0.2), 0.122361, epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_value_at_a_given_point(2, 0.3), 0.195401, epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_value_at_a_given_point(3, 0.0), 0., epsilon);
GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_value_at_a_given_point(3, 0.1), 0.0455386, epsilon);
GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_value_at_a_given_point(3, 0.2), 0.0954012, epsilon);
- GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_value_at_a_given_point(3, 0.3), 0.185282 , epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_value_at_a_given_point(3, 0.3), 0.185282, epsilon);
}
BOOST_AUTO_TEST_CASE(check_computations_sum_differences_and_multiplications) {
@@ -170,14 +168,14 @@ BOOST_AUTO_TEST_CASE(check_computations_of_maxima_and_norms) {
second.load_landscape_from_file("data/file_with_landscape_from_file_with_diagram_1");
Persistence_landscape sum = p + second;
- GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_maximum() , 0.431313, epsilon);
- GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_norm_of_landscape(1), 2.34992 , epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_maximum(), 0.431313, epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_norm_of_landscape(1), 2.34992, epsilon);
GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_norm_of_landscape(2), 0.706095, epsilon);
GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_norm_of_landscape(3), 0.501867, epsilon);
GUDHI_TEST_FLOAT_EQUALITY_CHECK(compute_distance_of_landscapes(p, sum, 1), 27.9323, epsilon);
GUDHI_TEST_FLOAT_EQUALITY_CHECK(compute_distance_of_landscapes(p, sum, 2), 2.35199, epsilon);
- GUDHI_TEST_FLOAT_EQUALITY_CHECK(compute_distance_of_landscapes(p, sum, std::numeric_limits<double>::max()),
- 0.464478, epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(compute_distance_of_landscapes(p, sum, std::numeric_limits<double>::max()), 0.464478,
+ epsilon);
}
BOOST_AUTO_TEST_CASE(check_default_parameters_of_distances) {
@@ -232,30 +230,6 @@ BOOST_AUTO_TEST_CASE(check_computations_of_scalar_product) {
GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_scalar_product(q), 0.754498, epsilon);
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
// Below I am storing the code used to generate tests for that functionality.
/*
if ( argc != 2 )
diff --git a/src/Persistence_representations/test/read_persistence_from_file_test.cpp b/src/Persistence_representations/test/read_persistence_from_file_test.cpp
index afdc822c..276b92ab 100644
--- a/src/Persistence_representations/test/read_persistence_from_file_test.cpp
+++ b/src/Persistence_representations/test/read_persistence_from_file_test.cpp
@@ -30,8 +30,6 @@
using namespace Gudhi;
using namespace Gudhi::Persistence_representations;
-
-
BOOST_AUTO_TEST_CASE(test_read_file_with_four_elements_per_line) {
std::vector<std::pair<double, double> > what_we_should_get;
what_we_should_get.push_back(std::make_pair(0, 2));
@@ -39,7 +37,7 @@ BOOST_AUTO_TEST_CASE(test_read_file_with_four_elements_per_line) {
what_we_should_get.push_back(std::make_pair(10, 90));
what_we_should_get.push_back(std::make_pair(4, 4));
std::vector<std::pair<double, double> > what_we_get = read_persistence_intervals_in_one_dimension_from_file(
- "data/persistence_file_with_four_entries_per_line", 1, 1000);
+ "data/persistence_file_with_four_entries_per_line", 1, 1000);
// for ( size_t i = 0 ; i != what_we_get.size() ; ++i )
//{
@@ -76,7 +74,6 @@ BOOST_AUTO_TEST_CASE(test_read_file_with_three_elements_per_line) {
}
}
-
BOOST_AUTO_TEST_CASE(test_read_file_with_two_elements_per_line) {
std::vector<std::pair<double, double> > what_we_should_get;
what_we_should_get.push_back(std::make_pair(4, 10));
@@ -84,12 +81,11 @@ BOOST_AUTO_TEST_CASE(test_read_file_with_two_elements_per_line) {
what_we_should_get.push_back(std::make_pair(0, 1));
what_we_should_get.push_back(std::make_pair(1, 4));
- std::vector<std::pair<double, double> > what_we_get =
- read_persistence_intervals_in_one_dimension_from_file("data/persistence_file_with_two_entries_per_line", -1, 9999);
+ std::vector<std::pair<double, double> > what_we_get = read_persistence_intervals_in_one_dimension_from_file(
+ "data/persistence_file_with_two_entries_per_line", -1, 9999);
BOOST_CHECK(what_we_should_get.size() == what_we_get.size());
for (size_t i = 0; i != what_we_get.size(); ++i) {
BOOST_CHECK(what_we_should_get[i] == what_we_get[i]);
}
}
-
diff --git a/src/Persistence_representations/test/vector_representation_test.cpp b/src/Persistence_representations/test/vector_representation_test.cpp
index 7e4ce3ee..c545dce7 100644
--- a/src/Persistence_representations/test/vector_representation_test.cpp
+++ b/src/Persistence_representations/test/vector_representation_test.cpp
@@ -295,12 +295,10 @@ BOOST_AUTO_TEST_CASE(check_distance_computations) {
}
BOOST_AUTO_TEST_CASE(check_default_parameters_of_distances) {
- std::vector<std::pair<double, double> > diag =
- read_persistence_intervals_in_dimension("data/file_with_diagram");
+ std::vector<std::pair<double, double> > diag = read_persistence_intervals_in_dimension("data/file_with_diagram");
Vector_distances_in_diagram<Euclidean_distance> p(diag, 100);
- std::vector<std::pair<double, double> > diag1 =
- read_persistence_intervals_in_dimension("data/file_with_diagram_1");
+ std::vector<std::pair<double, double> > diag1 = read_persistence_intervals_in_dimension("data/file_with_diagram_1");
Vector_distances_in_diagram<Euclidean_distance> q(diag1, 100);
double dist_numeric_limit_max = p.distance(q, std::numeric_limits<double>::max());