gravatar
deba@inf.elte.hu
deba@inf.elte.hu
Simple test for HaoOrlin algorithm class (#58)
0 2 1
default
3 files changed with 66 insertions and 0 deletions:
↑ Collapse diff ↑
Ignore white space 128 line context
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library.
4
 *
5
 * Copyright (C) 2003-2008
6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
8
 *
9
 * Permission to use, modify and distribute this software is granted
10
 * provided that this copyright notice appears in all copies. For
11
 * precise terms see the accompanying LICENSE file.
12
 *
13
 * This software is provided "AS IS" with no warranty of any kind,
14
 * express or implied, and with no claim as to its suitability for any
15
 * purpose.
16
 *
17
 */
18

	
19
#include <sstream>
20

	
21
#include <lemon/smart_graph.h>
22
#include <lemon/hao_orlin.h>
23

	
24
#include <lemon/lgf_reader.h>
25
#include "test_tools.h"
26

	
27
using namespace lemon;
28
using namespace std;
29

	
30
const std::string lgf =
31
  "@nodes\n"
32
  "label\n"
33
  "0\n"
34
  "1\n"
35
  "2\n"
36
  "3\n"
37
  "4\n"
38
  "5\n"
39
  "@edges\n"
40
  "     label  capacity\n"
41
  "0 1  0      2\n"
42
  "1 2  1      2\n"
43
  "2 0  2      2\n"
44
  "3 4  3      2\n"
45
  "4 5  4      2\n"
46
  "5 3  5      2\n"
47
  "2 3  6      3\n";
48

	
49
int main() {
50
  SmartGraph graph;
51
  SmartGraph::EdgeMap<int> capacity(graph);
52

	
53
  istringstream lgfs(lgf);
54
  graphReader(graph, lgfs).
55
    edgeMap("capacity", capacity).run();
56

	
57
  HaoOrlin<SmartGraph, SmartGraph::EdgeMap<int> > ho(graph, capacity);
58
  ho.run();
59

	
60
  check(ho.minCutValue() == 3, "Wrong cut value");
61

	
62
  return 0;
63
}
Ignore white space 128 line context
1 1
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
2 2

	
3 3
LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lemon)
4 4

	
5 5
SET(TESTS
6 6
  bfs_test
7 7
  counter_test
8 8
  dfs_test
9 9
  digraph_test
10 10
  dijkstra_test
11 11
  dim_test
12 12
  error_test
13 13
  graph_copy_test
14 14
  graph_test
15 15
  graph_utils_test
16
  hao_orlin_test
16 17
  heap_test
17 18
  kruskal_test
18 19
  maps_test
19 20
  max_matching_test
20 21
  random_test
21 22
  path_test
22 23
  time_measure_test
23 24
  unionfind_test)
24 25

	
25 26
FOREACH(TEST_NAME ${TESTS})
26 27
  ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
27 28
  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
28 29
  ADD_TEST(${TEST_NAME} ${TEST_NAME})
29 30
ENDFOREACH(TEST_NAME)
Ignore white space 128 line context
1 1
EXTRA_DIST += \
2 2
	test/CMakeLists.txt \
3 3
        test/min_cost_flow_test.lgf \
4 4
        test/preflow_graph.lgf
5 5

	
6 6
noinst_HEADERS += \
7 7
	test/graph_test.h \
8 8
        test/test_tools.h
9 9

	
10 10
check_PROGRAMS += \
11 11
	test/bfs_test \
12 12
        test/circulation_test \
13 13
        test/counter_test \
14 14
	test/dfs_test \
15 15
	test/digraph_test \
16 16
	test/dijkstra_test \
17 17
        test/dim_test \
18 18
	test/error_test \
19 19
	test/graph_copy_test \
20 20
	test/graph_test \
21 21
	test/graph_utils_test \
22 22
	test/heap_test \
23 23
	test/kruskal_test \
24
	test/hao_orlin_test \
24 25
        test/maps_test \
25 26
	test/max_matching_test \
26 27
        test/random_test \
27 28
        test/path_test \
28 29
        test/preflow_test \
29 30
        test/suurballe_test \
30 31
        test/test_tools_fail \
31 32
        test/test_tools_pass \
32 33
        test/time_measure_test \
33 34
	test/unionfind_test
34 35

	
35 36
TESTS += $(check_PROGRAMS)
36 37
XFAIL_TESTS += test/test_tools_fail$(EXEEXT)
37 38

	
38 39
test_bfs_test_SOURCES = test/bfs_test.cc
39 40
test_circulation_test_SOURCES = test/circulation_test.cc
40 41
test_counter_test_SOURCES = test/counter_test.cc
41 42
test_dfs_test_SOURCES = test/dfs_test.cc
42 43
test_digraph_test_SOURCES = test/digraph_test.cc
43 44
test_dijkstra_test_SOURCES = test/dijkstra_test.cc
44 45
test_dim_test_SOURCES = test/dim_test.cc
45 46
test_error_test_SOURCES = test/error_test.cc
46 47
test_graph_copy_test_SOURCES = test/graph_copy_test.cc
47 48
test_graph_test_SOURCES = test/graph_test.cc
48 49
test_graph_utils_test_SOURCES = test/graph_utils_test.cc
49 50
test_heap_test_SOURCES = test/heap_test.cc
50 51
test_kruskal_test_SOURCES = test/kruskal_test.cc
52
test_hao_orlin_test_SOURCES = test/hao_orlin_test.cc
51 53
test_maps_test_SOURCES = test/maps_test.cc
52 54
test_max_matching_test_SOURCES = test/max_matching_test.cc
53 55
test_path_test_SOURCES = test/path_test.cc
54 56
test_preflow_test_SOURCES = test/preflow_test.cc
55 57
test_suurballe_test_SOURCES = test/suurballe_test.cc
56 58
test_random_test_SOURCES = test/random_test.cc
57 59
test_test_tools_fail_SOURCES = test/test_tools_fail.cc
58 60
test_test_tools_pass_SOURCES = test/test_tools_pass.cc
59 61
test_time_measure_test_SOURCES = test/time_measure_test.cc
60 62
test_unionfind_test_SOURCES = test/unionfind_test.cc
0 comments (0 inline)