|
|
@@ -4,7 +4,7 @@
|
|
|
#include <entt/graph/adjacency_matrix.hpp>
|
|
|
#include <entt/graph/dot.hpp>
|
|
|
|
|
|
-TEST(Dot, DefaultWriter) {
|
|
|
+TEST(Dot, DirectedGraph) {
|
|
|
std::ostringstream output{};
|
|
|
entt::adjacency_matrix<entt::directed_tag> adjacency_matrix{3u};
|
|
|
|
|
|
@@ -21,6 +21,23 @@ TEST(Dot, DefaultWriter) {
|
|
|
ASSERT_EQ(str, expected);
|
|
|
}
|
|
|
|
|
|
+TEST(Dot, UndirectedGraph) {
|
|
|
+ std::ostringstream output{};
|
|
|
+ entt::adjacency_matrix<entt::undirected_tag> adjacency_matrix{3u};
|
|
|
+
|
|
|
+ adjacency_matrix.insert(0u, 1u);
|
|
|
+ adjacency_matrix.insert(1u, 2u);
|
|
|
+ adjacency_matrix.insert(0u, 2u);
|
|
|
+
|
|
|
+ entt::dot(output, adjacency_matrix);
|
|
|
+
|
|
|
+ const std::string expected = "graph{0[];1[];2[];0--1;0--2;1--0;1--2;2--0;2--1;}";
|
|
|
+ const auto str = output.str();
|
|
|
+
|
|
|
+ ASSERT_FALSE(str.empty());
|
|
|
+ ASSERT_EQ(str, expected);
|
|
|
+}
|
|
|
+
|
|
|
TEST(Dot, CustomWriter) {
|
|
|
std::ostringstream output{};
|
|
|
entt::adjacency_matrix<entt::directed_tag> adjacency_matrix{3u};
|