-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#include <gtest/gtest.h> | ||
|
||
#include "algorithms/algo_factory.h" | ||
#include "algorithms/nd/nd.h" | ||
#include "algorithms/nd/nd_verifier/nd_verifier.h" | ||
#include "all_csv_configs.h" | ||
#include "config/names.h" | ||
|
||
namespace tests { | ||
namespace onam = config::names; | ||
|
||
struct NDVerifyingParams { | ||
algos::StdParamsMap params; | ||
|
||
NDVerifyingParams(config::IndicesType lhs_indices, config::IndicesType rhs_indices, | ||
model::WeightType weight = UINT_MAX, CSVConfig const& csv_config = kTestND, | ||
bool null_eq_null = true) | ||
: params({{onam::kCsvConfig, csv_config}, | ||
{onam::kLhsIndices, std::move(lhs_indices)}, | ||
{onam::kRhsIndices, std::move(rhs_indices)}, | ||
{onam::kEqualNulls, null_eq_null}, | ||
{onam::kWeight, weight}}) {} | ||
}; | ||
|
||
class TestNDVerifying : public ::testing::TestWithParam<NDVerifyingParams> {}; | ||
|
||
TEST_P(TestNDVerifying, DefaultTest) { | ||
auto const& p = GetParam(); | ||
auto mp = algos::StdParamsMap(p.params); | ||
auto verifier = algos::CreateAndLoadAlgorithm<algos::nd_verifier::NDVerifier>(mp); | ||
verifier->Execute(); | ||
EXPECT_TRUE(verifier->NDHolds()); | ||
} | ||
|
||
// clang-format off | ||
INSTANTIATE_TEST_SUITE_P( | ||
NDVerifierTestSuite, TestNDVerifying, | ||
::testing::Values( | ||
// Constant lhs: | ||
NDVerifyingParams({0}, {1}, 4), | ||
NDVerifyingParams({0}, {2}, 6), | ||
NDVerifyingParams({0}, {3}, 4), | ||
NDVerifyingParams({0}, {4}, 5), | ||
NDVerifyingParams({0}, {5}, 9), | ||
// Non-constant lhs: | ||
NDVerifyingParams({1}, {5}, 3), | ||
NDVerifyingParams({4}, {0}, 1), | ||
// Multiple columns: | ||
NDVerifyingParams({0, 1}, {3, 5}, 3), | ||
NDVerifyingParams({1, 2}, {3, 6}, 2), | ||
NDVerifyingParams({1, 2, 3}, {6}, 2) | ||
)); | ||
|
||
INSTANTIATE_TEST_CASE_P( | ||
NDVerifierHeavyDatasets, TestNDVerifying, | ||
::testing::Values( | ||
NDVerifyingParams({5}, {6}, 1000000, kIowa1kk), // I just want to see execution time. Real weight doesn't matter (but it shouldn't be very big) | ||
NDVerifyingParams({16, 17, 18}, {20, 23}, 1000000, kIowa1kk) // Also, I want to see how execution time depends on number of columns | ||
)); | ||
|
||
INSTANTIATE_TEST_CASE_P( | ||
NDVerifierTestNullEqualNull, TestNDVerifying, | ||
::testing::Values( // 6-th column contains 2 values and 7 empty cells | ||
NDVerifyingParams({0}, {6}, 3, kTestND, true), | ||
NDVerifyingParams({0}, {6}, 7, kTestND, false) | ||
)); | ||
// clang-format on | ||
|
||
} // namespace tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Col0,Col1,Col2,Col3,Col4,Col5,Col6 | ||
1,a,x,1.233,-,11,aa | ||
1,a,x,0,8,22, | ||
1,a,xy,0,8,33, | ||
1,b,y,hjkl,444,44,aa | ||
1,b,y,hjkl,444,44,bb | ||
1,b,xy,hjkl,444,55,aa | ||
1,c,z,0,9,66, | ||
1,c,z,0,9,66, | ||
1,c,z,999,-,77,bb | ||
1,d,k,hjkl,555,88,aa | ||
1,d,k,hjkl,555,88,aa | ||
1,d,abc,hjkl,555,99, |