diff -r d8475431bbbb -r 8e85e6bbefdf src/test/sym_graph_test.h --- a/src/test/sym_graph_test.h Sat May 21 21:04:57 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,183 +0,0 @@ -/* -*- C++ -*- - * src/test/sym_graph_test.h - Part of LEMON, a generic C++ optimization library - * - * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport - * (Egervary Research Group on Combinatorial Optimization, EGRES). - * - * Permission to use, modify and distribute this software is granted - * provided that this copyright notice appears in all copies. For - * precise terms see the accompanying LICENSE file. - * - * This software is provided "AS IS" with no warranty of any kind, - * express or implied, and with no claim as to its suitability for any - * purpose. - * - */ -#ifndef LEMON_TEST_SYM_GRAPH_TEST_H -#define LEMON_TEST_SYM_GRAPH_TEST_H - - -#include "graph_test.h" -#include "test_tools.h" - -//! \ingroup misc -//! \file -//! \brief Some utility to test symmetric graph classes. -namespace lemon { - - /// \e - - /// \todo This should go to lemon/concept/symgraph.h - /// - template void checkCompileStaticSymGraph(Graph &G) - { - typedef typename Graph::Node Node; - typedef typename Graph::NodeIt NodeIt; - typedef typename Graph::SymEdge SymEdge; - typedef typename Graph::SymEdgeIt SymEdgeIt; - typedef typename Graph::Edge Edge; - typedef typename Graph::EdgeIt EdgeIt; - typedef typename Graph::InEdgeIt InEdgeIt; - typedef typename Graph::OutEdgeIt OutEdgeIt; - - lemon::concept::checkCompileStaticGraph(G); - - { - SymEdge i; SymEdge j(i); SymEdge k(INVALID); - i=j; - bool b; b=true; - b=(i==INVALID); b=(i!=INVALID); - b=(i==j); b=(i!=j); b=(iSymEdgeIt conversion - SymEdgeIt ni(G,n); - } - { - Edge i, j; - j = G.opposite(i); - } - { - Node n; - SymEdge se; - se=INVALID; - n=G.source(se); - n=G.target(se); - } - // id tests - { SymEdge n; int i=G.id(n); i=i; } - //SymEdgeMap tests - { - SymEdge k; - typename Graph::template SymEdgeMap m(G); - typename Graph::template SymEdgeMap const &cm = m; //Const map - //Inicialize with default value - typename Graph::template SymEdgeMap mdef(G,12); - typename Graph::template SymEdgeMap mm(cm); //Copy - typename Graph::template SymEdgeMap dm(cm); //Copy from another type - int v; - v=m[k]; m[k]=v; m.set(k,v); - v=cm[k]; - - m=cm; - dm=cm; //Copy from another type - { - //Check the typedef's - typename Graph::template SymEdgeMap::Value val; - val = 1; - typename Graph::template SymEdgeMap::Key key; - key = typename Graph::SymEdgeIt(G); - } - } - { //bool SymEdgeMap - SymEdge k; - typename Graph::template SymEdgeMap m(G); - typename Graph::template SymEdgeMap const &cm = m; //Const map - //Inicialize with default value - typename Graph::template SymEdgeMap mdef(G,12); - typename Graph::template SymEdgeMap mm(cm); //Copy - typename Graph::template SymEdgeMap dm(cm); //Copy from another type - bool v; - v=m[k]; m[k]=v; m.set(k,v); - v=cm[k]; - - m=cm; - dm=cm; //Copy from another type - m=dm; //Copy to another type - { - //Check the typedef's - typename Graph::template SymEdgeMap::Value val; - val=true; - typename Graph::template SymEdgeMap::Key key; - key= typename Graph::SymEdgeIt(G); - } - } - } - - template void checkCompileSymGraph(Graph &G) - { - checkCompileStaticSymGraph(G); - - typedef typename Graph::Node Node; - typedef typename Graph::NodeIt NodeIt; - typedef typename Graph::SymEdge SymEdge; - typedef typename Graph::SymEdgeIt SymEdgeIt; - typedef typename Graph::Edge Edge; - typedef typename Graph::EdgeIt EdgeIt; - typedef typename Graph::InEdgeIt InEdgeIt; - typedef typename Graph::OutEdgeIt OutEdgeIt; - - Node n,m; - n=G.addNode(); - m=G.addNode(); - SymEdge e; - e = G.addEdge(n,m); - - // G.clear(); - } - - template void checkCompileSymGraphEraseSymEdge(Graph &G) - { - typename Graph::SymEdge n; - G.erase(n); - } - - template void checkCompileErasableSymGraph(Graph &G) - { - checkCompileSymGraph(G); - lemon::concept::checkCompileGraphEraseNode(G); - checkCompileSymGraphEraseSymEdge(G); - } - - template void checkGraphSymEdgeList(Graph &G, int nn) - { - typedef typename Graph::SymEdgeIt SymEdgeIt; - - SymEdgeIt e(G); - for(int i=0;i