diff options
author | Arnur Nigmetov <anigmetov@lbl.gov> | 2021-02-23 01:15:09 -0800 |
---|---|---|
committer | Arnur Nigmetov <anigmetov@lbl.gov> | 2021-02-23 01:15:09 -0800 |
commit | 38f12f37aa9fdb7246524915d137abdbc6657f58 (patch) | |
tree | 8b53a97937515f8d96b62e46d085c46fad64dfc8 /bottleneck/tests/test_hera_bottleneck.cpp | |
parent | 4fca29502d5a99abe7abbd5f5f3d46a037e7423e (diff) |
Fix bug with exact bottleneck distance.
Diffstat (limited to 'bottleneck/tests/test_hera_bottleneck.cpp')
-rw-r--r-- | bottleneck/tests/test_hera_bottleneck.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/bottleneck/tests/test_hera_bottleneck.cpp b/bottleneck/tests/test_hera_bottleneck.cpp index f22e415..b31b2b7 100644 --- a/bottleneck/tests/test_hera_bottleneck.cpp +++ b/bottleneck/tests/test_hera_bottleneck.cpp @@ -159,6 +159,9 @@ TEST_CASE("infinity points", "bottleneckDistApprox") double d = hera::bottleneckDistApprox<>(diagram_A, diagram_B, delta); double corr_answer = 1.0; REQUIRE( fabs(d - corr_answer) <= delta * corr_answer); + + double exact_d = hera::bottleneckDistExact<>(diagram_A, diagram_B); + REQUIRE(exact_d == corr_answer); } SECTION("two points at infinity") { @@ -565,7 +568,11 @@ TEST_CASE("file cases", "bottleneck_dist") REQUIRE(read_file_A); REQUIRE(read_file_B); - double hera_answer = hera::bottleneckDistApprox(diagram_A, diagram_B, ts.delta, longest_edge, true); + double hera_answer; + if (ts.delta > 0) + hera_answer = hera::bottleneckDistApprox(diagram_A, diagram_B, ts.delta, longest_edge, true); + else + hera_answer = hera::bottleneckDistExact(diagram_A, diagram_B); std::pair<int, int> hera_le { longest_edge.first.get_user_id(), longest_edge.second.get_user_id() }; REQUIRE((hera_answer == ts.answer or fabs(hera_answer - ts.answer) <= ts.delta * hera_answer)); @@ -604,7 +611,6 @@ TEST_CASE("file cases", "bottleneck_dist") // << hera_answer_exact << std::endl; // } REQUIRE( (not check_longest_edge_cost or fabs(hera_le_cost - hera_answer_exact) < 0.0001 * hera_answer_exact) ); - std::cout << ts << " PASSED " << std::endl; } } |