Skip to content

Commit

Permalink
WIP-MERGE: cleaning from merge diffcheck joint detector
Browse files Browse the repository at this point in the history
  • Loading branch information
9and3 committed Jun 13, 2024
1 parent 394a621 commit b4e6e24
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 12 deletions.
49 changes: 39 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,6 @@ target_include_directories(${APP_NAME_EXE}
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src
)

#--------------------------------------------------------------------------
# Tests
#--------------------------------------------------------------------------

# include(CTest)
# enable_testing()

# add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tests/global_registrations)

#--------------------------------------------------------------------------
# pybind11
#--------------------------------------------------------------------------
Expand Down Expand Up @@ -167,4 +158,42 @@ if (BUILD_PYTHON_MODULE)
)
endforeach()

endif()
endif()

#--------------------------------------------------------------------------
# Tests
#--------------------------------------------------------------------------

# include(CTest)
# enable_testing()
# add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/deps/googletest)
# set(TESTS_OUT_DIR ${CMAKE_BINARY_DIR}/tests/)


# # Unit testing ------------------------------------------------------------
# set(UNIT_TESTS unit_tests)
# add_executable(${UNIT_TESTS} tests/unit_tests/DFPointCloudTest.cc)
# set_target_properties(${UNIT_TESTS} PROPERTIES
# RUNTIME_OUTPUT_DIRECTORY ${TESTS_OUT_DIR}
# )

# target_link_libraries(${UNIT_TESTS} gtest gtest_main)
# target_link_libraries(${UNIT_TESTS} ${SHARED_LIB_NAME})

# add_test(NAME ${UNIT_TESTS} COMMAND ${UNIT_TESTS})

# Integration testing -----------------------------------------------------
# Component testing -------------------------------------------------------
# etc ---------------------------------------------------------------------

# # TODO: a better way to copy the dlls to the tests directory for the tests
# # get all the files -dlls in the bin directory and copy them one by one to tests dir
# file(GLOB files ${CMAKE_BINARY_DIR}/bin/Release/*.dll)
# foreach(file ${files})
# message(STATUS "Copying ${file} to ${TESTS_OUT_DIR}")
# add_custom_command(TARGET ${UNIT_TESTS} POST_BUILD
# COMMAND ${CMAKE_COMMAND} -E copy
# ${file}
# ${TESTS_OUT_DIR}/Release
# )
# endforeach()
2 changes: 1 addition & 1 deletion deps/eigen
Submodule eigen updated from 27f817 to 02bcf9
17 changes: 17 additions & 0 deletions tests/entry_test.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <gtest/gtest.h>

// Function to test
int add(int a, int b) {
return a + b;
}

// Test case
TEST(AddTest, HandlesPositiveInput) {
EXPECT_EQ(6, add(2, 4));
}

// Main function
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
21 changes: 21 additions & 0 deletions tests/unit_tests/DFPointCloudTest.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include <gtest/gtest.h>
#include "diffCheck.hh"


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)};

diffCheck::geometry::DFPointCloud dfPointCloud(points, colors, normals);

// 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]);
}

int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}

0 comments on commit b4e6e24

Please sign in to comment.