Skip to content

Commit 7681361

Browse files
committed
WIP: example of not working tests
1 parent 25dfdd7 commit 7681361

File tree

2 files changed

+31
-15
lines changed

2 files changed

+31
-15
lines changed

tests/entryTest.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ TEST(AddTest, HandlesPositiveInput) {
88
EXPECT_EQ(6, add(2, 4));
99
}
1010

11-
12-
1311
int main(int argc, char **argv) {
1412
::testing::InitGoogleTest(&argc, argv);
1513
return RUN_ALL_TESTS();

tests/unit_tests/DFPointCloudTest.cc

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include <filesystem>
2+
13
#include <gtest/gtest.h>
24
#include "diffCheck.hh"
35

@@ -11,21 +13,42 @@ class DFPointCloudTestFixture : public ::testing::Test {
1113
DFPointCloudTestFixture() : dfPointCloud(points, colors, normals) {}
1214

1315
void SetUp() override {
14-
// Initialize your objects and variables here
15-
points = {Eigen::Vector3d(1, 2, 3)};
16-
colors = {Eigen::Vector3d(255, 255, 255)};
17-
normals = {Eigen::Vector3d(0, 0, 1)};
16+
std::filesystem::path path = std::filesystem::path(__FILE__).parent_path();
17+
std::filesystem::path pathCloud = path / "test_data" / "cloud.ply";
1818

19-
// Reinitialize dfPointCloud in case you need to reset its state
20-
dfPointCloud = diffCheck::geometry::DFPointCloud(points, colors, normals);
19+
dfPointCloud = diffCheck::geometry::DFPointCloud();
20+
dfPointCloud.LoadFromPLY(pathCloud.string());
2121
}
2222

2323
void TearDown() override {
2424
// Clean up any resources if needed
2525
}
2626
};
2727

28-
TEST_F(DFPointCloudTestFixture, GetNumPoints) {
28+
TEST_F(DFPointCloudTestFixture, ConvertionO3dPointCloud) {
29+
std::shared_ptr<open3d::geometry::PointCloud> o3dPointCloud = dfPointCloud.Cvt2O3DPointCloud();
30+
std::shared_ptr<diffCheck::geometry::DFPointCloud> dfPointCloud2 = std::make_shared<diffCheck::geometry::DFPointCloud>();
31+
32+
dfPointCloud2->Cvt2DFPointCloud(o3dPointCloud);
33+
34+
EXPECT_EQ(dfPointCloud.GetNumPoints(), dfPointCloud2->GetNumPoints());
35+
EXPECT_EQ(dfPointCloud.GetNumColors(), dfPointCloud2->GetNumColors());
36+
EXPECT_EQ(dfPointCloud.GetNumNormals(), dfPointCloud2->GetNumNormals());
37+
}
38+
39+
// TODO: cilantro cloud convertion test + new methods
40+
41+
TEST_F(DFPointCloudTestFixture, ComputeAABB) {
42+
std::vector<Eigen::Vector3d> bbox = dfPointCloud.ComputeBoundingBox();
43+
EXPECT_EQ(bbox.size(), 2);
44+
}
45+
46+
TEST_F(DFPointCloudTestFixture, ComputeOBB) {
47+
std::vector<Eigen::Vector3d> obb = dfPointCloud.GetTightBoundingBox();
48+
EXPECT_EQ(obb.size(), 8);
49+
}
50+
51+
TEST_F(DFPointCloudTestFixture, GetNumPoints){
2952
EXPECT_EQ(dfPointCloud.GetNumPoints(), 1);
3053
}
3154

@@ -47,9 +70,4 @@ TEST_F(DFPointCloudTestFixture, HasColors) {
4770

4871
TEST_F(DFPointCloudTestFixture, HasNormals) {
4972
EXPECT_TRUE(dfPointCloud.HasNormals());
50-
}
51-
52-
// int main(int argc, char **argv) {
53-
// ::testing::InitGoogleTest(&argc, argv);
54-
// return RUN_ALL_TESTS();
55-
// }
73+
}

0 commit comments

Comments
 (0)