gravatar
alpar (Alpar Juttner)
alpar@cs.elte.hu
Merge #428 and #429 to branch 1.1
0 2 0
merge 1.1
2 files changed with 5 insertions and 4 deletions:
↑ Collapse diff ↑
Show white space 512 line context
1 1
EXTRA_DIST += \
2 2
	lemon/lemon.pc.in \
3
	lemon/lemon.pc.cmake \
3 4
	lemon/CMakeLists.txt \
4 5
	lemon/config.h.cmake
5 6

	
6 7
pkgconfig_DATA += lemon/lemon.pc
7 8

	
8 9
lib_LTLIBRARIES += lemon/libemon.la
9 10

	
10 11
lemon_libemon_la_SOURCES = \
11 12
	lemon/arg_parser.cc \
12 13
	lemon/base.cc \
13 14
	lemon/color.cc \
14 15
	lemon/lp_base.cc \
15 16
	lemon/lp_skeleton.cc \
16 17
	lemon/random.cc \
17 18
	lemon/bits/windows.cc
18 19

	
19 20
nodist_lemon_HEADERS = lemon/config.h	
20 21

	
21 22
lemon_libemon_la_CXXFLAGS = \
22 23
	$(AM_CXXFLAGS) \
23 24
	$(GLPK_CFLAGS) \
24 25
	$(CPLEX_CFLAGS) \
25 26
	$(SOPLEX_CXXFLAGS) \
26 27
	$(CLP_CXXFLAGS) \
27 28
	$(CBC_CXXFLAGS)
28 29

	
29 30
lemon_libemon_la_LDFLAGS = \
30 31
	$(GLPK_LIBS) \
31 32
	$(CPLEX_LIBS) \
32 33
	$(SOPLEX_LIBS) \
33 34
	$(CLP_LIBS) \
34 35
	$(CBC_LIBS)
35 36

	
36 37
if HAVE_GLPK
37 38
lemon_libemon_la_SOURCES += lemon/glpk.cc
38 39
endif
39 40

	
40 41
if HAVE_CPLEX
41 42
lemon_libemon_la_SOURCES += lemon/cplex.cc
42 43
endif
43 44

	
44 45
if HAVE_SOPLEX
45 46
lemon_libemon_la_SOURCES += lemon/soplex.cc
46 47
endif
47 48

	
48 49
if HAVE_CLP
49 50
lemon_libemon_la_SOURCES += lemon/clp.cc
50 51
endif
51 52

	
52 53
if HAVE_CBC
53 54
lemon_libemon_la_SOURCES += lemon/cbc.cc
54 55
endif
55 56

	
56 57
lemon_HEADERS += \
57 58
	lemon/adaptors.h \
58 59
	lemon/arg_parser.h \
59 60
	lemon/assert.h \
60 61
	lemon/bfs.h \
61 62
	lemon/bin_heap.h \
62 63
	lemon/bucket_heap.h \
63 64
	lemon/cbc.h \
64 65
	lemon/circulation.h \
65 66
	lemon/clp.h \
66 67
	lemon/color.h \
67 68
	lemon/concept_check.h \
68 69
	lemon/connectivity.h \
69 70
	lemon/counter.h \
70 71
	lemon/core.h \
71 72
	lemon/cplex.h \
72 73
	lemon/dfs.h \
73 74
	lemon/dijkstra.h \
74 75
	lemon/dim2.h \
75 76
	lemon/dimacs.h \
76 77
	lemon/edge_set.h \
77 78
	lemon/elevator.h \
78 79
	lemon/error.h \
79 80
	lemon/euler.h \
80 81
	lemon/fib_heap.h \
81 82
	lemon/full_graph.h \
82 83
	lemon/glpk.h \
83 84
	lemon/gomory_hu.h \
84 85
	lemon/graph_to_eps.h \
85 86
	lemon/grid_graph.h \
86 87
	lemon/hypercube_graph.h \
87 88
	lemon/kruskal.h \
