Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup unit tests #54

Merged
merged 1 commit into from
Jun 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Added FilterBoxAABB and FilterSphereAABB as examples for filtering a PH-Tree with box keys
[#33](https://github.com/tzaeschke/phtree-cpp/issues/33)
### Changed
- Simplified internals of erase(). [#47](https://github.com/tzaeschke/phtree-cpp/pull/47)
- Cleaned up unit tests. [#54](https://github.com/tzaeschke/phtree-cpp/pull/54)
- Simplified internals of `erase()`. [#47](https://github.com/tzaeschke/phtree-cpp/pull/47)
- Removed internal use of `std::optional()` to slightly reduce memory overhead
[#38](https://github.com/tzaeschke/phtree-cpp/issues/38)
- Removed restrictions on bazel version [#35](https://github.com/tzaeschke/phtree-cpp/issues/35)
Expand Down
8 changes: 3 additions & 5 deletions phtree/phtree_box_d_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,10 @@ struct Id {

explicit Id(const size_t i) : _i(i){};

bool operator==(Id& rhs) {
bool operator==(const Id& rhs) const {
return _i == rhs._i;
}

Id& operator=(Id const& rhs) = default;

size_t _i;
};

Expand Down Expand Up @@ -172,7 +170,7 @@ void SmokeTestBasicOps(size_t N) {
PhTreeDebugHelper::CheckConsistency(tree);
}

TEST(PhTreeMMDFilterTest, SmokeTestBasicOps) {
TEST(PhTreeBoxDTest, SmokeTestBasicOps) {
SmokeTestBasicOps<1>(100);
SmokeTestBasicOps<3>(10000);
SmokeTestBasicOps<6>(10000);
Expand All @@ -181,7 +179,7 @@ TEST(PhTreeMMDFilterTest, SmokeTestBasicOps) {
SmokeTestBasicOps<31>(100);
}

TEST(PhTreeMMDFilterTest, TestDebug) {
TEST(PhTreeBoxDTest, TestDebug) {
const dimension_t dim = 3;
TestTree<dim, Id> tree;
size_t N = 1000;
Expand Down
10 changes: 5 additions & 5 deletions phtree/phtree_box_d_test_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -601,31 +601,31 @@ void QueryAll(QUERY query) {
ASSERT_EQ(1000, n);
}

TEST(PhTreeMMDFilterTest, TestSphereQuery) {
TEST(PhTreeBoxDFilterTest, TestSphereQuery) {
Query0<3>(&testSphereQuery<3>);
QueryMany<3>(&testSphereQuery<3>);
QueryAll<3>(&testSphereQuery<3>);
}

TEST(PhTreeMMDFilterTest, TestSphereQueryWithQueryBox) {
TEST(PhTreeBoxDFilterTest, TestSphereQueryWithQueryBox) {
Query0<3>(&testSphereQueryWithBox<3>);
QueryMany<3>(&testSphereQueryWithBox<3>);
QueryAll<3>(&testSphereQueryWithBox<3>);
}

TEST(PhTreeMMDFilterTest, TestSphereQueryForEach) {
TEST(PhTreeBoxDFilterTest, TestSphereQueryForEach) {
Query0<3>(&testSphereQueryForEach<3>);
QueryMany<3>(&testSphereQueryForEach<3>);
QueryAll<3>(&testSphereQueryForEach<3>);
}

TEST(PhTreeMMDFilterTest, TestSphereQueryForEachWithQueryBox) {
TEST(PhTreeBoxDFilterTest, TestSphereQueryForEachWithQueryBox) {
Query0<3>(&testSphereQueryForEachQueryBox<3>);
QueryMany<3>(&testSphereQueryForEachQueryBox<3>);
QueryAll<3>(&testSphereQueryForEachQueryBox<3>);
}

TEST(PhTreeMMDFilterTest, TestAABBQuery) {
TEST(PhTreeBoxDFilterTest, TestAABBQuery) {
Query0<3>(&testAABBQuery<3>);
QueryManyAABB<3>(&testAABBQuery<3>);
QueryAll<3>(&testAABBQuery<3>);
Expand Down
8 changes: 3 additions & 5 deletions phtree/phtree_box_f_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,10 @@ struct Id {

explicit Id(const size_t i) : _i(i){};

bool operator==(Id& rhs) {
bool operator==(const Id& rhs) const {
return _i == rhs._i;
}

Id& operator=(Id const& rhs) = default;

size_t _i;
};

Expand Down Expand Up @@ -173,7 +171,7 @@ void SmokeTestBasicOps(size_t N) {
PhTreeDebugHelper::CheckConsistency(tree);
}

TEST(PhTreeMMDFilterTest, SmokeTestBasicOps) {
TEST(PhTreeBoxFTest, SmokeTestBasicOps) {
SmokeTestBasicOps<1>(100);
SmokeTestBasicOps<3>(10000);
SmokeTestBasicOps<6>(10000);
Expand All @@ -182,7 +180,7 @@ TEST(PhTreeMMDFilterTest, SmokeTestBasicOps) {
SmokeTestBasicOps<31>(100);
}

TEST(PhTreeMMDFilterTest, TestDebug) {
TEST(PhTreeBoxFTest, TestDebug) {
const dimension_t dim = 3;
TestTree<dim, Id> tree;
size_t N = 1000;
Expand Down
6 changes: 3 additions & 3 deletions phtree/phtree_d_test_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -455,15 +455,15 @@ void testSphereQuery(TestPoint<DIM>& center, double radius, size_t N, int& resul
ASSERT_EQ(referenceResult.size(), result);
}

TEST(PhTreeMMDFilterTest, TestSphereQuery0) {
TEST(PhTreeDFilterTest, TestSphereQuery0) {
const dimension_t dim = 3;
TestPoint<dim> p{-10000, -10000, -10000};
int n = 0;
testSphereQuery<dim>(p, 0.1, 100, n);
ASSERT_EQ(0, n);
}

TEST(PhTreeMMDFilterTest, TestSphereQueryMany) {
TEST(PhTreeDFilterTest, TestSphereQueryMany) {
const dimension_t dim = 3;
TestPoint<dim> p{0, 0, 0};
int n = 0;
Expand All @@ -472,7 +472,7 @@ TEST(PhTreeMMDFilterTest, TestSphereQueryMany) {
ASSERT_LT(n, 800);
}

TEST(PhTreeMMDFilterTest, TestSphereQueryAll) {
TEST(PhTreeDFilterTest, TestSphereQueryAll) {
const dimension_t dim = 3;
TestPoint<dim> p{0, 0, 0};
int n = 0;
Expand Down
4 changes: 1 addition & 3 deletions phtree/phtree_d_test_preprocessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,10 @@ struct Id {

explicit Id(const int i) : _i(i){};

bool operator==(Id& rhs) {
bool operator==(const Id& rhs) const {
return _i == rhs._i;
}

Id& operator=(Id const& rhs) = default;

int _i;
};

Expand Down
4 changes: 1 addition & 3 deletions phtree/phtree_f_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,10 @@ struct Id {

explicit Id(const int i) : _i(i){};

bool operator==(Id& rhs) {
bool operator==(const Id& rhs) const {
return _i == rhs._i;
}

Id& operator=(Id const& rhs) = default;

int _i;
};

Expand Down
4 changes: 1 addition & 3 deletions phtree/phtree_test_const_values.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,10 @@ struct Id {

explicit Id(const int i) : _i(i){};

bool operator==(Id& rhs) {
bool operator==(const Id& rhs) const {
return _i == rhs._i;
}

Id& operator=(Id const& rhs) = default;

int _i;
};

Expand Down
4 changes: 1 addition & 3 deletions phtree/phtree_test_ptr_values.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,10 @@ struct Id {

explicit Id(const size_t i) : _i((int)i){};

bool operator==(Id& rhs) const {
bool operator==(const Id& rhs) const {
return _i == rhs._i;
}

Id& operator=(Id const& rhs) = default;

int _i;
};

Expand Down