test/path_test.cc
author Alpar Juttner <alpar@cs.elte.hu>
Sat, 20 Mar 2010 11:03:12 +0100
changeset 1211 1bafdbd2fc46
parent 463 88ed40ad0d4f
child 1212 15d7c5eadaca
permissions -rw-r--r--
More tests for radixSort() (#362)
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@463
     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@1144
    41
// Check if proper copy consructor is called (use valgrind for testing)
alpar@1144
    42
template<class _Path>
alpar@1144
    43
void checkCopy()
alpar@1144
    44
{
alpar@1144
    45
  ListDigraph g;
alpar@1144
    46
  ListDigraph::Arc a  = g.addArc(g.addNode(), g.addNode());
alpar@1144
    47
  
alpar@1144
    48
  _Path p,q;
alpar@1144
    49
  p.addBack(a);
alpar@1144
    50
  q=p;
alpar@1144
    51
  _Path r(p);
alpar@1144
    52
  StaticPath<ListDigraph> s(r);
alpar@1144
    53
}
alpar@1144
    54
  
alpar@96
    55
int main() {
alpar@209
    56
  check_concepts();
alpar@1144
    57
alpar@1144
    58
  checkCopy<Path<ListDigraph> >();
alpar@1144
    59
  checkCopy<SimplePath<ListDigraph> >();
alpar@1144
    60
  checkCopy<ListPath<ListDigraph> >();
alpar@1144
    61
alpar@1144
    62
  ListDigraph g;
alpar@1144
    63
  ListDigraph::Arc a  = g.addArc(g.addNode(), g.addNode());
alpar@1144
    64
  
alpar@1144
    65
  Path<ListDigraph> p;
alpar@1144
    66
  StaticPath<ListDigraph> q,r;
alpar@1144
    67
  p.addBack(a);
alpar@1144
    68
  q=p;
alpar@1144
    69
  r=q;
alpar@1144
    70
  StaticPath<ListDigraph> s(q);
alpar@1144
    71
alpar@96
    72
  return 0;
alpar@96
    73
}