gravatar
kpeter (Peter Kovacs)
kpeter@inf.elte.hu
Slightly simplify adaptors_test.cc
0 1 0
default
1 file changed with 31 insertions and 54 deletions:
↑ Collapse diff ↑
Ignore white space 24 line context
... ...
@@ -1362,114 +1362,91 @@
1362 1362
  aa = e2;
1363 1363
}
1364 1364

	
1365 1365
void checkCombiningAdaptors() {
1366 1366
  // Create a grid graph
1367 1367
  GridGraph graph(2,2);
1368 1368
  GridGraph::Node n1 = graph(0,0);
1369 1369
  GridGraph::Node n2 = graph(0,1);
1370 1370
  GridGraph::Node n3 = graph(1,0);
1371 1371
  GridGraph::Node n4 = graph(1,1);
1372 1372

	
1373 1373
  GridGraph::EdgeMap<bool> dir_map(graph);
1374
  dir_map[graph.right(n1)] = graph.u(graph.right(n1)) == n1;
1375
  dir_map[graph.up(n1)] = graph.u(graph.up(n1)) != n1;
1376
  dir_map[graph.left(n4)] = graph.u(graph.left(n4)) != n4;
1377
  dir_map[graph.down(n4)] = graph.u(graph.down(n4)) != n4;
1374
  dir_map[graph.right(n1)] = graph.u(graph.right(n1)) != n1;
1375
  dir_map[graph.up(n1)] = graph.u(graph.up(n1)) == n1;
1376
  dir_map[graph.left(n4)] = graph.u(graph.left(n4)) == n4;
1377
  dir_map[graph.down(n4)] = graph.u(graph.down(n4)) == n4;
1378 1378

	
1379 1379
  // Apply several adaptors on the grid graph
1380
  typedef SplitNodes< ReverseDigraph< const Orienter<
1381
            const GridGraph, GridGraph::EdgeMap<bool> > > >
1382
    RevSplitGridGraph;
1383
  typedef ReverseDigraph<const RevSplitGridGraph> SplitGridGraph;
1380
  typedef SplitNodes<Orienter< const GridGraph, GridGraph::EdgeMap<bool> > >
1381
    SplitGridGraph;
1384 1382
  typedef Undirector<const SplitGridGraph> USplitGridGraph;
1385
  typedef Undirector<const USplitGridGraph> UUSplitGridGraph;
1386
  checkConcept<concepts::Digraph, RevSplitGridGraph>();
1387 1383
  checkConcept<concepts::Digraph, SplitGridGraph>();
1388 1384
  checkConcept<concepts::Graph, USplitGridGraph>();
1389
  checkConcept<concepts::Graph, UUSplitGridGraph>();
1390 1385

	
1391
  RevSplitGridGraph rev_adaptor =
1392
    splitNodes(reverseDigraph(orienter(graph, dir_map)));
1393
  SplitGridGraph adaptor = reverseDigraph(rev_adaptor);
1386
  SplitGridGraph adaptor = splitNodes(orienter(graph, dir_map));
1394 1387
  USplitGridGraph uadaptor = undirector(adaptor);
1395
  UUSplitGridGraph uuadaptor = undirector(uadaptor);
1396 1388

	
1397 1389
  // Check adaptor
1398 1390
  checkGraphNodeList(adaptor, 8);
1399 1391
  checkGraphArcList(adaptor, 8);
1400 1392
  checkGraphConArcList(adaptor, 8);
1401 1393

	
1402
  checkGraphOutArcList(adaptor, rev_adaptor.inNode(n1), 1);
1403
  checkGraphOutArcList(adaptor, rev_adaptor.outNode(n1), 1);
1404
  checkGraphOutArcList(adaptor, rev_adaptor.inNode(n2), 2);
1405
  checkGraphOutArcList(adaptor, rev_adaptor.outNode(n2), 1);
1406
  checkGraphOutArcList(adaptor, rev_adaptor.inNode(n3), 1);
1407
  checkGraphOutArcList(adaptor, rev_adaptor.outNode(n3), 1);
1408
  checkGraphOutArcList(adaptor, rev_adaptor.inNode(n4), 0);
1409
  checkGraphOutArcList(adaptor, rev_adaptor.outNode(n4), 1);
1394
  checkGraphOutArcList(adaptor, adaptor.inNode(n1), 1);
1395
  checkGraphOutArcList(adaptor, adaptor.outNode(n1), 1);
1396
  checkGraphOutArcList(adaptor, adaptor.inNode(n2), 1);
1397
  checkGraphOutArcList(adaptor, adaptor.outNode(n2), 0);
1398
  checkGraphOutArcList(adaptor, adaptor.inNode(n3), 1);
1399
  checkGraphOutArcList(adaptor, adaptor.outNode(n3), 1);
1400
  checkGraphOutArcList(adaptor, adaptor.inNode(n4), 1);
1401
  checkGraphOutArcList(adaptor, adaptor.outNode(n4), 2);
1410 1402

	
1411
  checkGraphInArcList(adaptor, rev_adaptor.inNode(n1), 1);
1412
  checkGraphInArcList(adaptor, rev_adaptor.outNode(n1), 1);
1413
  checkGraphInArcList(adaptor, rev_adaptor.inNode(n2), 1);
1414
  checkGraphInArcList(adaptor, rev_adaptor.outNode(n2), 0);
1415
  checkGraphInArcList(adaptor, rev_adaptor.inNode(n3), 1);
1416
  checkGraphInArcList(adaptor, rev_adaptor.outNode(n3), 1);
1417
  checkGraphInArcList(adaptor, rev_adaptor.inNode(n4), 1);
1418
  checkGraphInArcList(adaptor, rev_adaptor.outNode(n4), 2);
1403
  checkGraphInArcList(adaptor, adaptor.inNode(n1), 1);
1404
  checkGraphInArcList(adaptor, adaptor.outNode(n1), 1);
1405
  checkGraphInArcList(adaptor, adaptor.inNode(n2), 2);
1406
  checkGraphInArcList(adaptor, adaptor.outNode(n2), 1);
1407
  checkGraphInArcList(adaptor, adaptor.inNode(n3), 1);
1408
  checkGraphInArcList(adaptor, adaptor.outNode(n3), 1);
1409
  checkGraphInArcList(adaptor, adaptor.inNode(n4), 0);
1410
  checkGraphInArcList(adaptor, adaptor.outNode(n4), 1);
1419 1411

	
1420 1412
  checkNodeIds(adaptor);
1421 1413
  checkArcIds(adaptor);
1422 1414

	
1423 1415
  checkGraphNodeMap(adaptor);
1424 1416
  checkGraphArcMap(adaptor);
1425 1417

	
1426 1418
  // Check uadaptor
1427 1419
  checkGraphNodeList(uadaptor, 8);
1428 1420
  checkGraphEdgeList(uadaptor, 8);
1429 1421
  checkGraphArcList(uadaptor, 16);
1430 1422
  checkGraphConEdgeList(uadaptor, 8);
1431 1423
  checkGraphConArcList(uadaptor, 16);
1432 1424

	
1433 1425
  checkNodeIds(uadaptor);
1434 1426
  checkEdgeIds(uadaptor);
1435 1427
  checkArcIds(uadaptor);
1436 1428

	
1437 1429
  checkGraphNodeMap(uadaptor);
1438 1430
  checkGraphEdgeMap(uadaptor);
1439 1431
  checkGraphArcMap(uadaptor);
1440 1432

	
1441
  checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.inNode(n1), 2);
