Skip to content

Commit a730d4b

Browse files
committed
removed testing namespace aliases
1 parent 247201d commit a730d4b

29 files changed

+745
-748
lines changed

tests/include/testing/gl/alg_common.hpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#pragma once
22

33
#include "constants.hpp"
4-
#include "namespaces.hpp"
54
#include "types.hpp"
65

76
#include <gl/algorithms.hpp>
@@ -15,8 +14,8 @@ namespace gl_testing::alg_common {
1514
inline const fs::path data_path(TEST_DATA_PATH);
1615

1716
template <typename T>
18-
requires(lib_tt::c_readable<T>)
19-
[[nodiscard]] std::vector<T> load_list(const lib_t::size_type n, const fs::path& file_path) {
17+
requires(gl::type_traits::c_readable<T>)
18+
[[nodiscard]] std::vector<T> load_list(const gl::types::size_type n, const fs::path& file_path) {
2019
std::vector<T> list(n);
2120

2221
std::ifstream file(file_path);
@@ -28,16 +27,16 @@ requires(lib_tt::c_readable<T>)
2827
);
2928
}
3029

31-
for (lib_t::size_type i = 0; i < n; ++i)
30+
for (gl::types::size_type i = 0; i < n; ++i)
3231
file >> list[i];
3332

3433
return list;
3534
}
3635

