test/path_test.cc
author Alpar Juttner <alpar@cs.elte.hu>
Wed, 28 Nov 2012 12:02:36 +0100
branch1.2
changeset 972 1fe3b4ad8caa
parent 440 88ed40ad0d4f
permissions -rw-r--r--
Merge bugfix #453 to branch 1.2
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@957
    41
// Check if proper copy consructor is called (use valgrind for testing)
alpar@957
    42
template<class _Path>
alpar@957
    43
void checkCopy()
alpar@957
    44
{
alpar@957
    45
  ListDigraph g;
alpar@957
    46
  ListDigraph::Arc a  = g.addArc(g.addNode(), g.addNode());
alpar@957
    47
  
alpar@957
    48
  _Path p,q;
alpar@957
    49
  p.addBack(a);
alpar@957
    50
  q=p;
alpar@957
    51
  _Path r(p);
alpar@957
    52
  StaticPath<ListDigraph> s(r);
alpar@957
    53
}
alpar@957
    54
  
alpar@96
    55
int main() {
alpar@209
    56
  check_concepts();
alpar@957
    57
alpar@957
    58
  checkCopy<Path<ListDigraph> >();
alpar@957
    59
  checkCopy<SimplePath<ListDigraph> >();
alpar@957
    60
  checkCopy<ListPath<ListDigraph> >();
alpar@957
    61
alpar@957
    62
  ListDigraph g;
alpar@957
    63
  ListDigraph::Arc a  = g.addArc(g.addNode(), g.addNode());
alpar@957
    64
  
alpar@957
    65
  Path<ListDigraph> p;
alpar@957
    66
  StaticPath<ListDigraph> q,r;
alpar@957
    67
  p.addBack(a);
alpar@957
    68
  q=p;
alpar@957
    69
  r=q;
alpar@957
    70
  StaticPath<ListDigraph> s(q);
alpar@957
    71
alpar@96
    72
  return 0;
alpar@96
    73
}