diff options
author | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2018-02-02 15:45:06 +0000 |
---|---|---|
committer | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2018-02-02 15:45:06 +0000 |
commit | 5ae31a73253f6b29f5cbf1e04af17acf62741d9e (patch) | |
tree | 512041b9bf0835f2520e5b6b2fde0f972998efc4 /src/Nerve_GIC/test/test_GIC.cpp | |
parent | 4a5332dfb88ec27157c82f77df87f588f7016736 (diff) | |
parent | 265484997185f3bf900744406206a2d64ca0a20d (diff) |
Merge last trunk modificat
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/rips_complex_from_correlation_matrix@3212 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: ea6296547b67ad82f5983d4309493e9131da7dd0
Diffstat (limited to 'src/Nerve_GIC/test/test_GIC.cpp')
-rw-r--r-- | src/Nerve_GIC/test/test_GIC.cpp | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/src/Nerve_GIC/test/test_GIC.cpp b/src/Nerve_GIC/test/test_GIC.cpp new file mode 100644 index 00000000..d633753c --- /dev/null +++ b/src/Nerve_GIC/test/test_GIC.cpp @@ -0,0 +1,90 @@ +/* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): Mathieu Carrière + * + * Copyright (C) 2017 INRIA + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#define BOOST_TEST_DYN_LINK +#define BOOST_TEST_MODULE "graph_induced_complex" + +#include <boost/test/unit_test.hpp> + +#include <limits> +#include <string> +#include <vector> + +#include <gudhi/GIC.h> +#include <gudhi/distance_functions.h> +#include <gudhi/reader_utils.h> + +BOOST_AUTO_TEST_CASE(check_nerve) { + using Point = std::vector<float>; + Gudhi::cover_complex::Cover_complex<Point> N; + N.set_type("Nerve"); + std::string cloud_file_name("data/cloud"); + N.read_point_cloud(cloud_file_name); + std::string graph_file_name("data/graph"); + N.set_graph_from_file(graph_file_name); + std::string cover_file_name("data/cover"); + N.set_cover_from_file(cover_file_name); + N.find_simplices(); + Gudhi::Simplex_tree<> stree; + N.create_complex(stree); + + BOOST_CHECK(stree.num_vertices() == 3); + BOOST_CHECK((stree.num_simplices() - stree.num_vertices()) == 0); + BOOST_CHECK(stree.dimension() == 0); +} + +BOOST_AUTO_TEST_CASE(check_GIC) { + using Point = std::vector<float>; + Gudhi::cover_complex::Cover_complex<Point> GIC; + GIC.set_type("GIC"); + std::string cloud_file_name("data/cloud"); + GIC.read_point_cloud(cloud_file_name); + std::string graph_file_name("data/graph"); + GIC.set_graph_from_file(graph_file_name); + std::string cover_file_name("data/cover"); + GIC.set_cover_from_file(cover_file_name); + GIC.find_simplices(); + Gudhi::Simplex_tree<> stree; + GIC.create_complex(stree); + + BOOST_CHECK(stree.num_vertices() == 3); + BOOST_CHECK((stree.num_simplices() - stree.num_vertices()) == 4); + BOOST_CHECK(stree.dimension() == 2); +} + +BOOST_AUTO_TEST_CASE(check_voronoiGIC) { + using Point = std::vector<float>; + Gudhi::cover_complex::Cover_complex<Point> GIC; + GIC.set_type("GIC"); + std::string cloud_file_name("data/cloud"); + GIC.read_point_cloud(cloud_file_name); + std::string graph_file_name("data/graph"); + GIC.set_graph_from_file(graph_file_name); + GIC.set_cover_from_Voronoi(Gudhi::Euclidean_distance(), 2); + GIC.find_simplices(); + Gudhi::Simplex_tree<> stree; + GIC.create_complex(stree); + + BOOST_CHECK(stree.num_vertices() == 2); + BOOST_CHECK((stree.num_simplices() - stree.num_vertices()) == 1); + BOOST_CHECK(stree.dimension() == 1); +} |