test/path_test.cc
author Alpar Juttner <alpar@cs.elte.hu>
Tue, 06 Aug 2013 12:04:13 +0200
changeset 805 115031ac8001
parent 440 88ed40ad0d4f
permissions -rw-r--r--
Further fixes for gcc version 3.3 and 4.3 (#470)
alpar@209
     1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
alpar@96
     2
 *
alpar@209
     3
 * This file is a part of LEMON, a generic C++ optimization library.
alpar@96
     4
 *
alpar@440
     5
 * Copyright (C) 2003-2009
alpar@96
     6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
alpar@96
     7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
alpar@96
     8
 *
alpar@96
     9
 * Permission to use, modify and distribute this software is granted
alpar@96
    10
 * provided that this copyright notice appears in all copies. For
alpar@96
    11
 * precise terms see the accompanying LICENSE file.
alpar@96
    12
 *
alpar@96
    13
 * This software is provided "AS IS" with no warranty of any kind,
alpar@96
    14
 * express or implied, and with no claim as to its suitability for any
alpar@96
    15
 * purpose.
alpar@96
    16
 *
alpar@96
    17
 */
alpar@96
    18
alpar@96
    19
#include <string>
alpar@96
    20
#include <iostream>
alpar@96
    21
alpar@96
    22
#include <lemon/concepts/path.h>
alpar@96
    23
#include <lemon/concepts/digraph.h>
alpar@96
    24
alpar@96
    25
#include <lemon/path.h>
alpar@96
    26
#include <lemon/list_graph.h>
alpar@96
    27
alpar@96
    28
#include "test_tools.h"
alpar@96
    29
alpar@96
    30
using namespace std;
alpar@96
    31
using namespace lemon;
alpar@96
    32
alpar@96
    33
void check_concepts() {
alpar@96
    34
  checkConcept<concepts::Path<ListDigraph>, concepts::Path<ListDigraph> >();
alpar@96
    35
  checkConcept<concepts::Path<ListDigraph>, Path<ListDigraph> >();
alpar@96
    36
  checkConcept<concepts::Path<ListDigraph>, SimplePath<ListDigraph> >();
alpar@96
    37
  checkConcept<concepts::Path<ListDigraph>, StaticPath<ListDigraph> >();
alpar@96
    38
  checkConcept<concepts::Path<ListDigraph>, ListPath<ListDigraph> >();
alpar@96
    39
}
alpar@96
    40
alpar@787
    41
// Check if proper copy consructor is called (use valgrind for testing)
alpar@787
    42
template<class _Path>
alpar@787
    43
void checkCopy()
alpar@787
    44
{
alpar@787
    45
  ListDigraph g;
alpar@787
    46
  ListDigraph::Arc a  = g.addArc(g.addNode(), g.addNode());
alpar@787
    47
  
alpar@787
    48
  _Path p,q;
alpar@787
    49
  p.addBack(a);
alpar@787
    50
  q=p;
alpar@787
    51
  _Path r(p);
alpar@787
    52
  StaticPath<ListDigraph> s(r);
alpar@787
    53
}
alpar@787
    54
  
alpar@96
    55
int main() {
alpar@209
    56
  check_concepts();
alpar@787
    57
alpar@787
    58
  checkCopy<Path<ListDigraph> >();
alpar@787
    59
  checkCopy<SimplePath<ListDigraph> >();
alpar@787
    60
  checkCopy<ListPath<ListDigraph> >();
alpar@787
    61
alpar@787
    62
  ListDigraph g;
alpar@787
    63
  ListDigraph::Arc a  = g.addArc(g.addNode(), g.addNode());
alpar@787
    64
  
alpar@787
    65
  Path<ListDigraph> p;
alpar@787
    66
  StaticPath<ListDigraph> q,r;
alpar@787
    67
  p.addBack(a);
alpar@787
    68
  q=p;
alpar@787
    69
  r=q;
alpar@787
    70
  StaticPath<ListDigraph> s(q);
alpar@787
    71
alpar@96
    72
  return 0;
alpar@96
    73
}