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

Function test_create_edges

tests/mesh/test-graph.cpp:44–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44void test_create_edges(
45 const geode::Graph& graph, geode::GraphBuilder& builder )
46{
47 builder.create_edge( 0, 1 );
48 builder.create_edge( 0, 2 );
49 builder.create_edge( 3, 2 );
50 builder.create_edge( 1, 2 );
51 geode::OpenGeodeMeshException::test(
52 graph.nb_edges() == 4, "Graph should have 4 edges" );
53 std::array< geode::index_t, 2 > answer{ 3, 2 };
54 geode::OpenGeodeMeshException::test(
55 graph.edge_vertices( 2 ) == answer, "Wrong edge vertices" );
56
57 const auto& edges_around_0 = graph.edges_around_vertex( 0 );
58 geode::OpenGeodeMeshException::test(
59 edges_around_0.size() == 2, "edges_around_0 should have 2 edges" );
60 geode::OpenGeodeMeshException::test(
61 edges_around_0[0].edge_id == 0, "edges_around_0 has wrong value" );
62 geode::OpenGeodeMeshException::test(
63 edges_around_0[0].vertex_id == 0, "edges_around_0 has wrong value" );
64 geode::OpenGeodeMeshException::test(
65 edges_around_0[1].edge_id == 1, "edges_around_0 has wrong value" );
66 geode::OpenGeodeMeshException::test(
67 edges_around_0[1].vertex_id == 0, "edges_around_0 has wrong value" );
68
69 const auto& edges_around_2 = graph.edges_around_vertex( 2 );
70 geode::OpenGeodeMeshException::test(
71 edges_around_2.size() == 3, "edges_around_2 should have 3 edges" );
72 geode::OpenGeodeMeshException::test(
73 edges_around_2[0].edge_id == 1, "edges_around_2 has wrong value" );
74 geode::OpenGeodeMeshException::test(
75 edges_around_2[0].vertex_id == 1, "edges_around_2 has wrong value" );
76 geode::OpenGeodeMeshException::test(
77 edges_around_2[1].edge_id == 2, "edges_around_2 has wrong value" );
78 geode::OpenGeodeMeshException::test(
79 edges_around_2[1].vertex_id == 1, "edges_around_2 has wrong value" );
80 geode::OpenGeodeMeshException::test(
81 edges_around_2[2].edge_id == 3, "edges_around_2 has wrong value" );
82 geode::OpenGeodeMeshException::test(
83 edges_around_2[2].vertex_id == 1, "edges_around_2 has wrong value" );
84}
85
86void test_delete_edge( const geode::Graph& graph, geode::GraphBuilder& builder )
87{

Callers 1

testFunction · 0.70

Calls 5

create_edgeMethod · 0.80
edge_verticesMethod · 0.80
testFunction · 0.70
nb_edgesMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected