add cmap test

This commit is contained in:
Guillaume Damiand 2025-02-13 15:12:15 +01:00
parent 06b511cc65
commit 3942e1e2a6
2 changed files with 41 additions and 1 deletions

View File

@ -12,6 +12,8 @@ set(hfiles Combinatorial_map_2_test.h Combinatorial_map_3_test.h
# create a target per cppfile
create_single_source_cgal_program(Combinatorial_map_test.cpp ${hfiles})
create_single_source_cgal_program(Combinatorial_map_copy_test.cpp ${hfiles})
create_single_source_cgal_program(cmap_test_split_attribute.cpp)
create_single_source_cgal_program(Combinatorial_map_empty_it_test.cpp)
# Same targets, defining USE_COMPACT_CONTAINER_WITH_INDEX to test index version
add_executable(Combinatorial_map_test_index Combinatorial_map_test.cpp ${hfiles})
@ -24,7 +26,9 @@ target_compile_definitions(Combinatorial_map_copy_test_index PRIVATE USE_COMPACT
target_link_libraries(Combinatorial_map_copy_test_index PRIVATE CGAL::CGAL CGAL::Data)
cgal_add_compilation_test(Combinatorial_map_copy_test_index)
create_single_source_cgal_program(cmap_test_split_attribute.cpp)
add_executable(Combinatorial_map_empty_it_test_index Combinatorial_map_empty_it_test.cpp)
target_compile_definitions(Combinatorial_map_empty_it_test_index PRIVATE USE_COMPACT_CONTAINER_WITH_INDEX)
cgal_add_compilation_test(Combinatorial_map_empty_it_test_index)
# Link with OpenMesh if possible
find_package(OpenMesh QUIET)

View File

@ -0,0 +1,36 @@
#include <CGAL/Combinatorial_map.h>
struct Map_3_dart_items_3: public CGAL::Generic_map_min_items
{
#ifdef USE_COMPACT_CONTAINER_WITH_INDEX
typedef CGAL::Tag_true Use_index;
#endif
};
using Map3=CGAL::Combinatorial_map<3, Map_3_dart_items_3>;
template<typename Range>
bool test_empty_it(Range& r, const std::string& txt)
{
bool res=true;
Map3 m;
if(r.size()!=0)
{
std::cout<<"[ERROR "<<txt<<"] non zero size with range: "<<r.size()<<std::endl;
res=false;
}
std::size_t nb=0;
for(auto it=r.begin(), itend=r.end(); it!=itend; ++it)
{ ++nb; }
if(nb!=0)
{
std::cout<<"[ERROR "<<txt<<"] non zero size with it: "<<nb<<std::endl;
res=false;
}
return res;
}
int main()
{
}