@@ -343,29 +343,7 @@ TEST_CASE_FIXTURE(
343343
344344TEST_CASE_FIXTURE (
345345 test_directed_adjacency_list,
346- " remove_vertex<GetRemovedEdgeIds=false> should remove the given vertex and all edges incident "
347- " with it"
348- ) {
349- init_complete_graph ();
350-
351- const auto removed_vertex_id = constants::first_element_idx;
352- sut.remove_vertex <false >(removed_vertex_id);
353-
354- constexpr auto n_vertices_after_remove = constants::n_elements - constants::one_element;
355- constexpr auto n_incident_edges_after_remove =
356- n_incident_edges_for_fully_connected_vertex - constants::one_element;
357-
358- REQUIRE_EQ (size (sut), n_vertices_after_remove);
359- for (const auto vertex_id :
360- constants::vertex_id_view | std::views::take (n_vertices_after_remove)) {
361- CHECK_EQ (sut.adjacent_edges (vertex_id).size (), n_incident_edges_after_remove);
362- }
363- }
364-
365- TEST_CASE_FIXTURE (
366- test_directed_adjacency_list,
367- " remove_vertex<GetRemovedEdgeIds=true> should remove the given vertex and all edges incident "
368- " with it"
346+ " remove_vertex should remove the given vertex and all edges incident with it"
369347) {
370348 const auto edge1 = add_edge (constants::vertex_id_1, constants::vertex_id_2);
371349 const auto edge3 = add_edge (constants::vertex_id_2, constants::vertex_id_1);
@@ -376,27 +354,19 @@ TEST_CASE_FIXTURE(
376354 const auto edge6 = add_edge (constants::vertex_id_3, constants::vertex_id_2);
377355
378356 const auto removed_vertex_id = constants::vertex_id_1;
379- const auto removed_edge_ids = sut.remove_vertex < true > (removed_vertex_id);
357+ const auto removed_edge_ids = sut.remove_vertex (removed_vertex_id);
380358
381359 REQUIRE_EQ (removed_edge_ids.size (), 4uz);
382360 for (const auto edge_id : {edge1.id (), edge2.id (), edge3.id (), edge4.id ()})
383361 CHECK (std::ranges::contains (removed_edge_ids, edge_id));
384362 for (const auto edge_id : {edge5.id (), edge6.id ()})
385363 CHECK_FALSE (std::ranges::contains (removed_edge_ids, edge_id));
386364
387- constexpr auto n_vertices_after_remove = constants::n_elements - constants::one_element;
388- constexpr auto n_incident_edges_after_remove =
389- n_incident_edges_for_fully_connected_vertex - constants::one_element;
390-
391- REQUIRE_EQ (size (sut), n_vertices_after_remove);
392- for (const auto vertex_id :
393- constants::vertex_id_view | std::views::take (n_vertices_after_remove)) {
394- CHECK_EQ (sut.adjacent_edges (vertex_id).size (), n_incident_edges_after_remove);
395- }
365+ CHECK_EQ (size (sut), constants::n_elements - 1uz);
366+ CHECK_EQ (sut.adjacent_edges (constants::vertex_id_1).size (), 1uz); // IDs were aligned
367+ CHECK_EQ (sut.adjacent_edges (constants::vertex_id_2).size (), 1uz); // IDs were aligned
396368}
397369
398- // TODO: add test case with GetRemovedEdgeIds=true
399-
400370struct test_undirected_adjacency_list : public test_adjacency_list {
401371 using edge_type = gl::undirected_edge<>;
402372 using sut_type = gl::impl::adjacency_list<gl::list_graph_traits<gl::undirected_t >>;
@@ -670,20 +640,24 @@ TEST_CASE_FIXTURE(
670640 test_undirected_adjacency_list,
671641 " remove_vertex should remove the given vertex and all edges incident with it"
672642) {
673- init_complete_graph ();
643+ const auto edge1 = add_edge (constants::vertex_id_1, constants::vertex_id_2);
644+ const auto edge3 = add_edge (constants::vertex_id_2, constants::vertex_id_1);
645+ const auto edge2 = add_edge (constants::vertex_id_1, constants::vertex_id_3);
646+ const auto edge4 = add_edge (constants::vertex_id_3, constants::vertex_id_1);
647+
648+ const auto edge5 = add_edge (constants::vertex_id_2, constants::vertex_id_3);
674649
675650 const auto removed_vertex_id = constants::first_element_idx;
676- sut.remove_vertex < false > (removed_vertex_id);
651+ const auto removed_edge_ids = sut.remove_vertex (removed_vertex_id);
677652
678- constexpr auto n_vertices_after_remove = constants::n_elements - constants::one_element;
679- constexpr auto n_incident_edges_after_remove =
680- n_incident_edges_for_fully_connected_vertex - constants::one_element;
653+ REQUIRE_EQ (removed_edge_ids.size (), 4uz);
654+ for (const auto edge_id : {edge1.id (), edge2.id (), edge3.id (), edge4.id ()})
655+ CHECK (std::ranges::contains (removed_edge_ids, edge_id));
656+ CHECK_FALSE (std::ranges::contains (removed_edge_ids, edge5.id ()));
681657
682- REQUIRE_EQ (size (sut), n_vertices_after_remove);
683- for (const auto vertex_id :
684- constants::vertex_id_view | std::views::take (n_vertices_after_remove)) {
685- CHECK_EQ (sut.adjacent_edges (vertex_id).size (), n_incident_edges_after_remove);
686- }
658+ CHECK_EQ (size (sut), constants::n_elements - 1uz);
659+ CHECK_EQ (sut.adjacent_edges (constants::vertex_id_1).size (), 1uz); // IDs were aligned
660+ CHECK_EQ (sut.adjacent_edges (constants::vertex_id_2).size (), 1uz); // IDs were aligned
687661}
688662
689663TEST_SUITE_END (); // test_adjacency_list
0 commit comments