summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-09-19 19:40:44 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-09-19 19:40:44 +0000
commit5cdf5825e0e5a937c5bbc5cee49ed9aa34f0af0e (patch)
treec04e262f2d5336c36428cdaaca5418bf62c1ba72 /src/common
parente54574c7290b28543b9c1e7d1b9a16f42825ae26 (diff)
use of std::vector for unitary test instead of CGAL points type
rename unitary test as stands in convention git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@1511 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: b768b5a6bb0fe823abe6cbbea28d49c7ecb39a9d
Diffstat (limited to 'src/common')
-rw-r--r--src/common/test/CMakeLists.txt27
-rw-r--r--src/common/test/test_points_off_reader.cpp (renamed from src/common/test/points_off_reader_unit_test.cpp)21
2 files changed, 16 insertions, 32 deletions
diff --git a/src/common/test/CMakeLists.txt b/src/common/test/CMakeLists.txt
index 0a88cf8e..7ccdb752 100644
--- a/src/common/test/CMakeLists.txt
+++ b/src/common/test/CMakeLists.txt
@@ -10,26 +10,15 @@ if (GPROF_PATH)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
endif()
-# need CGAL 4.7
-if(CGAL_FOUND)
- if (NOT CGAL_VERSION VERSION_LESS 4.7.0)
- if (EIGEN3_FOUND)
- add_executable ( poffreader_UT points_off_reader_unit_test.cpp )
- target_link_libraries(poffreader_UT ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
+add_executable ( poffreader_UT test_points_off_reader.cpp )
+target_link_libraries(poffreader_UT ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
- # Do not forget to copy test files in current binary dir
- file(COPY "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
+# Do not forget to copy test files in current binary dir
+file(COPY "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
- # Unitary tests
- add_test(poffreader_UT ${CMAKE_CURRENT_BINARY_DIR}/poffreader_UT
- # XML format for Jenkins xUnit plugin
- --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/poffreader_UT.xml --log_level=test_suite --report_level=no)
+# Unitary tests
+add_test(poffreader_UT ${CMAKE_CURRENT_BINARY_DIR}/poffreader_UT
+ # XML format for Jenkins xUnit plugin
+ --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/poffreader_UT.xml --log_level=test_suite --report_level=no)
- else()
- message(WARNING "Eigen3 not found. Version 3.1.0 is required for points_off_reader unitary tests.")
- endif()
- else()
- message(WARNING "CGAL version: ${CGAL_VERSION} is too old to compile points_off_reader unitary tests. Version 4.7.0 is required.")
- endif ()
-endif()
diff --git a/src/common/test/points_off_reader_unit_test.cpp b/src/common/test/test_points_off_reader.cpp
index dbcc0434..b4f71182 100644
--- a/src/common/test/points_off_reader_unit_test.cpp
+++ b/src/common/test/test_points_off_reader.cpp
@@ -22,10 +22,6 @@
#include <gudhi/Points_off_io.h>
-// For CGAL points type in dimension d
-// cf. http://doc.cgal.org/latest/Kernel_d/classCGAL_1_1Point__d.html
-#include <CGAL/Epick_d.h>
-
#include <iostream>
#include <string>
#include <vector>
@@ -34,8 +30,7 @@
#define BOOST_TEST_MODULE "points_off_read_write"
#include <boost/test/unit_test.hpp>
-typedef CGAL::Epick_d< CGAL::Dynamic_dimension_tag > Kernel;
-typedef Kernel::Point_d Point_d;
+using Point_d = std::vector<double>;
BOOST_AUTO_TEST_CASE( points_doc_test )
{
@@ -50,19 +45,19 @@ BOOST_AUTO_TEST_CASE( points_doc_test )
std::vector<Point_d> expected_points;
std::vector<double> point = {1.0, 1.0};
- expected_points.push_back(Point_d(2, point.begin(), point.end()));
+ expected_points.push_back(Point_d(point.begin(), point.end()));
point = {7.0, 0.0};
- expected_points.push_back(Point_d(2, point.begin(), point.end()));
+ expected_points.push_back(Point_d(point.begin(), point.end()));
point = {4.0, 6.0};
- expected_points.push_back(Point_d(2, point.begin(), point.end()));
+ expected_points.push_back(Point_d(point.begin(), point.end()));
point = {9.0, 6.0};
- expected_points.push_back(Point_d(2, point.begin(), point.end()));
+ expected_points.push_back(Point_d(point.begin(), point.end()));
point = {0.0, 14.0};
- expected_points.push_back(Point_d(2, point.begin(), point.end()));
+ expected_points.push_back(Point_d(point.begin(), point.end()));
point = {2.0, 19.0};
- expected_points.push_back(Point_d(2, point.begin(), point.end()));
+ expected_points.push_back(Point_d(point.begin(), point.end()));
point = {9.0, 17.0};
- expected_points.push_back(Point_d(2, point.begin(), point.end()));
+ expected_points.push_back(Point_d(point.begin(), point.end()));
BOOST_CHECK(point_cloud == expected_points);
}