88 89
	lemon/hao_orlin.h \
89 90
	lemon/lgf_reader.h \
90 91
	lemon/lgf_writer.h \
91 92
	lemon/list_graph.h \
92 93
	lemon/lp.h \
93 94
	lemon/lp_base.h \
94 95
	lemon/lp_skeleton.h \
95 96
	lemon/maps.h \
96 97
	lemon/matching.h \
97 98
	lemon/math.h \
98 99
	lemon/min_cost_arborescence.h \
99 100
	lemon/nauty_reader.h \
100 101
	lemon/network_simplex.h \
101 102
	lemon/path.h \
102 103
	lemon/preflow.h \
103 104
	lemon/radix_heap.h \
104 105
	lemon/radix_sort.h \
105 106
	lemon/random.h \
106 107
	lemon/smart_graph.h \
107 108
	lemon/soplex.h \
108 109
	lemon/suurballe.h \
109 110
	lemon/time_measure.h \
110 111
	lemon/tolerance.h \
111 112
	lemon/unionfind.h \
112 113
	lemon/bits/windows.h
113 114

	
114 115
bits_HEADERS += \
115 116
	lemon/bits/alteration_notifier.h \
116 117
	lemon/bits/array_map.h \
117 118
	lemon/bits/bezier.h \
118 119
	lemon/bits/default_map.h \
119 120
	lemon/bits/edge_set_extender.h \
120 121
	lemon/bits/enable_if.h \
121 122
	lemon/bits/graph_adaptor_extender.h \
122 123
	lemon/bits/graph_extender.h \
123 124
	lemon/bits/map_extender.h \
124 125
	lemon/bits/path_dump.h \
125 126
	lemon/bits/solver_bits.h \
126 127
	lemon/bits/traits.h \
127 128
	lemon/bits/variant.h \
128 129
	lemon/bits/vector_map.h
129 130

	
130 131
concept_HEADERS += \
131 132
	lemon/concepts/digraph.h \
132 133
	lemon/concepts/graph.h \
133 134
	lemon/concepts/graph_components.h \
134 135
	lemon/concepts/heap.h \
135 136
	lemon/concepts/maps.h \
136 137
	lemon/concepts/path.h
Show white space 512 line context
1 1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3 3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
5 5
 * Copyright (C) 2003-2011
6 6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
8 8
 *
9 9
 * Permission to use, modify and distribute this software is granted
10 10
 * provided that this copyright notice appears in all copies. For
11 11
 * precise terms see the accompanying LICENSE file.
12 12
 *
13 13
 * This software is provided "AS IS" with no warranty of any kind,
14 14
 * express or implied, and with no claim as to its suitability for any
15 15
 * purpose.
16 16
 *
17 17
 */
18 18

	
19 19
#include <lemon/list_graph.h>
20 20
#include <lemon/lgf_reader.h>
21 21
#include "test_tools.h"
22 22

	
23 23
using namespace lemon;
24 24

	
25 25
char test_lgf[] =
26 26
  "@nodes\n"
27 27
  "label\n"
28 28
  "0\n"
29 29
  "1\n"
30 30
  "@arcs\n"
31 31
  "     label\n"
32 32
  "0 1  0\n"
33 33
  "1 0  1\n"
34 34
  "@attributes\n"
35 35
  "source 0\n"
36 36
  "target 1\n";
37 37

	
38 38
char test_lgf_nomap[] =
39 39
  "@nodes\n"
40 40
  "label\n"
41 41
  "0\n"
42 42
  "1\n"
43 43
  "@arcs\n"
44 44
  "     -\n"
45 45
  "0 1\n";
46 46

	
47 47
char test_lgf_bad1[] =
48 48
  "@nodes\n"
49 49
  "label\n"
50 50
  "0\n"
51 51
  "1\n"
52 52
  "@arcs\n"
53 53
  "     - another\n"
54 54
  "0 1\n";
