diff --git a/test/digraph_test.cc b/test/digraph_test.cc --- a/test/digraph_test.cc +++ b/test/digraph_test.cc @@ -16,26 +16,21 @@ * */ -#include -#include - #include #include -//#include +#include //#include //#include #include "test_tools.h" -#include "digraph_test.h" -#include "map_test.h" - +#include "graph_test.h" +#include "graph_maps_test.h" using namespace lemon; using namespace lemon::concepts; - -int main() { - { // checking digraph components +void check_concepts() { + { // Checking digraph components checkConcept(); checkConcept, @@ -46,37 +41,104 @@ checkConcept, MappableDigraphComponent<> >(); - } - { // checking skeleton digraphs + { // Checking skeleton digraph checkConcept(); } - { // checking list digraph - checkConcept(); + { // Checking ListDigraph + checkConcept(); checkConcept, ListDigraph>(); checkConcept, ListDigraph>(); checkConcept, ListDigraph>(); checkConcept, ListDigraph>(); + checkDigraphIterators(); + } + { // Checking SmartDigraph + checkConcept(); + checkConcept, SmartDigraph>(); + checkConcept, SmartDigraph>(); + checkConcept, SmartDigraph>(); + checkDigraphIterators(); + } +// { // Checking FullDigraph +// checkConcept(); +// checkDigraphIterators(); +// } +// { // Checking HyperCubeDigraph +// checkConcept(); +// checkDigraphIterators(); +// } +} +template +void check_graph_validity() { + TEMPLATE_DIGRAPH_TYPEDEFS(Digraph); + Digraph g; + + Node + n1 = g.addNode(), + n2 = g.addNode(), + n3 = g.addNode(); + + Arc + e1 = g.addArc(n1, n2), + e2 = g.addArc(n2, n3); + + check(g.valid(n1), "Wrong validity check"); + check(g.valid(e1), "Wrong validity check"); + + check(!g.valid(g.nodeFromId(-1)), "Wrong validity check"); + check(!g.valid(g.arcFromId(-1)), "Wrong validity check"); +} + +template +void check_graph_validity_erase() { + TEMPLATE_DIGRAPH_TYPEDEFS(Digraph); + Digraph g; + + Node + n1 = g.addNode(), + n2 = g.addNode(), + n3 = g.addNode(); + + Arc + e1 = g.addArc(n1, n2), + e2 = g.addArc(n2, n3); + + check(g.valid(n1), "Wrong validity check"); + check(g.valid(e1), "Wrong validity check"); + + g.erase(n1); + + check(!g.valid(n1), "Wrong validity check"); + check(g.valid(n2), "Wrong validity check"); + check(g.valid(n3), "Wrong validity check"); + check(!g.valid(e1), "Wrong validity check"); + check(g.valid(e2), "Wrong validity check"); + + check(!g.valid(g.nodeFromId(-1)), "Wrong validity check"); + check(!g.valid(g.arcFromId(-1)), "Wrong validity check"); +} + +void check_digraphs() { + { // Checking ListDigraph checkDigraph(); checkGraphNodeMap(); checkGraphArcMap(); + + check_graph_validity_erase(); } -// { // checking smart digraph -// checkConcept(); + { // Checking SmartDigraph + checkDigraph(); + checkGraphNodeMap(); + checkGraphArcMap(); -// checkDigraph(); -// checkDigraphNodeMap(); -// checkDigraphArcMap(); -// } -// { // checking full digraph -// checkConcept(); -// } -// { // checking full digraph -// checkConcept(); -// } + check_graph_validity(); + } +} - std::cout << __FILE__ ": All tests passed.\n"; - +int main() { + check_concepts(); + check_digraphs(); return 0; }