test/preflow_test.cc
changeset 426 b2564598b46d
parent 394 e7707b3069f1
child 440 88ed40ad0d4f
     1.1 --- a/test/preflow_test.cc	Mon Dec 08 11:06:39 2008 +0100
     1.2 +++ b/test/preflow_test.cc	Mon Dec 08 15:47:20 2008 +0000
     1.3 @@ -16,8 +16,7 @@
     1.4   *
     1.5   */
     1.6  
     1.7 -#include <fstream>
     1.8 -#include <string>
     1.9 +#include <iostream>
    1.10  
    1.11  #include "test_tools.h"
    1.12  #include <lemon/smart_graph.h>
    1.13 @@ -29,6 +28,42 @@
    1.14  
    1.15  using namespace lemon;
    1.16  
    1.17 +char test_lgf[] =
    1.18 +  "@nodes\n"
    1.19 +  "label\n"
    1.20 +  "0\n"
    1.21 +  "1\n"
    1.22 +  "2\n"
    1.23 +  "3\n"
    1.24 +  "4\n"
    1.25 +  "5\n"
    1.26 +  "6\n"
    1.27 +  "7\n"
    1.28 +  "8\n"
    1.29 +  "9\n"
    1.30 +  "@arcs\n"
    1.31 +  "    label capacity\n"
    1.32 +  "0 1 0     20\n"
    1.33 +  "0 2 1     0\n"
    1.34 +  "1 1 2     3\n"
    1.35 +  "1 2 3     8\n"
    1.36 +  "1 3 4     8\n"
    1.37 +  "2 5 5     5\n"
    1.38 +  "3 2 6     5\n"
    1.39 +  "3 5 7     5\n"
    1.40 +  "3 6 8     5\n"
    1.41 +  "4 3 9     3\n"
    1.42 +  "5 7 10    3\n"
    1.43 +  "5 6 11    10\n"
    1.44 +  "5 8 12    10\n"
    1.45 +  "6 8 13    8\n"
    1.46 +  "8 9 14    20\n"
    1.47 +  "8 1 15    5\n"
    1.48 +  "9 5 16    5\n"
    1.49 +  "@attributes\n"
    1.50 +  "source 1\n"
    1.51 +  "target 8\n";
    1.52 +
    1.53  void checkPreflowCompile()
    1.54  {
    1.55    typedef int VType;
    1.56 @@ -123,20 +158,11 @@
    1.57  
    1.58    typedef Preflow<Digraph, CapMap> PType;
    1.59  
    1.60 -  std::string f_name;
    1.61 -  if( getenv("srcdir") )
    1.62 -    f_name = std::string(getenv("srcdir"));
    1.63 -  else f_name = ".";
    1.64 -  f_name += "/test/preflow_graph.lgf";
    1.65 -
    1.66 -  std::ifstream file(f_name.c_str());
    1.67 -
    1.68 -  check(file, "Input file '" << f_name << "' not found.");
    1.69 -
    1.70    Digraph g;
    1.71    Node s, t;
    1.72    CapMap cap(g);
    1.73 -  DigraphReader<Digraph>(g,file).
    1.74 +  std::istringstream input(test_lgf);
    1.75 +  DigraphReader<Digraph>(g,input).
    1.76      arcMap("capacity", cap).
    1.77      node("source",s).
    1.78      node("target",t).