diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -13,6 +13,7 @@ graph_copy_test graph_test graph_utils_test + hao_orlin_test heap_test kruskal_test maps_test diff --git a/test/Makefile.am b/test/Makefile.am --- a/test/Makefile.am +++ b/test/Makefile.am @@ -21,6 +21,7 @@ test/graph_utils_test \ test/heap_test \ test/kruskal_test \ + test/hao_orlin_test \ test/maps_test \ test/max_matching_test \ test/random_test \ @@ -48,6 +49,7 @@ test_graph_utils_test_SOURCES = test/graph_utils_test.cc test_heap_test_SOURCES = test/heap_test.cc test_kruskal_test_SOURCES = test/kruskal_test.cc +test_hao_orlin_test_SOURCES = test/hao_orlin_test.cc test_maps_test_SOURCES = test/maps_test.cc test_max_matching_test_SOURCES = test/max_matching_test.cc test_path_test_SOURCES = test/path_test.cc diff --git a/test/hao_orlin_test.cc b/test/hao_orlin_test.cc new file mode 100644 --- /dev/null +++ b/test/hao_orlin_test.cc @@ -0,0 +1,63 @@ +/* -*- mode: C++; indent-tabs-mode: nil; -*- + * + * This file is a part of LEMON, a generic C++ optimization library. + * + * Copyright (C) 2003-2008 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport + * (Egervary Research Group on Combinatorial Optimization, EGRES). + * + * Permission to use, modify and distribute this software is granted + * provided that this copyright notice appears in all copies. For + * precise terms see the accompanying LICENSE file. + * + * This software is provided "AS IS" with no warranty of any kind, + * express or implied, and with no claim as to its suitability for any + * purpose. + * + */ + +#include + +#include +#include + +#include +#include "test_tools.h" + +using namespace lemon; +using namespace std; + +const std::string lgf = + "@nodes\n" + "label\n" + "0\n" + "1\n" + "2\n" + "3\n" + "4\n" + "5\n" + "@edges\n" + " label capacity\n" + "0 1 0 2\n" + "1 2 1 2\n" + "2 0 2 2\n" + "3 4 3 2\n" + "4 5 4 2\n" + "5 3 5 2\n" + "2 3 6 3\n"; + +int main() { + SmartGraph graph; + SmartGraph::EdgeMap capacity(graph); + + istringstream lgfs(lgf); + graphReader(graph, lgfs). + edgeMap("capacity", capacity).run(); + + HaoOrlin > ho(graph, capacity); + ho.run(); + + check(ho.minCutValue() == 3, "Wrong cut value"); + + return 0; +}