1442
  checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.outNode(n1), 2);
1443
  checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.inNode(n2), 3);
1444
  checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.outNode(n2), 1);
1445
  checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.inNode(n3), 2);
1446
  checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.outNode(n3), 2);
1447
  checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.inNode(n4), 1);
1448
  checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.outNode(n4), 3);
1449

	
1450
  // Check uuadaptor
1451
  checkGraphNodeList(uuadaptor, 8);
1452
  checkGraphEdgeList(uuadaptor, 16);
1453
  checkGraphArcList(uuadaptor, 32);
1454
  checkGraphConEdgeList(uuadaptor, 16);
1455
  checkGraphConArcList(uuadaptor, 32);
1456

	
1457
  checkNodeIds(uuadaptor);
1458
  checkEdgeIds(uuadaptor);
1459
  checkArcIds(uuadaptor);
1460

	
1461
  checkGraphNodeMap(uuadaptor);
1462
  checkGraphEdgeMap(uuadaptor);
1463
  checkGraphArcMap(uuadaptor);
1433
  checkGraphIncEdgeArcLists(uadaptor, adaptor.inNode(n1), 2);
1434
  checkGraphIncEdgeArcLists(uadaptor, adaptor.outNode(n1), 2);
1435
  checkGraphIncEdgeArcLists(uadaptor, adaptor.inNode(n2), 3);
1436
  checkGraphIncEdgeArcLists(uadaptor, adaptor.outNode(n2), 1);
1437
  checkGraphIncEdgeArcLists(uadaptor, adaptor.inNode(n3), 2);
1438
  checkGraphIncEdgeArcLists(uadaptor, adaptor.outNode(n3), 2);
1439
  checkGraphIncEdgeArcLists(uadaptor, adaptor.inNode(n4), 1);
1440
  checkGraphIncEdgeArcLists(uadaptor, adaptor.outNode(n4), 3);
1464 1441
}
1465 1442

	
1466 1443
int main(int, const char **) {
1467 1444
  // Check the digraph adaptors (using ListDigraph)
1468 1445
  checkReverseDigraph();
1469 1446
  checkSubDigraph();
1470 1447
  checkFilterNodes1();
1471 1448
  checkFilterArcs();
1472 1449
  checkUndirector();
1473 1450
  checkResidualDigraph();
1474 1451
  checkSplitNodes();
1475 1452

	
0 comments (0 inline)