3736
[[nodiscard]] inline auto has_correct_bin_predecessor(
38-
const lib::algorithm::predecessors_descriptor& pd
37+
const gl::algorithm::predecessors_descriptor& pd
3938
) {
40-
return [&pd](const lib_t::id_type vertex_id) {
39+
return [&pd](const gl::types::id_type vertex_id) {
4140
if (not pd.is_reachable(vertex_id))
4241
return false;
4342

@@ -48,7 +47,7 @@ requires(lib_tt::c_readable<T>)
4847
};
4948
}
5049

51-
template <lib_tt::c_instantiation_of<lib::vertex_descriptor> VertexType>
50+
template <gl::type_traits::c_instantiation_of<gl::vertex_descriptor> VertexType>
5251
requires(std::same_as<typename VertexType::properties_type, types::visited_property>)
5352
struct vertex_visited_projection {
5453
[[nodiscard]] bool operator()(const VertexType& vertex) const {

tests/include/testing/gl/constants.hpp

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#pragma once
22

3-
#include "namespaces.hpp"
43
#include "types.hpp"
54

65
#include <gl/types/types.hpp>
@@ -11,29 +10,29 @@
1110

1211
namespace gl_testing::constants {
1312

14-
IC lib_t::size_type zero = 0ull;
15-
IC lib_t::size_type one = 1ull;
16-
IC lib_t::size_type two = 2ull;
17-
IC lib_t::size_type three = 3ull;
13+
IC gl::types::size_type zero = 0ull;
14+
IC gl::types::size_type one = 1ull;
15+
IC gl::types::size_type two = 2ull;
16+
IC gl::types::size_type three = 3ull;
1817

19-
IC lib_t::size_type n_elements = three;
20-
IC lib_t::size_type zero_elements = zero;
21-
IC lib_t::size_type one_element = one;
18+
IC gl::types::size_type n_elements = three;
19+
IC gl::types::size_type zero_elements = zero;
20+
IC gl::types::size_type one_element = one;
2221

2322
// n_elements for graph topology tests
24-
IC lib_t::size_type n_elements_top = 10ull;
23+
IC gl::types::size_type n_elements_top = 10ull;
2524

2625
// n_elements for graph algorithm tests
27-
IC lib_t::size_type n_elements_alg = 10ull;
28-
IC lib_t::size_type depth = 5ull;
26+
IC gl::types::size_type n_elements_alg = 10ull;
27+
IC gl::types::size_type depth = 5ull;
2928

30-
IC lib_t::size_type first_element_idx = zero;
31-
IC lib_t::size_type last_element_idx = n_elements - one_element;
32-
IC lib_t::size_type out_of_range_elemenet_idx = n_elements;
29+
IC gl::types::size_type first_element_idx = zero;
30+
IC gl::types::size_type last_element_idx = n_elements - one_element;
31+
IC gl::types::size_type out_of_range_elemenet_idx = n_elements;
3332

34-
IC lib_t::id_type vertex_id_1 = first_element_idx;
35-
IC lib_t::id_type vertex_id_2 = vertex_id_1 + one_element;
36-
IC lib_t::id_type vertex_id_3 = vertex_id_2 + one_element;
33+
IC gl::types::id_type vertex_id_1 = first_element_idx;
34+
IC gl::types::id_type vertex_id_2 = vertex_id_1 + one_element;
35+
IC gl::types::id_type vertex_id_3 = vertex_id_2 + one_element;
3736

3837
IC auto vertex_id_view = std::views::iota(first_element_idx, n_elements);
3938

tests/include/testing/gl/functional.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#pragma once
22

3-
#include "namespaces.hpp"
4-
53
namespace gl_testing::func {
64

75
template <typename T>

tests/include/testing/gl/io_common.hpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
#pragma once
22

3-
#include "namespaces.hpp"
4-
53
#include <gl/graph_utility.hpp>
64

75
#include <doctest.h>
86

97
namespace gl_testing::io_common {
108

11-
template <lib_tt::c_graph GraphType>
9+
template <gl::type_traits::c_graph GraphType>
1210
void verify_graph_structure(const GraphType& actual, const GraphType& expected) {
1311
REQUIRE_EQ(actual.n_vertices(), expected.n_vertices());
1412
REQUIRE_EQ(actual.n_unique_edges(), expected.n_unique_edges());
@@ -21,7 +19,7 @@ void verify_graph_structure(const GraphType& actual, const GraphType& expected)
2119
}));
2220
}
2321

24-
template <lib_tt::c_graph GraphType>
22+
template <gl::type_traits::c_graph GraphType>
2523
void verify_vertex_properties(const GraphType& actual, const GraphType& expected) {
2624
const auto properties_proj = [](const auto& vertex) { return vertex.properties; };
2725

@@ -34,7 +32,7 @@ void verify_vertex_properties(const GraphType& actual, const GraphType& expected
3432
));
3533
}
3634

37-
template <lib_tt::c_graph GraphType>
35+
template <gl::type_traits::c_graph GraphType>
3836
void verify_edge_properties(const GraphType& actual, const GraphType& expected) {
3937
const auto properties_proj = [](const auto& vertex) { return vertex.properties; };
4038

tests/include/testing/gl/namespaces.hpp

Lines changed: 0 additions & 21 deletions
This file was deleted.

tests/include/testing/gl/transforms.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
#pragma once
22

3-
#include "namespaces.hpp"
4-
53
#include <gl/vertex_descriptor.hpp>
64

75
#include <memory>
86

97
namespace gl_testing::transforms {
108

11-
template <lib_tt::c_instantiation_of<lib::vertex_descriptor> VertexType = lib::vertex_descriptor<>>
12-
inline lib_t::id_type extract_vertex_id(const VertexType& vertex) {
9+
template <
10+
gl::type_traits::c_instantiation_of<gl::vertex_descriptor> VertexType = gl::vertex_descriptor<>>
11+
inline gl::types::id_type extract_vertex_id(const VertexType& vertex) {
1312
return vertex.id();
1413
}
1514

tests/source/gl/test_adjacency_list.cpp

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,17 @@ TEST_CASE_TEMPLATE_DEFINE(
2929
REQUIRE_EQ(sut.n_vertices(), constants::n_elements);
3030
REQUIRE_EQ(sut.n_unique_edges(), constants::zero_elements);
3131

32-
std::ranges::for_each(constants::vertex_id_view, [&sut](const lib_t::id_type vertex_id) {
32+
std::ranges::for_each(constants::vertex_id_view, [&sut](const gl::types::id_type vertex_id) {
3333
CHECK_EQ(sut.adjacent_edges(vertex_id).distance(), constants::zero_elements);
3434
});
3535
}
3636

3737
SUBCASE("add_vertex should properly extend the current adjacency list") {
3838
SutType sut{};
39-
constexpr lib_t::size_type target_n_vertices = constants::n_elements;
39+
constexpr gl::types::size_type target_n_vertices = constants::n_elements;
4040

41-
for (lib_t::size_type n_vertices = constants::one_element; n_vertices <= target_n_vertices;
41+
for (gl::types::size_type n_vertices = constants::one_element;
42+
n_vertices <= target_n_vertices;
4243
n_vertices++) {
4344
sut.add_vertex();
4445
CHECK_EQ(sut.n_vertices(), n_vertices);
@@ -59,35 +60,37 @@ TEST_CASE_TEMPLATE_DEFINE(
5960

6061
TEST_CASE_TEMPLATE_INSTANTIATE(
6162
edge_directional_tag_sut_template,
62-
lib_i::adjacency_list<lib::list_graph_traits<lib::directed_t>>, // directed adj list
63-
lib_i::adjacency_list<lib::list_graph_traits<lib::undirected_t>> // undirected adj list
63+
gl::impl::adjacency_list<gl::list_graph_traits<gl::directed_t>>, // directed adj list
64+
gl::impl::adjacency_list<gl::list_graph_traits<gl::undirected_t>> // undirected adj list
6465
);
6566

6667
namespace {
6768

68-
constexpr lib_t::size_type n_incident_edges_for_fully_connected_vertex =
69+
constexpr gl::types::size_type n_incident_edges_for_fully_connected_vertex =
6970
constants::n_elements - constants::one_element;
7071

7172
} // namespace
7273

7374
struct test_directed_adjacency_list {
74-
using vertex_type = lib::vertex_descriptor<>;
75-
using edge_type = lib::directed_edge<vertex_type>;
76-
using edge_ptr_type = lib::directed_t::edge_ptr_type<edge_type>;
77-
using sut_type = lib_i::adjacency_list<lib::list_graph_traits<lib::directed_t>>;
75+
using vertex_type = gl::vertex_descriptor<>;
76+
using edge_type = gl::directed_edge<vertex_type>;
77+
using edge_ptr_type = gl::directed_t::edge_ptr_type<edge_type>;
78+
using sut_type = gl::impl::adjacency_list<gl::list_graph_traits<gl::directed_t>>;
7879

7980
test_directed_adjacency_list() {
8081
for (const auto id : constants::vertex_id_view)
8182
vertices.emplace_back(id);
8283
}
8384

84-
const edge_type& add_edge(const lib_t::id_type first_id, const lib_t::id_type second_id) {
85+
const edge_type& add_edge(
86+
const gl::types::id_type first_id, const gl::types::id_type second_id
87+
) {
8588
return sut.add_edge(
86-
lib::detail::make_edge<edge_type>(vertices[first_id], vertices[second_id])
89+
gl::detail::make_edge<edge_type>(vertices[first_id], vertices[second_id])
8790
);
8891
}
8992

90-
void fully_connect_vertex(const lib_t::id_type first_id, const bool no_loops = true) {
93+
void fully_connect_vertex(const gl::types::id_type first_id, const bool no_loops = true) {
9194
for (const auto second_id : constants::vertex_id_view) {
9295
if (second_id == first_id and no_loops)
9396
continue;
@@ -109,7 +112,7 @@ struct test_directed_adjacency_list {
109112
sut_type sut{constants::n_elements};
110113
std::vector<vertex_type> vertices;
111114

112-
const lib_t::size_type n_unique_edges_in_full_graph =
115+
const gl::types::size_type n_unique_edges_in_full_graph =
113116
n_incident_edges_for_fully_connected_vertex * constants::n_elements;
114117
};
115118

@@ -229,7 +232,7 @@ TEST_CASE_FIXTURE(
229232
test_directed_adjacency_list,
230233
"get_edges(id, id) should return a valid edge view if the given vertices are connected"
231234
) {
232-
std::vector<lib_t::const_ref_wrap<edge_type>> expected_edges;
235+
std::vector<gl::types::const_ref_wrap<edge_type>> expected_edges;
233236
for (auto _ = constants::first_element_idx; _ < constants::n_elements; _++)
234237
expected_edges.push_back(std::cref(add_edge(constants::vertex_id_1, constants::vertex_id_2))
235238
);
@@ -306,7 +309,7 @@ TEST_CASE_FIXTURE(
306309
) {
307310
init_complete_graph();
308311

309-
std::function<lib_t::size_type(const lib_t::id_type)> deg_proj;
312+
std::function<gl::types::size_type(const gl::types::id_type)> deg_proj;
310313

311314
SUBCASE("in_degree") {
312315
deg_proj = [this](const auto vertex_id) { return sut.in_degree(vertex_id); };
@@ -363,7 +366,7 @@ TEST_CASE_FIXTURE(
363366
init_complete_graph(false);
364367
const auto expected_deg = constants::n_elements;
365368

366-
std::vector<lib_t::id_type> degree_map;
369+
std::vector<gl::types::id_type> degree_map;
367370

368371
SUBCASE("in_degree") {
369372
degree_map = sut.in_degree_map();
@@ -387,7 +390,7 @@ TEST_CASE_FIXTURE(
387390
init_complete_graph(false);
388391
const auto expected_deg = constants::n_elements * constants::two;
389392

390-
std::vector<lib_t::id_type> degree_map = sut.degree_map();
393+
std::vector<gl::types::id_type> degree_map = sut.degree_map();
391394

392395
REQUIRE_EQ(degree_map.size(), constants::n_elements);
393396
CHECK_EQ(std::ranges::count(degree_map, expected_deg), constants::n_elements);
@@ -420,23 +423,25 @@ TEST_CASE_FIXTURE(
420423
}
421424

422425
struct test_undirected_adjacency_list {
423-
using vertex_type = lib::vertex_descriptor<>;
424-
using edge_type = lib::undirected_edge<vertex_type>;
425-
using edge_ptr_type = lib::undirected_t::edge_ptr_type<edge_type>;
426-
using sut_type = lib_i::adjacency_list<lib::list_graph_traits<lib::undirected_t>>;
426+
using vertex_type = gl::vertex_descriptor<>;
427+
using edge_type = gl::undirected_edge<vertex_type>;
428+
using edge_ptr_type = gl::undirected_t::edge_ptr_type<edge_type>;
429+
using sut_type = gl::impl::adjacency_list<gl::list_graph_traits<gl::undirected_t>>;
427430

428431
test_undirected_adjacency_list() {
429432
for (const auto id : constants::vertex_id_view)
430433
vertices.emplace_back(id);
431434
}
432435

433-
const edge_type& add_edge(const lib_t::id_type first_id, const lib_t::id_type second_id) {
436+
const edge_type& add_edge(
437+
const gl::types::id_type first_id, const gl::types::id_type second_id
438+
) {
434439
return sut.add_edge(
435-
lib::detail::make_edge<edge_type>(vertices[first_id], vertices[second_id])
440+
gl::detail::make_edge<edge_type>(vertices[first_id], vertices[second_id])
436441
);
437442
}
438443

439-
void fully_connect_vertex(const lib_t::id_type first_id, const bool no_loops = true) {
444+
void fully_connect_vertex(const gl::types::id_type first_id, const bool no_loops = true) {
440445
for (const auto second_id : constants::vertex_id_view) {
441446
if (second_id == first_id and no_loops)
442447
continue;
@@ -461,7 +466,7 @@ struct test_undirected_adjacency_list {
461466
sut_type sut{constants::n_elements};
462467
std::vector<vertex_type> vertices;
463468

464-
const lib_t::size_type n_unique_edges_in_full_graph =
469+
const gl::types::size_type n_unique_edges_in_full_graph =
465470
(n_incident_edges_for_fully_connected_vertex * constants::n_elements) / 2;
466471
};
467472

@@ -605,7 +610,7 @@ TEST_CASE_FIXTURE(
605610
test_undirected_adjacency_list,
606611
"get_edges(id, id) should return a valid edge view if the given vertices are connected"
607612
) {
608-
std::vector<lib_t::const_ref_wrap<edge_type>> expected_edges;
613+
std::vector<gl::types::const_ref_wrap<edge_type>> expected_edges;
609614
for (auto _ = constants::first_element_idx; _ < constants::n_elements; _++)
610615
expected_edges.push_back(std::cref(add_edge(constants::vertex_id_1, constants::vertex_id_2))
611616
);
@@ -702,7 +707,7 @@ TEST_CASE_FIXTURE(
702707
) {
703708
init_complete_graph();
704709

705-
std::function<lib_t::size_type(const lib_t::id_type)> deg_proj;
710+
std::function<gl::types::size_type(const gl::types::id_type)> deg_proj;
706711

707712
SUBCASE("degree") {
708713
deg_proj = [this](const auto vertex_id) { return sut.degree(vertex_id); };
@@ -740,7 +745,7 @@ TEST_CASE_FIXTURE(
740745
init_complete_graph(false);
741746
const auto expected_deg = constants::n_elements + 1;
742747

743-
std::vector<lib_t::id_type> degree_map;
748+
std::vector<gl::types::id_type> degree_map;
744749

745750
SUBCASE("in_degree") {
746751
degree_map = sut.in_degree_map();

0 commit comments

Comments
 (0)