MCPcopy Create free account
hub / github.com/Geode-solutions/OpenGeode / test_clone

Function test_clone

tests/mesh/test-triangulated-surface.cpp:240–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238}
239
240void test_clone( const geode::TriangulatedSurface3D& surface )
241{
242 auto attr_from = surface.edges()
243 .edge_attribute_manager()
244 .find_or_create_attribute< geode::VariableAttribute,
245 geode::index_t >( "edge_id", 0 );
246 for( const auto e : geode::Range{ surface.edges().nb_edges() } )
247 {
248 attr_from->set_value( e, e );
249 }
250 auto surface_clone = surface.clone();
251 geode::OpenGeodeTriangulatedSurface3D surface2{ std::move(
252 *dynamic_cast< geode::OpenGeodeTriangulatedSurface3D* >(
253 surface_clone.get() ) ) };
254 geode::OpenGeodeMeshException::test( surface2.nb_vertices() == 5,
255 "TriangulatedSurface2 should have 5 vertices" );
256 geode::OpenGeodeMeshException::test( surface2.edges().nb_edges() == 5,
257 "TriangulatedSurface2 should have 5 edges" );
258 geode::OpenGeodeMeshException::test( surface2.nb_polygons() == 2,
259 "TriangulatedSurface2 should have 2 polygons" );
260 auto attr_to = surface2.edges()
261 .edge_attribute_manager()
262 .find_attribute< geode::index_t >( "edge_id" );
263 for( const auto e : geode::Range{ surface.edges().nb_edges() } )
264 {
265 geode::OpenGeodeMeshException::test(
266 attr_from->value( e ) == attr_to->value( e ),
267 "Error in edge attribute transfer during cloning" );
268 }
269}
270
271void test_delete_all( const geode::TriangulatedSurface3D& triangulated_surface,
272 geode::TriangulatedSurfaceBuilder3D& builder )

Callers 1

testFunction · 0.70

Calls 8

nb_polygonsMethod · 0.80
testFunction · 0.70
nb_edgesMethod · 0.45
set_valueMethod · 0.45
cloneMethod · 0.45
getMethod · 0.45
nb_verticesMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected