test/path_test.cc
author Alpar Juttner <alpar@cs.elte.hu>
Wed, 07 Aug 2013 06:57:41 +0200
changeset 1085 a337a0dd3f75
parent 440 88ed40ad0d4f
child 1044 15d7c5eadaca
permissions -rw-r--r--
Further ignore_unused_variable_warning() explicit namespaces (#294)
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@990
    41
// Check if proper copy consructor is called (use valgrind for testing)
alpar@990
    42
template<class _Path>
alpar@990
    43
void checkCopy()
alpar@990
    44
{
alpar@990
    45
  ListDigraph g;
alpar@990
    46
  ListDigraph::Arc a  = g.addArc(g.addNode(), g.addNode());
alpar@990
    47
  
alpar@990
    48
  _Path p,q;
alpar@990
    49
  p.addBack(a);
alpar@990
    50
  q=p;
alpar@990
    51
  _Path r(p);
alpar@990
    52
  StaticPath<ListDigraph> s(r);
alpar@990
    53
}
alpar@990
    54
  
alpar@96
    55
int main() {
alpar@209
    56
  check_concepts();
alpar@990
    57
alpar@990
    58
  checkCopy<Path<ListDigraph> >();
alpar@990
    59
  checkCopy<SimplePath<ListDigraph> >();
alpar@990
    60
  checkCopy<ListPath<ListDigraph> >();
alpar@990
    61
alpar@990
    62
  ListDigraph g;
alpar@990
    63
  ListDigraph::Arc a  = g.addArc(g.addNode(), g.addNode());
alpar@990
    64
  
alpar@990
    65
  Path<ListDigraph> p;
alpar@990
    66
  StaticPath<ListDigraph> q,r;
alpar@990
    67
  p.addBack(a);
alpar@990
    68
  q=p;
alpar@990
    69
  r=q;
alpar@990
    70
  StaticPath<ListDigraph> s(q);
alpar@990
    71
alpar@96
    72
  return 0;
alpar@96
    73
}