COIN-OR::LEMON - Graph Library

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/preflow_test.cc

    r394 r423  
    1717 */
    1818
    19 #include <fstream>
    20 #include <string>
     19#include <iostream>
    2120
    2221#include "test_tools.h"
     
    2928
    3029using namespace lemon;
     30
     31char 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";
    3166
    3267void checkPreflowCompile()
     
    124159  typedef Preflow<Digraph, CapMap> PType;
    125160
    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 
    136161  Digraph g;
    137162  Node s, t;
    138163  CapMap cap(g);
    139   DigraphReader<Digraph>(g,file).
     164  std::istringstream input(test_lgf);
     165  DigraphReader<Digraph>(g,input).
    140166    arcMap("capacity", cap).
    141167    node("source",s).
Note: See TracChangeset for help on using the changeset viewer.