Line data Source code
1 : #include <catch2/catch_test_macros.hpp> 2 : #include <catch2/matchers/catch_matchers_floating_point.hpp> 3 : 4 : #include "Alg/Flow/EdmondsKarp.hpp" 5 : #include "Alg/Flow/MaxFlow.hpp" 6 : #include "Alg/Graph.hpp" 7 : #include "Alg/ShortestPath/BFS.hpp" 8 : #include "test/problem/graphs.hpp" 9 : 10 : using namespace std; 11 : using Catch::Matchers::WithinAbs; 12 : 13 1 : TEST_CASE("Edmonds-Karp algorithm", "[flow][maxflow][edmonds-karp]") { 14 2 : SECTION("0,5") { 15 2 : Alg::Graph G = graph2(); 16 : 17 1 : Alg::ShortestPath::ShortestPathOneOne *sp = new Alg::ShortestPath::BFS(); 18 2 : Alg::Flow::EdmondsKarp maxFlow(*sp); 19 : 20 4 : REQUIRE_THAT(maxFlow.solve(G, 0, 5), WithinAbs(23, 1e-9)); 21 : // TODO: check if flows are somewhat correct. 22 : 23 1 : delete sp; 24 : } 25 1 : }