COIN-OR::LEMON - Graph Library

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/preflow_test.cc

    r423 r394  
    1717 */
    1818
    19 #include <iostream>
     19#include <fstream>
     20#include <string>
    2021
    2122#include "test_tools.h"
     
    2829
    2930using namespace lemon;
    30 
    31 char test_lgf[] =
    32   "@nodes\n"
    33   "label\n"
    34   "0\n"
    35   "1\n"
    36   "2\n"
    37   "3\n"
    38   "4\n"
    39   "5\n"
    40   "6\n"
    41   "7\n"
    42   "8\n"
    43   "9\n"
    44   "@arcs\n"
    45   "    label capacity\n"
    46   "0 1 0     20\n"
    47   "0 2 1     0\n"
    48   "1 1 2     3\n"
    49   "1 2 3     8\n"
    50   "1 3 4     8\n"
    51   "2 5 5     5\n"
    52   "3 2 6     5\n"
    53   "3 5 7     5\n"
    54   "3 6 8     5\n"
    55   "4 3 9     3\n"
    56   "5 7 10    3\n"
    57   "5 6 11    10\n"
    58   "5 8 12    10\n"
    59   "6 8 13    8\n"
    60   "8 9 14    20\n"
    61   "8 1 15    5\n"
    62   "9 5 16    5\n"
    63   "@attributes\n"
    64   "source 1\n"
    65   "target 8\n";
    6631
    6732void checkPreflowCompile()
     
    159124  typedef Preflow<Digraph, CapMap> PType;
    160125
     126  std::string f_name;
     127  if( getenv("srcdir") )
     128    f_name = std::string(getenv("srcdir"));
     129  else f_name = ".";
     130  f_name += "/test/preflow_graph.lgf";
     131
     132  std::ifstream file(f_name.c_str());
     133
     134  check(file, "Input file '" << f_name << "' not found.");
     135
    161136  Digraph g;
    162137  Node s, t;
    163138  CapMap cap(g);
    164   std::istringstream input(test_lgf);
    165   DigraphReader<Digraph>(g,input).
     139  DigraphReader<Digraph>(g,file).
    166140    arcMap("capacity", cap).
    167141    node("source",s).
Note: See TracChangeset for help on using the changeset viewer.