From 9ea2fb22792b54427652f91f004494c87bded32d Mon Sep 17 00:00:00 2001 From: Lukas Garbas <lukasgarba@gmail.com> Date: Mon, 29 Apr 2019 17:58:19 +0200 Subject: [PATCH] One test case for max-flow algorithm --- test/edmonds_karp_test.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/edmonds_karp_test.cpp b/test/edmonds_karp_test.cpp index fc86441..fb1b3de 100644 --- a/test/edmonds_karp_test.cpp +++ b/test/edmonds_karp_test.cpp @@ -1,9 +1,22 @@ #include <catch2/catch.hpp> #include <gp-bnb/edmonds_karp.hpp> +#include <gp-bnb/graph.hpp> +#include <gp-bnb/metis_reader.hpp> // Tests for Edmonds-Karp Max Flow algorithm TEST_CASE("EdmondsKarpMaxFlow") { + + std::string graph_file = "../test/inputs/tiny_01.graph"; + graph g = metis_reader().read(graph_file); + node_id source = 1; + node_id sink = 7; + edmonds_karp ek = edmonds_karp(g, source, sink); + + ek.run(); + int max_flow = ek.get_max_flow(); + + REQUIRE(max_flow == 2); } \ No newline at end of file -- GitLab