From 646bc0f83b008ef0d34638ce4ffdf394cba2c52b Mon Sep 17 00:00:00 2001 From: Ilia Barutkin Date: Mon, 16 Sep 2024 23:14:04 +0300 Subject: [PATCH] Add tests of PFDTane algorithm --- src/tests/test_fd_algorithm.cpp | 2 +- src/tests/test_fd_mine.cpp | 1 + src/tests/test_pfdtane.cpp | 12 ++++++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/tests/test_fd_algorithm.cpp b/src/tests/test_fd_algorithm.cpp index 60abfc143e..091cb1462f 100644 --- a/src/tests/test_fd_algorithm.cpp +++ b/src/tests/test_fd_algorithm.cpp @@ -9,8 +9,8 @@ #include "algorithms/fd/fdep/fdep.h" #include "algorithms/fd/fun/fun.h" #include "algorithms/fd/hyfd/hyfd.h" -#include "algorithms/fd/pfdtane/pfdtane.h" #include "algorithms/fd/pyro/pyro.h" +#include "algorithms/fd/tane/pfdtane.h" #include "algorithms/fd/tane/tane.h" #include "model/table/relational_schema.h" #include "test_fd_util.h" diff --git a/src/tests/test_fd_mine.cpp b/src/tests/test_fd_mine.cpp index 6ec31dd43d..5e32d5e994 100644 --- a/src/tests/test_fd_mine.cpp +++ b/src/tests/test_fd_mine.cpp @@ -7,6 +7,7 @@ #include "algorithms/algo_factory.h" #include "algorithms/fd/fd_mine/fd_mine.h" #include "algorithms/fd/pyro/pyro.h" +#include "algorithms/fd/tane/pfdtane.h" #include "algorithms/fd/tane/tane.h" #include "config/error/type.h" #include "config/names.h" diff --git a/src/tests/test_pfdtane.cpp b/src/tests/test_pfdtane.cpp index 2deeb702fb..6d6e134785 100644 --- a/src/tests/test_pfdtane.cpp +++ b/src/tests/test_pfdtane.cpp @@ -3,8 +3,7 @@ #include "algo_factory.h" #include "all_csv_configs.h" #include "config/names.h" -#include "fd/pfdtane/enums.h" -#include "fd/pfdtane/pfdtane.h" +#include "fd/tane/pfdtane.h" #include "model/table/column_layout_relation_data.h" #include "parser/csv_parser/csv_parser.h" @@ -51,11 +50,12 @@ TEST_P(TestPFDTaneValidation, ErrorCalculationTest) { double eps = 0.00001; auto table = std::make_shared(p.csv_config); auto relation = ColumnLayoutRelationData::CreateFrom(*table, true); + for (auto const& [lhs_id, rhs_id, expected_error] : p.fds) { auto const& lhs = relation->GetColumnData(lhs_id).GetPositionListIndex(); auto const& rhs = relation->GetColumnData(rhs_id).GetPositionListIndex(); config::ErrorType error = - algos::PFDTane::CalculateFdError(lhs, lhs->Intersect(rhs).get(), p.error_measure); + algos::PFDTane::CalculatePFDError(lhs, lhs->Intersect(rhs).get(), p.error_measure); EXPECT_NEAR(error, expected_error, eps); } } @@ -64,7 +64,11 @@ TEST_P(TestPFDTaneValidation, ErrorCalculationTest) { INSTANTIATE_TEST_SUITE_P( PFDTaneTestMiningSuite, TestPFDTaneMining, ::testing::Values( - PFDTaneMiningParams(44381, 0.3, +algos::ErrorMeasure::per_value, kTestFD) + PFDTaneMiningParams(44381, 0.3, +algos::ErrorMeasure::per_value, kTestFD), + PFDTaneMiningParams(39491, 0.1, +algos::ErrorMeasure::per_value, kIris), + PFDTaneMiningParams(10695, 0.01, +algos::ErrorMeasure::per_value, kIris), + PFDTaneMiningParams(7893, 0.1, +algos::ErrorMeasure::per_value, kNeighbors10k), + PFDTaneMiningParams(41837, 0.01, +algos::ErrorMeasure::per_value, kNeighbors10k) )); INSTANTIATE_TEST_SUITE_P(