|
@@ -295,6 +295,23 @@ TEST(AdjacencyMatrix, EdgesDirected) {
|
|
|
ASSERT_EQ(++it, iterable.end());
|
|
ASSERT_EQ(++it, iterable.end());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+TEST(AdjacencyMatrix, EdgesBackwardOnlyDirected) {
|
|
|
|
|
+ entt::adjacency_matrix<entt::directed_tag> adjacency_matrix{2u};
|
|
|
|
|
+ auto iterable = adjacency_matrix.edges();
|
|
|
|
|
+
|
|
|
|
|
+ ASSERT_EQ(iterable.begin(), iterable.end());
|
|
|
|
|
+
|
|
|
|
|
+ adjacency_matrix.insert(1u, 0u);
|
|
|
|
|
+ iterable = adjacency_matrix.edges();
|
|
|
|
|
+
|
|
|
|
|
+ ASSERT_NE(iterable.begin(), iterable.end());
|
|
|
|
|
+
|
|
|
|
|
+ auto it = iterable.begin();
|
|
|
|
|
+
|
|
|
|
|
+ ASSERT_EQ(*it++, std::make_pair(std::size_t{1u}, std::size_t{0u}));
|
|
|
|
|
+ ASSERT_EQ(it, iterable.end());
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
TEST(AdjacencyMatrix, EdgesUndirected) {
|
|
TEST(AdjacencyMatrix, EdgesUndirected) {
|
|
|
entt::adjacency_matrix<entt::undirected_tag> adjacency_matrix{3u};
|
|
entt::adjacency_matrix<entt::undirected_tag> adjacency_matrix{3u};
|
|
|
auto iterable = adjacency_matrix.edges();
|
|
auto iterable = adjacency_matrix.edges();
|
|
@@ -317,6 +334,24 @@ TEST(AdjacencyMatrix, EdgesUndirected) {
|
|
|
ASSERT_EQ(++it, iterable.end());
|
|
ASSERT_EQ(++it, iterable.end());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+TEST(AdjacencyMatrix, EdgesBackwardOnlyUndirected) {
|
|
|
|
|
+ entt::adjacency_matrix<entt::undirected_tag> adjacency_matrix{2u};
|
|
|
|
|
+ auto iterable = adjacency_matrix.edges();
|
|
|
|
|
+
|
|
|
|
|
+ ASSERT_EQ(iterable.begin(), iterable.end());
|
|
|
|
|
+
|
|
|
|
|
+ adjacency_matrix.insert(1u, 0u);
|
|
|
|
|
+ iterable = adjacency_matrix.edges();
|
|
|
|
|
+
|
|
|
|
|
+ ASSERT_NE(iterable.begin(), iterable.end());
|
|
|
|
|
+
|
|
|
|
|
+ auto it = iterable.begin();
|
|
|
|
|
+
|
|
|
|
|
+ ASSERT_EQ(*it++, std::make_pair(std::size_t{0u}, std::size_t{1u}));
|
|
|
|
|
+ ASSERT_EQ(*it++, std::make_pair(std::size_t{1u}, std::size_t{0u}));
|
|
|
|
|
+ ASSERT_EQ(it, iterable.end());
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
TEST(AdjacencyMatrix, OutEdgesDirected) {
|
|
TEST(AdjacencyMatrix, OutEdgesDirected) {
|
|
|
entt::adjacency_matrix<entt::directed_tag> adjacency_matrix{3u};
|
|
entt::adjacency_matrix<entt::directed_tag> adjacency_matrix{3u};
|
|
|
auto iterable = adjacency_matrix.out_edges(0u);
|
|
auto iterable = adjacency_matrix.out_edges(0u);
|
|
@@ -340,6 +375,28 @@ TEST(AdjacencyMatrix, OutEdgesDirected) {
|
|
|
ASSERT_EQ(it, iterable.cend());
|
|
ASSERT_EQ(it, iterable.cend());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+TEST(AdjacencyMatrix, OutEdgesBackwardOnlyDirected) {
|
|
|
|
|
+ entt::adjacency_matrix<entt::directed_tag> adjacency_matrix{2u};
|
|
|
|
|
+ auto iterable = adjacency_matrix.out_edges(1u);
|
|
|
|
|
+
|
|
|
|
|
+ ASSERT_EQ(iterable.begin(), iterable.end());
|
|
|
|
|
+
|
|
|
|
|
+ adjacency_matrix.insert(1u, 0u);
|
|
|
|
|
+ iterable = adjacency_matrix.out_edges(1u);
|
|
|
|
|
+
|
|
|
|
|
+ ASSERT_NE(iterable.begin(), iterable.end());
|
|
|
|
|
+
|
|
|
|
|
+ auto it = iterable.begin();
|
|
|
|
|
+
|
|
|
|
|
+ ASSERT_EQ(*it++, std::make_pair(std::size_t{1u}, std::size_t{0u}));
|
|
|
|
|
+ ASSERT_EQ(it, iterable.end());
|
|
|
|
|
+
|
|
|
|
|
+ iterable = adjacency_matrix.out_edges(0u);
|
|
|
|
|
+ it = iterable.cbegin();
|
|
|
|
|
+
|
|
|
|
|
+ ASSERT_EQ(it, iterable.cend());
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
TEST(AdjacencyMatrix, OutEdgesUndirected) {
|
|
TEST(AdjacencyMatrix, OutEdgesUndirected) {
|
|
|
entt::adjacency_matrix<entt::undirected_tag> adjacency_matrix{3u};
|
|
entt::adjacency_matrix<entt::undirected_tag> adjacency_matrix{3u};
|
|
|
auto iterable = adjacency_matrix.out_edges(0u);
|
|
auto iterable = adjacency_matrix.out_edges(0u);
|
|
@@ -365,6 +422,30 @@ TEST(AdjacencyMatrix, OutEdgesUndirected) {
|
|
|
ASSERT_EQ(it, iterable.cend());
|
|
ASSERT_EQ(it, iterable.cend());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+TEST(AdjacencyMatrix, OutEdgesBackwardOnlyUndirected) {
|
|
|
|
|
+ entt::adjacency_matrix<entt::undirected_tag> adjacency_matrix{2u};
|
|
|
|
|
+ auto iterable = adjacency_matrix.out_edges(1u);
|
|
|
|
|
+
|
|
|
|
|
+ ASSERT_EQ(iterable.begin(), iterable.end());
|
|
|
|
|
+
|
|
|
|
|
+ adjacency_matrix.insert(1u, 0u);
|
|
|
|
|
+ iterable = adjacency_matrix.out_edges(1u);
|
|
|
|
|
+
|
|
|
|
|
+ ASSERT_NE(iterable.begin(), iterable.end());
|
|
|
|
|
+
|
|
|
|
|
+ auto it = iterable.begin();
|
|
|
|
|
+
|
|
|
|
|
+ ASSERT_EQ(*it++, std::make_pair(std::size_t{1u}, std::size_t{0u}));
|
|
|
|
|
+ ASSERT_EQ(it, iterable.end());
|
|
|
|
|
+
|
|
|
|
|
+ iterable = adjacency_matrix.out_edges(0u);
|
|
|
|
|
+ it = iterable.cbegin();
|
|
|
|
|
+
|
|
|
|
|
+ ASSERT_NE(it, iterable.cend());
|
|
|
|
|
+ ASSERT_EQ(*it++, std::make_pair(std::size_t{0u}, std::size_t{1u}));
|
|
|
|
|
+ ASSERT_EQ(it, iterable.cend());
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
TEST(AdjacencyMatrix, InEdgesDirected) {
|
|
TEST(AdjacencyMatrix, InEdgesDirected) {
|
|
|
entt::adjacency_matrix<entt::directed_tag> adjacency_matrix{3u};
|
|
entt::adjacency_matrix<entt::directed_tag> adjacency_matrix{3u};
|
|
|
auto iterable = adjacency_matrix.in_edges(1u);
|
|
auto iterable = adjacency_matrix.in_edges(1u);
|
|
@@ -388,6 +469,28 @@ TEST(AdjacencyMatrix, InEdgesDirected) {
|
|
|
ASSERT_EQ(it, iterable.cend());
|
|
ASSERT_EQ(it, iterable.cend());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+TEST(AdjacencyMatrix, InEdgesBackwardOnlyDirected) {
|
|
|
|
|
+ entt::adjacency_matrix<entt::directed_tag> adjacency_matrix{2u};
|
|
|
|
|
+ auto iterable = adjacency_matrix.in_edges(0u);
|
|
|
|
|
+
|
|
|
|
|
+ ASSERT_EQ(iterable.begin(), iterable.end());
|
|
|
|
|
+
|
|
|
|
|
+ adjacency_matrix.insert(1u, 0u);
|
|
|
|
|
+ iterable = adjacency_matrix.in_edges(0u);
|
|
|
|
|
+
|
|
|
|
|
+ ASSERT_NE(iterable.begin(), iterable.end());
|
|
|
|
|
+
|
|
|
|
|
+ auto it = iterable.begin();
|
|
|
|
|
+
|
|
|
|
|
+ ASSERT_EQ(*it++, std::make_pair(std::size_t{1u}, std::size_t{0u}));
|
|
|
|
|
+ ASSERT_EQ(it, iterable.end());
|
|
|
|
|
+
|
|
|
|
|
+ iterable = adjacency_matrix.in_edges(1u);
|
|
|
|
|
+ it = iterable.cbegin();
|
|
|
|
|
+
|
|
|
|
|
+ ASSERT_EQ(it, iterable.cend());
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
TEST(AdjacencyMatrix, InEdgesUndirected) {
|
|
TEST(AdjacencyMatrix, InEdgesUndirected) {
|
|
|
entt::adjacency_matrix<entt::undirected_tag> adjacency_matrix{3u};
|
|
entt::adjacency_matrix<entt::undirected_tag> adjacency_matrix{3u};
|
|
|
auto iterable = adjacency_matrix.in_edges(1u);
|
|
auto iterable = adjacency_matrix.in_edges(1u);
|
|
@@ -403,6 +506,7 @@ TEST(AdjacencyMatrix, InEdgesUndirected) {
|
|
|
auto it = iterable.begin();
|
|
auto it = iterable.begin();
|
|
|
|
|
|
|
|
ASSERT_EQ(*it++, std::make_pair(std::size_t{0u}, std::size_t{1u}));
|
|
ASSERT_EQ(*it++, std::make_pair(std::size_t{0u}, std::size_t{1u}));
|
|
|
|
|
+ ASSERT_EQ(*it++, std::make_pair(std::size_t{2u}, std::size_t{1u}));
|
|
|
ASSERT_EQ(it, iterable.end());
|
|
ASSERT_EQ(it, iterable.end());
|
|
|
|
|
|
|
|
iterable = adjacency_matrix.in_edges(0u);
|
|
iterable = adjacency_matrix.in_edges(0u);
|
|
@@ -413,6 +517,30 @@ TEST(AdjacencyMatrix, InEdgesUndirected) {
|
|
|
ASSERT_EQ(it, iterable.cend());
|
|
ASSERT_EQ(it, iterable.cend());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+TEST(AdjacencyMatrix, InEdgesBackwardOnlyUndirected) {
|
|
|
|
|
+ entt::adjacency_matrix<entt::undirected_tag> adjacency_matrix{2u};
|
|
|
|
|
+ auto iterable = adjacency_matrix.in_edges(0u);
|
|
|
|
|
+
|
|
|
|
|
+ ASSERT_EQ(iterable.begin(), iterable.end());
|
|
|
|
|
+
|
|
|
|
|
+ adjacency_matrix.insert(1u, 0u);
|
|
|
|
|
+ iterable = adjacency_matrix.in_edges(0u);
|
|
|
|
|
+
|
|
|
|
|
+ ASSERT_NE(iterable.begin(), iterable.end());
|
|
|
|
|
+
|
|
|
|
|
+ auto it = iterable.begin();
|
|
|
|
|
+
|
|
|
|
|
+ ASSERT_EQ(*it++, std::make_pair(std::size_t{1u}, std::size_t{0u}));
|
|
|
|
|
+ ASSERT_EQ(it, iterable.end());
|
|
|
|
|
+
|
|
|
|
|
+ iterable = adjacency_matrix.in_edges(1u);
|
|
|
|
|
+ it = iterable.cbegin();
|
|
|
|
|
+
|
|
|
|
|
+ ASSERT_NE(it, iterable.cend());
|
|
|
|
|
+ ASSERT_EQ(*it++, std::make_pair(std::size_t{0u}, std::size_t{1u}));
|
|
|
|
|
+ ASSERT_EQ(it, iterable.cend());
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
TEST(AdjacencyMatrix, ThrowingAllocator) {
|
|
TEST(AdjacencyMatrix, ThrowingAllocator) {
|
|
|
using allocator = test::throwing_allocator<std::size_t>;
|
|
using allocator = test::throwing_allocator<std::size_t>;
|
|
|
using exception = typename allocator::exception_type;
|
|
using exception = typename allocator::exception_type;
|