Skip to content

Commit 82f623f

Browse files
committed
test_subgraphs verifies (keyword) subgraphs parse
1 parent ad11d2e commit 82f623f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/graphviz_test.cpp

+22
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,27 @@ void test_basic_csr_directed_graph_ext_props()
447447
edge_weight);
448448
}
449449

450+
void test_subgraphs() {
451+
// on the BGL side, the new parser doesn't support subgraphs
452+
// however, the docs promise to support reading them on the input side as "syntactic sugar".
453+
for (auto gv : {
454+
Fixture { "digraph {}" },
455+
Fixture { "digraph { 1 -> {} }", 1 },
456+
Fixture { "digraph { 1 -> {2} }", 2 },
457+
Fixture { "digraph { 1; { 2; 3; } }", 3 },
458+
Fixture { "digraph { { 2; 3; } 1; }", 3 },
459+
Fixture { "digraph { 1; subgraph { 2; 3; } }", 3 },
460+
Fixture { "digraph { 1 -> subgraph { 2; 3; } }", 3 },
461+
Fixture { "digraph { 1 -> subgraph hello { 2; 3; } }", 3 },
462+
Fixture { "digraph { 1 -> subgraph clust_Hello { 2; 3; } }", 3 },
463+
Fixture { "digraph { 1 -> subgraph \"hello\" { 2; 3; } }", 3 },
464+
Fixture { "digraph { {2} -> subgraph \"hello\" {{{{{{{{{{{{{{{{{{{{{{{{ 2; 3; }}}}}}}}}}}}}}}}}}}}}}}} }", 2 },
465+
})
466+
{
467+
TEST_GRAPH(Models::DiGraph, gv);
468+
}
469+
}
470+
450471
int main()
451472
{
452473
test_basic_directed_graph_1();
@@ -464,5 +485,6 @@ int main()
464485
test_comments_embedded_in_strings();
465486
test_basic_csr_directed_graph_ext_props();
466487
test_basic_csr_directed_graph();
488+
test_subgraphs();
467489
return boost::report_errors();
468490
}

0 commit comments

Comments
 (0)