summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnur Nigmetov <anigmetov@lbl.gov>2021-02-23 01:25:10 -0800
committerArnur Nigmetov <anigmetov@lbl.gov>2021-02-23 01:25:10 -0800
commit66789dd1319402fe573395e20a4e534a9e7142c7 (patch)
tree357bf694d1a2b81a2b66f2cc6c77a0040160fa65
parented2323628302031a2a2a0e6114190a13590b3ac8 (diff)
Fix tests for bottleneck (Exact must be called)
-rw-r--r--bottleneck/tests/data/test_list.txt2
-rw-r--r--bottleneck/tests/test_hera_bottleneck.cpp6
2 files changed, 6 insertions, 2 deletions
diff --git a/bottleneck/tests/data/test_list.txt b/bottleneck/tests/data/test_list.txt
index 6fc63cc..91c03a4 100644
--- a/bottleneck/tests/data/test_list.txt
+++ b/bottleneck/tests/data/test_list.txt
@@ -790,4 +790,4 @@ test_876_A test_876_B 0.01 165
test_877_A test_877_B 0.01 190
test_878_A test_878_B 0.01 242
test_879_A test_879_B 0.01 187
-test_880_A test_880_B 0.000001 0.0411428571428574
+test_880_A test_880_B 0.0 0.0411428571428574
diff --git a/bottleneck/tests/test_hera_bottleneck.cpp b/bottleneck/tests/test_hera_bottleneck.cpp
index b31b2b7..c74e800 100644
--- a/bottleneck/tests/test_hera_bottleneck.cpp
+++ b/bottleneck/tests/test_hera_bottleneck.cpp
@@ -562,7 +562,7 @@ TEST_CASE("file cases", "bottleneck_dist")
SECTION("from file:") {
- for (const auto& ts : test_params) {
+ for (auto& ts : test_params) {
bool read_file_A = hera::readDiagramPointSet(dir_prefix + ts.file_1, diagram_A);
bool read_file_B = hera::readDiagramPointSet(dir_prefix + ts.file_2, diagram_B);
REQUIRE(read_file_A);
@@ -575,6 +575,10 @@ TEST_CASE("file cases", "bottleneck_dist")
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() };
+ // cannot store exact answer in test_list.txt, but need to make sure that Exact is called
+ if (ts.delta == 0.0)
+ ts.delta = 0.00000001;
+
REQUIRE((hera_answer == ts.answer or fabs(hera_answer - ts.answer) <= ts.delta * hera_answer));
REQUIRE((ts.longest_edges.empty() or
std::find(ts.longest_edges.begin(), ts.longest_edges.end(), hera_le) != ts.longest_edges.end()));