55 55

	
56 56
char test_lgf_bad2[] =
57 57
  "@nodes\n"
58 58
  "label\n"
59 59
  "0\n"
60 60
  "1\n"
61 61
  "@arcs\n"
62 62
  "     label -\n"
63 63
  "0 1\n";
64 64

	
65 65

	
66 66
int main()
67 67
{
68 68
  {
69 69
    ListDigraph d;
70 70
    ListDigraph::Node s,t;
71 71
    ListDigraph::ArcMap<int> label(d);
72 72
    std::istringstream input(test_lgf);
73 73
    digraphReader(d, input).
74 74
      node("source", s).
75 75
      node("target", t).
76 76
      arcMap("label", label).
77 77
      run();
78 78
    check(countNodes(d) == 2,"There should be 2 nodes");
79 79
    check(countArcs(d) == 2,"There should be 2 arcs");
80 80
  }
81 81
  {
82 82
    ListGraph g;
83 83
    ListGraph::Node s,t;
84 84
    ListGraph::EdgeMap<int> label(g);
85 85
    std::istringstream input(test_lgf);
86 86
    graphReader(g, input).
87 87
      node("source", s).
88 88
      node("target", t).
89 89
      edgeMap("label", label).
90 90
      run();
91 91
    check(countNodes(g) == 2,"There should be 2 nodes");
92 92
    check(countEdges(g) == 2,"There should be 2 arcs");
93 93
  }
94 94

	
95 95
  {
96 96
    ListDigraph d;
97 97
    std::istringstream input(test_lgf_nomap);
98 98
    digraphReader(d, input).
99 99
      run();
100 100
    check(countNodes(d) == 2,"There should be 2 nodes");
101 101
    check(countArcs(d) == 1,"There should be 1 arc");
102 102
  }
103 103
  {
104 104
    ListGraph g;
105 105
    std::istringstream input(test_lgf_nomap);
106 106
    graphReader(g, input).
107 107
      run();
108 108
    check(countNodes(g) == 2,"There should be 2 nodes");
109 109
    check(countEdges(g) == 1,"There should be 1 edge");
110 110
  }
111 111

	
112 112
  {
113 113
    ListDigraph d;
114 114
    std::istringstream input(test_lgf_bad1);
115 115
    bool ok=false;
116 116
    try {
117 117
      digraphReader(d, input).
118 118
        run();
119 119
    }
120
    catch (FormatError& error)
120
    catch (FormatError&) 
121 121
      {
122 122
        ok = true;
123 123
      }
124 124
    check(ok,"FormatError exception should have occured");
125 125
  }
126 126
  {
127 127
    ListGraph g;
128 128
    std::istringstream input(test_lgf_bad1);
129 129
    bool ok=false;
130 130
    try {
131 131
      graphReader(g, input).
132 132
        run();
133 133
    }
134
    catch (FormatError& error)
134
    catch (FormatError&)
135 135
      {
136 136
        ok = true;
137 137
      }
138 138
    check(ok,"FormatError exception should have occured");
139 139
  }
140 140

	
141 141
  {
142 142
    ListDigraph d;
143 143
    std::istringstream input(test_lgf_bad2);
144 144
    bool ok=false;
145 145
    try {
146 146
      digraphReader(d, input).
147 147
        run();
148 148
    }
149
    catch (FormatError& error)
149
    catch (FormatError&)
150 150
      {
151 151
        ok = true;
152 152
      }
153 153
    check(ok,"FormatError exception should have occured");
154 154
  }
155 155
  {
156 156
    ListGraph g;
157 157
    std::istringstream input(test_lgf_bad2);
158 158
    bool ok=false;
159 159
    try {
160 160
      graphReader(g, input).
161 161
        run();
162 162
    }
163
    catch (FormatError& error)
163
    catch (FormatError&)
164 164
      {
165 165
        ok = true;
166 166
      }
167 167
    check(ok,"FormatError exception should have occured");
168 168
  }
169 169
}
0 comments (0 inline)