# Ticket #293: adap-test-simplify-c35afa9e89e7.patch

File adap-test-simplify-c35afa9e89e7.patch, 5.5 KB (added by Peter Kovacs, 15 years ago)
• ## test/adaptors_test.cc

```# HG changeset patch
# User Peter Kovacs <kpeter@inf.elte.hu>
# Date 1231798299 -3600
# Node ID c35afa9e89e78a559f59aa1a5cc71f317561b1c1
# Parent  04c0631fd33241997b26542eec78715709d11003
Slightly simplify adaptors_test.cc

diff --git a/test/adaptors_test.cc b/test/adaptors_test.cc```
 a GridGraph::Node n4 = graph(1,1); GridGraph::EdgeMap dir_map(graph); dir_map[graph.right(n1)] = graph.u(graph.right(n1)) == n1; dir_map[graph.up(n1)] = graph.u(graph.up(n1)) != n1; dir_map[graph.left(n4)] = graph.u(graph.left(n4)) != n4; dir_map[graph.down(n4)] = graph.u(graph.down(n4)) != n4; dir_map[graph.right(n1)] = graph.u(graph.right(n1)) != n1; dir_map[graph.up(n1)] = graph.u(graph.up(n1)) == n1; dir_map[graph.left(n4)] = graph.u(graph.left(n4)) == n4; dir_map[graph.down(n4)] = graph.u(graph.down(n4)) == n4; // Apply several adaptors on the grid graph typedef SplitNodes< ReverseDigraph< const Orienter< const GridGraph, GridGraph::EdgeMap > > > RevSplitGridGraph; typedef ReverseDigraph SplitGridGraph; typedef SplitNodes > > SplitGridGraph; typedef Undirector USplitGridGraph; typedef Undirector UUSplitGridGraph; checkConcept(); checkConcept(); checkConcept(); checkConcept(); RevSplitGridGraph rev_adaptor = splitNodes(reverseDigraph(orienter(graph, dir_map))); SplitGridGraph adaptor = reverseDigraph(rev_adaptor); SplitGridGraph adaptor = splitNodes(orienter(graph, dir_map)); USplitGridGraph uadaptor = undirector(adaptor); UUSplitGridGraph uuadaptor = undirector(uadaptor); // Check adaptor checkGraphNodeList(adaptor, 8); checkGraphArcList(adaptor, 8); checkGraphConArcList(adaptor, 8); checkGraphOutArcList(adaptor, rev_adaptor.inNode(n1), 1); checkGraphOutArcList(adaptor, rev_adaptor.outNode(n1), 1); checkGraphOutArcList(adaptor, rev_adaptor.inNode(n2), 2); checkGraphOutArcList(adaptor, rev_adaptor.outNode(n2), 1); checkGraphOutArcList(adaptor, rev_adaptor.inNode(n3), 1); checkGraphOutArcList(adaptor, rev_adaptor.outNode(n3), 1); checkGraphOutArcList(adaptor, rev_adaptor.inNode(n4), 0); checkGraphOutArcList(adaptor, rev_adaptor.outNode(n4), 1); checkGraphOutArcList(adaptor, adaptor.inNode(n1), 1); checkGraphOutArcList(adaptor, adaptor.outNode(n1), 1); checkGraphOutArcList(adaptor, adaptor.inNode(n2), 1); checkGraphOutArcList(adaptor, adaptor.outNode(n2), 0); checkGraphOutArcList(adaptor, adaptor.inNode(n3), 1); checkGraphOutArcList(adaptor, adaptor.outNode(n3), 1); checkGraphOutArcList(adaptor, adaptor.inNode(n4), 1); checkGraphOutArcList(adaptor, adaptor.outNode(n4), 2); checkGraphInArcList(adaptor, rev_adaptor.inNode(n1), 1); checkGraphInArcList(adaptor, rev_adaptor.outNode(n1), 1); checkGraphInArcList(adaptor, rev_adaptor.inNode(n2), 1); checkGraphInArcList(adaptor, rev_adaptor.outNode(n2), 0); checkGraphInArcList(adaptor, rev_adaptor.inNode(n3), 1); checkGraphInArcList(adaptor, rev_adaptor.outNode(n3), 1); checkGraphInArcList(adaptor, rev_adaptor.inNode(n4), 1); checkGraphInArcList(adaptor, rev_adaptor.outNode(n4), 2); checkGraphInArcList(adaptor, adaptor.inNode(n1), 1); checkGraphInArcList(adaptor, adaptor.outNode(n1), 1); checkGraphInArcList(adaptor, adaptor.inNode(n2), 2); checkGraphInArcList(adaptor, adaptor.outNode(n2), 1); checkGraphInArcList(adaptor, adaptor.inNode(n3), 1); checkGraphInArcList(adaptor, adaptor.outNode(n3), 1); checkGraphInArcList(adaptor, adaptor.inNode(n4), 0); checkGraphInArcList(adaptor, adaptor.outNode(n4), 1); checkNodeIds(adaptor); checkArcIds(adaptor); checkGraphEdgeMap(uadaptor); checkGraphArcMap(uadaptor); checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.inNode(n1), 2); checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.outNode(n1), 2); checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.inNode(n2), 3); checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.outNode(n2), 1); checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.inNode(n3), 2); checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.outNode(n3), 2); checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.inNode(n4), 1); checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.outNode(n4), 3); // Check uuadaptor checkGraphNodeList(uuadaptor, 8); checkGraphEdgeList(uuadaptor, 16); checkGraphArcList(uuadaptor, 32); checkGraphConEdgeList(uuadaptor, 16); checkGraphConArcList(uuadaptor, 32); checkNodeIds(uuadaptor); checkEdgeIds(uuadaptor); checkArcIds(uuadaptor); checkGraphNodeMap(uuadaptor); checkGraphEdgeMap(uuadaptor); checkGraphArcMap(uuadaptor); checkGraphIncEdgeArcLists(uadaptor, adaptor.inNode(n1), 2); checkGraphIncEdgeArcLists(uadaptor, adaptor.outNode(n1), 2); checkGraphIncEdgeArcLists(uadaptor, adaptor.inNode(n2), 3); checkGraphIncEdgeArcLists(uadaptor, adaptor.outNode(n2), 1); checkGraphIncEdgeArcLists(uadaptor, adaptor.inNode(n3), 2); checkGraphIncEdgeArcLists(uadaptor, adaptor.outNode(n3), 2); checkGraphIncEdgeArcLists(uadaptor, adaptor.inNode(n4), 1); checkGraphIncEdgeArcLists(uadaptor, adaptor.outNode(n4), 3); } int main(int, const char **) {