11using Test
22using ParserCombinator
33using GraphIO. DOT
4+ using LightGraphs. Experimental
45
56@testset " DOT" begin
67 g = CompleteGraph (6 )
@@ -12,4 +13,35 @@ using GraphIO.DOT
1213 read_test (DOTFormat (), g, " g1" , fname, testfail= true )
1314 read_test (DOTFormat (), dg, " g2" , fname)
1415 read_test_mult (DOTFormat (), Dict {String,AbstractGraph} (" g1" => g, " g2" => dg), fname)
16+
17+ # tests for multiple graphs
18+
19+ fname = joinpath (testdir, " testdata" , " saved3graphs.dot" )
20+ # connected graph
21+ g1 = SimpleGraph (5 ,10 )
22+ # disconnected graph
23+ g2 = SimpleGraph (5 ,2 )
24+ # directed graph
25+ dg = SimpleDiGraph (5 ,8 )
26+ GraphDict = Dict (" g1" => g1, " g2" => g2, " dg" => dg)
27+ write_test (DOTFormat (), GraphDict, fname, remove = false , silent = true )
28+
29+ # adding this test because currently the Parser returns unordered vertices
30+ @test has_isomorph (loadgraph (fname, " g1" , DOTFormat ()), g1)
31+ @test has_isomorph (loadgraph (fname, " g2" , DOTFormat ()), g2)
32+ @test has_isomorph (loadgraph (fname, " dg" , DOTFormat ()), dg)
33+
34+ rm (fname)
35+
36+ # tests for single graph
37+
38+ fname1 = joinpath (testdir, " testdata" , " saved1graph.dot" )
39+ write_test (DOTFormat (), g1, " g1" , fname1, remove = false , silent = true )
40+ @test has_isomorph (loadgraph (fname1, " g1" , DOTFormat ()), g1)
41+ fname2 = joinpath (testdir, " testdata" , " saved1digraph.dot" )
42+ write_test (DOTFormat (), dg, " dg" , fname2, remove = false , silent = true )
43+ @test has_isomorph (loadgraph (fname2, " dg" , DOTFormat ()), dg)
44+
45+ rm (fname1)
46+ rm (fname2)
1547end
0 commit comments