forked from diffCheckOrg/diffCheck
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request diffCheckOrg#36 from diffCheckOrg/test_suite
MERGE: Test suite structure + fixes
- Loading branch information
Showing
10 changed files
with
142 additions
and
120 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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
REM configure the project | ||
cmake -S . -B build | ||
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release |
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
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
Empty file.
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 |
---|---|---|
@@ -1,21 +1,73 @@ | ||
#include <filesystem> | ||
|
||
#include <gtest/gtest.h> | ||
#include "diffCheck.hh" | ||
|
||
class DFPointCloudTestFixture : public ::testing::Test { | ||
protected: | ||
std::vector<Eigen::Vector3d> points; | ||
std::vector<Eigen::Vector3d> colors; | ||
std::vector<Eigen::Vector3d> normals; | ||
diffCheck::geometry::DFPointCloud dfPointCloud; | ||
|
||
DFPointCloudTestFixture() : dfPointCloud(points, colors, normals) {} | ||
|
||
void SetUp() override { | ||
std::filesystem::path path = std::filesystem::path(__FILE__).parent_path(); | ||
std::filesystem::path pathCloud = path / "test_data" / "cloud.ply"; | ||
|
||
dfPointCloud = diffCheck::geometry::DFPointCloud(); | ||
dfPointCloud.LoadFromPLY(pathCloud.string()); | ||
} | ||
|
||
void TearDown() override { | ||
// Clean up any resources if needed | ||
} | ||
}; | ||
|
||
TEST_F(DFPointCloudTestFixture, ConvertionO3dPointCloud) { | ||
std::shared_ptr<open3d::geometry::PointCloud> o3dPointCloud = dfPointCloud.Cvt2O3DPointCloud(); | ||
std::shared_ptr<diffCheck::geometry::DFPointCloud> dfPointCloud2 = std::make_shared<diffCheck::geometry::DFPointCloud>(); | ||
|
||
dfPointCloud2->Cvt2DFPointCloud(o3dPointCloud); | ||
|
||
EXPECT_EQ(dfPointCloud.GetNumPoints(), dfPointCloud2->GetNumPoints()); | ||
EXPECT_EQ(dfPointCloud.GetNumColors(), dfPointCloud2->GetNumColors()); | ||
EXPECT_EQ(dfPointCloud.GetNumNormals(), dfPointCloud2->GetNumNormals()); | ||
} | ||
|
||
// TODO: cilantro cloud convertion test + new methods | ||
|
||
TEST(DFPointCloudTest, TestConstructor) { | ||
std::vector<Eigen::Vector3d> points = {Eigen::Vector3d(1, 2, 3)}; | ||
std::vector<Eigen::Vector3d> colors = {Eigen::Vector3d(255, 255, 255)}; | ||
std::vector<Eigen::Vector3d> normals = {Eigen::Vector3d(0, 0, 1)}; | ||
TEST_F(DFPointCloudTestFixture, ComputeAABB) { | ||
std::vector<Eigen::Vector3d> bbox = dfPointCloud.ComputeBoundingBox(); | ||
EXPECT_EQ(bbox.size(), 2); | ||
} | ||
|
||
TEST_F(DFPointCloudTestFixture, ComputeOBB) { | ||
std::vector<Eigen::Vector3d> obb = dfPointCloud.GetTightBoundingBox(); | ||
EXPECT_EQ(obb.size(), 8); | ||
} | ||
|
||
TEST_F(DFPointCloudTestFixture, GetNumPoints){ | ||
EXPECT_EQ(dfPointCloud.GetNumPoints(), 1); | ||
} | ||
|
||
diffCheck::geometry::DFPointCloud dfPointCloud(points, colors, normals); | ||
TEST_F(DFPointCloudTestFixture, GetNumColors) { | ||
EXPECT_EQ(dfPointCloud.GetNumColors(), 1); | ||
} | ||
|
||
TEST_F(DFPointCloudTestFixture, GetNumNormals) { | ||
EXPECT_EQ(dfPointCloud.GetNumNormals(), 1); | ||
} | ||
|
||
TEST_F(DFPointCloudTestFixture, HasPoints) { | ||
EXPECT_TRUE(dfPointCloud.HasPoints()); | ||
} | ||
|
||
// Verify that the points, colors, and normals are set correctly | ||
EXPECT_EQ(dfPointCloud.Points[0], points[0]); | ||
EXPECT_EQ(dfPointCloud.Colors[0], colors[0]); | ||
EXPECT_EQ(dfPointCloud.Normals[0], normals[0]); | ||
TEST_F(DFPointCloudTestFixture, HasColors) { | ||
EXPECT_TRUE(dfPointCloud.HasColors()); | ||
} | ||
|
||
int main(int argc, char **argv) { | ||
::testing::InitGoogleTest(&argc, argv); | ||
return RUN_ALL_TESTS(); | ||
TEST_F(DFPointCloudTestFixture, HasNormals) { | ||
EXPECT_TRUE(dfPointCloud.HasNormals()); | ||
} |