| 84 | } |
| 85 | |
| 86 | void test_delete_edge( const geode::Graph& graph, geode::GraphBuilder& builder ) |
| 87 | { |
| 88 | std::vector< bool > to_delete( graph.nb_edges(), false ); |
| 89 | to_delete.front() = true; |
| 90 | builder.delete_edges( to_delete ); |
| 91 | geode::OpenGeodeMeshException::test( |
| 92 | graph.nb_edges() == 3, "Graph should have 3 edges" ); |
| 93 | geode::OpenGeodeMeshException::test( graph.edge_vertex( { 0, 0 } ) == 0, |
| 94 | "Graph edge vertex index is not correct" ); |
| 95 | geode::OpenGeodeMeshException::test( graph.edge_vertex( { 0, 1 } ) == 2, |
| 96 | "Graph edge vertex index is not correct" ); |
| 97 | geode::OpenGeodeMeshException::test( graph.edge_vertex( { 1, 0 } ) == 3, |
| 98 | "Graph edge vertex index is not correct" ); |
| 99 | geode::OpenGeodeMeshException::test( graph.edge_vertex( { 1, 1 } ) == 2, |
| 100 | "Graph edge vertex index is not correct" ); |
| 101 | geode::OpenGeodeMeshException::test( graph.edge_vertex( { 2, 0 } ) == 1, |
| 102 | "Graph edge vertex index is not correct" ); |
| 103 | geode::OpenGeodeMeshException::test( graph.edge_vertex( { 2, 1 } ) == 2, |
| 104 | "Graph edge vertex index is not correct" ); |
| 105 | |
| 106 | builder.create_edges( 10 ); |
| 107 | builder.set_edge_vertex( { 1, 0 }, 1 ); |
| 108 | builder.set_edge_vertex( { 1, 1 }, 0 ); |
| 109 | geode::OpenGeodeMeshException::test( |
| 110 | graph.nb_edges() == 13, "Graph should have 13 edges" ); |
| 111 | |
| 112 | to_delete.back() = true; |
| 113 | to_delete.resize( graph.nb_edges(), true ); |
| 114 | builder.delete_edges( to_delete ); |
| 115 | geode::OpenGeodeMeshException::test( |
| 116 | graph.nb_edges() == 2, "Graph should have 2 edges" ); |
| 117 | geode::OpenGeodeMeshException::test( graph.edge_vertex( { 0, 0 } ) == 1, |
| 118 | "Graph edge vertex index is not correct (0, 0)" ); |
| 119 | geode::OpenGeodeMeshException::test( graph.edge_vertex( { 0, 1 } ) == 0, |
| 120 | "Graph edge vertex index is not correct (0, 1)" ); |
| 121 | } |
| 122 | |
| 123 | void test_io( const geode::Graph& graph, const std::string& filename ) |
| 124 | { |
no test coverage detected