1 #include <UnitTest++.h>
5 #include "../src/ToGraphvizWriter.h"
7 // these test always pass, unless exceptions occur
9 SUITE(ArticleToGraphvizWriterTests
)
11 TEST(WriteArticleWithMultipleLinks
)
13 std::ofstream
outfile("_artlinks.dot", std::ofstream::out
| std::ofstream::trunc
);
16 a
.addLink(new Article("Animal"));
17 a
.addLink(new Article("Pig"));
18 a
.addLink(new Article("Equality"));
19 atj
.output(&a
, outfile
);
24 TEST(WriteArticleCollectionDepthOne
)
26 std::ofstream
outfile("_artctree.dot", std::ofstream::out
| std::ofstream::trunc
);
30 auto farm
= new Article("Farm");
33 auto animal
= new Article("Animal");
34 farm
->addLink(animal
);
37 auto pig
= new Article("Pig");
41 auto equa
= new Article("Equality");
45 atj
.output(ac
, outfile
);
50 TEST(WriteArticleCollectionDepthOne_WithInterlinks
)
52 std::ofstream
outfile("_artctree_interlink.dot",
53 std::ofstream::out
| std::ofstream::trunc
);
57 auto farm
= new Article("Farm");
60 auto animal
= new Article("Animal");
61 farm
->addLink(animal
);
64 auto pig
= new Article("Pig");
72 auto equa
= new Article("Equality");
76 atj
.output(ac
, outfile
);
81 TEST(WriteArticleCollectionDepthTwo
)
83 std::ofstream
outfile("_artc_deeptree.dot", std::ofstream::out
| std::ofstream::trunc
);
87 auto farm
= new Article("Farm");
90 auto animal
= new Article("Animal");
91 farm
->addLink(animal
);
94 auto pig
= new Article("Pig");
98 auto equa
= new Article("Equality");
102 auto rights
= new Article("Rights");
103 equa
->addLink(rights
);
106 auto cat
= new Article("Cat");
108 animal
->addLink(cat
);
109 auto dog
= new Article("Dog");
111 animal
->addLink(dog
);
113 atj
.output(ac
, outfile
);