Skip to content

Commit

Permalink
index tests cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
vissarion committed Aug 11, 2024
1 parent e8dec9e commit 1c1119d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,19 @@ jobs:
echo "using clang : : $(which clang++-${{ matrix.version }}) ;" > ${HOME}/user-config.jam
test -f $HOME/user-config.jam && cat $HOME/user-config.jam
- name: Tests with cmake
- name: Build tests with cmake (c++17)
run: |
cd $BOOST_ROOT/libs/geometry
mkdir __build
cd __build
cmake -DCMAKE_CXX_STANDARD=17 -DBUILD_TESTING=ON ..
cmake --build . --target tests
- name: Build tests with cmake
run: |
rm -rf *
cmake -DBUILD_TESTING=ON ..
cmake --build . --target tests
- name: Run tests
ctest --output-on-failure --no-tests=error
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")

enable_testing()
add_subdirectory(test EXCLUDE_FROM_ALL)
add_subdirectory(index/test EXCLUDE_FROM_ALL)

endif()

4 changes: 2 additions & 2 deletions include/boost/geometry/index/detail/rtree/visitors/insert.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,11 @@ class insert
// Enlarge it in case if it's not bounding geometry type.
// It's because Points and Segments are compared WRT machine epsilon
// This ensures that leafs bounds correspond to the stored elements
if BOOST_GEOMETRY_CONSTEXPR ((std::is_same<Element, value_type>::value)
if (BOOST_GEOMETRY_CONSTEXPR ((std::is_same<Element, value_type>::value
&& ! index::detail::is_bounding_geometry
<
typename indexable_type<translator_type>::type
>::value)
>::value)))
{
geometry::detail::expand_by_epsilon(m_element_bounds);
}
Expand Down
11 changes: 6 additions & 5 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,27 @@
# It also lets running the tests much faster.
if (APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffp-contract=fast")
endif()
endif()

function(boost_geometry_add_unit_test prefix item)
set(unit_test_name "boost_geometry_${prefix}_${item}")
add_executable(${unit_test_name} ${item}.cpp)

# Add a dependendcy to Boost.Geometry
target_link_libraries(${unit_test_name}
target_link_libraries(${unit_test_name}
PRIVATE
Boost::geometry)

# For unit tests, add a dependency to the unit test framework (in header only mode)
target_link_libraries(${unit_test_name}
target_link_libraries(${unit_test_name}
PRIVATE
Boost::included_unit_test_framework)

# Include the main Geometry test folder and the current folder
target_include_directories(${unit_test_name}
PRIVATE
"${PROJECT_SOURCE_DIR}/test"
"${PROJECT_SOURCE_DIR}/test"
"${PROJECT_SOURCE_DIR}/index/test"
.)

# To compile with C++14
Expand Down

0 comments on commit 1c1119d

Please sign in to comment.