test/graph_test.cc
changeset 221 64613d8fae28
parent 171 02f4d5d9bfd7
child 228 b6732e0d38c5
equal deleted inserted replaced
4:7e804e82d355 5:762788cbb734
     1 /* -*- C++ -*-
     1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
     2  *
     2  *
     3  * This file is a part of LEMON, a generic C++ optimization library
     3  * This file is a part of LEMON, a generic C++ optimization library.
     4  *
     4  *
     5  * Copyright (C) 2003-2008
     5  * Copyright (C) 2003-2008
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     8  *
     8  *
    31 
    31 
    32 void check_concepts() {
    32 void check_concepts() {
    33   { // Checking graph components
    33   { // Checking graph components
    34     checkConcept<BaseGraphComponent, BaseGraphComponent >();
    34     checkConcept<BaseGraphComponent, BaseGraphComponent >();
    35 
    35 
    36     checkConcept<IDableGraphComponent<>, 
    36     checkConcept<IDableGraphComponent<>,
    37       IDableGraphComponent<> >();
    37       IDableGraphComponent<> >();
    38 
    38 
    39     checkConcept<IterableGraphComponent<>, 
    39     checkConcept<IterableGraphComponent<>,
    40       IterableGraphComponent<> >();
    40       IterableGraphComponent<> >();
    41 
    41 
    42     checkConcept<MappableGraphComponent<>, 
    42     checkConcept<MappableGraphComponent<>,
    43       MappableGraphComponent<> >();
    43       MappableGraphComponent<> >();
    44   }
    44   }
    45   { // Checking skeleton graph
    45   { // Checking skeleton graph
    46     checkConcept<Graph, Graph>();
    46     checkConcept<Graph, Graph>();
    47   }
    47   }
   132 //     for (int j = 0; j < h; ++j) {
   132 //     for (int j = 0; j < h; ++j) {
   133 //       check(g.col(g(i, j)) == i, "Wrong col");
   133 //       check(g.col(g(i, j)) == i, "Wrong col");
   134 //       check(g.row(g(i, j)) == j, "Wrong row");
   134 //       check(g.row(g(i, j)) == j, "Wrong row");
   135 //     }
   135 //     }
   136 //   }
   136 //   }
   137   
   137 
   138 //   for (int i = 0; i < w; ++i) {
   138 //   for (int i = 0; i < w; ++i) {
   139 //     for (int j = 0; j < h - 1; ++j) {
   139 //     for (int j = 0; j < h - 1; ++j) {
   140 //       check(g.source(g.down(g(i, j))) == g(i, j), "Wrong down");
   140 //       check(g.source(g.down(g(i, j))) == g(i, j), "Wrong down");
   141 //       check(g.target(g.down(g(i, j))) == g(i, j + 1), "Wrong down");
   141 //       check(g.target(g.down(g(i, j))) == g(i, j + 1), "Wrong down");
   142 //     }
   142 //     }
   152 //   }
   152 //   }
   153 
   153 
   154 //   for (int j = 0; j < h; ++j) {
   154 //   for (int j = 0; j < h; ++j) {
   155 //     for (int i = 0; i < w - 1; ++i) {
   155 //     for (int i = 0; i < w - 1; ++i) {
   156 //       check(g.source(g.right(g(i, j))) == g(i, j), "Wrong right");
   156 //       check(g.source(g.right(g(i, j))) == g(i, j), "Wrong right");
   157 //       check(g.target(g.right(g(i, j))) == g(i + 1, j), "Wrong right");      
   157 //       check(g.target(g.right(g(i, j))) == g(i + 1, j), "Wrong right");
   158 //     }
   158 //     }
   159 //     check(g.right(g(w - 1, j)) == INVALID, "Wrong right");    
   159 //     check(g.right(g(w - 1, j)) == INVALID, "Wrong right");
   160 //   }
   160 //   }
   161 
   161 
   162 //   for (int j = 0; j < h; ++j) {
   162 //   for (int j = 0; j < h; ++j) {
   163 //     for (int i = 1; i < w; ++i) {
   163 //     for (int i = 1; i < w; ++i) {
   164 //       check(g.source(g.left(g(i, j))) == g(i, j), "Wrong left");
   164 //       check(g.source(g.left(g(i, j))) == g(i, j), "Wrong left");
   165 //       check(g.target(g.left(g(i, j))) == g(i - 1, j), "Wrong left");      
   165 //       check(g.target(g.left(g(i, j))) == g(i - 1, j), "Wrong left");
   166 //     }
   166 //     }
   167 //     check(g.left(g(0, j)) == INVALID, "Wrong left");    
   167 //     check(g.left(g(0, j)) == INVALID, "Wrong left");
   168 //   }
   168 //   }
   169 // }
   169 // }
   170 
   170 
   171 void check_graphs() {
   171 void check_graphs() {
   172   { // Checking ListGraph
   172   { // Checking ListGraph