add unittests for default double vec type

This commit is contained in:
Max Lyon
2019-10-22 10:17:12 +02:00
parent a15f247a6f
commit 2343577636
4 changed files with 75 additions and 13 deletions

View File

@@ -119,6 +119,8 @@ unittests.exe --gtest_output=xml
unittests_customvec.exe --gtest_output=xml unittests_customvec.exe --gtest_output=xml
unittests_doublevec.exe --gtest_output=xml
cd .. cd ..
cd .. cd ..
@@ -147,6 +149,8 @@ unittests.exe --gtest_output=xml
unittests_customvec.exe --gtest_output=xml unittests_customvec.exe --gtest_output=xml
unittests_doublevec.exe --gtest_output=xml
IF %errorlevel% NEQ 0 exit /b %errorlevel% IF %errorlevel% NEQ 0 exit /b %errorlevel%
cd .. cd ..

View File

@@ -87,6 +87,8 @@ make $MAKE_OPTIONS
#build the unit tests #build the unit tests
make $MAKE_OPTIONS unittests make $MAKE_OPTIONS unittests
cd Unittests
echo -e "${OUTPUT}" echo -e "${OUTPUT}"
echo "" echo ""
echo "======================================================================" echo "======================================================================"
@@ -94,8 +96,6 @@ echo "Running unittests Release version with vectorchecks enabled"
echo "======================================================================" echo "======================================================================"
echo -e "${NC}" echo -e "${NC}"
cd Unittests
#execute tests #execute tests
./unittests --gtest_color=yes --gtest_output=xml ./unittests --gtest_color=yes --gtest_output=xml
@@ -106,8 +106,19 @@ echo "Running unittests Release version with custom vector type"
echo "======================================================================" echo "======================================================================"
echo -e "${NC}" echo -e "${NC}"
#execute tests
./unittests_customvec --gtest_color=yes --gtest_output=xml ./unittests_customvec --gtest_color=yes --gtest_output=xml
echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
echo "Running unittests Release version with double vector type"
echo "======================================================================"
echo -e "${NC}"
#execute tests
./unittests_doublevec --gtest_color=yes --gtest_output=xml
cd .. cd ..
cd .. cd ..
@@ -133,6 +144,8 @@ make $MAKE_OPTIONS
#build the unit tests #build the unit tests
make $MAKE_OPTIONS unittests make $MAKE_OPTIONS unittests
cd Unittests
echo -e "${OUTPUT}" echo -e "${OUTPUT}"
echo "" echo ""
echo "======================================================================" echo "======================================================================"
@@ -140,9 +153,6 @@ echo "Running unittests Debug version with vectorchecks enabled"
echo "======================================================================" echo "======================================================================"
echo -e "${NC}" echo -e "${NC}"
cd Unittests
#execute tests #execute tests
./unittests --gtest_color=yes --gtest_output=xml ./unittests --gtest_color=yes --gtest_output=xml
@@ -153,7 +163,18 @@ echo "Running unittests Debug version with custom vector type"
echo "======================================================================" echo "======================================================================"
echo -e "${NC}" echo -e "${NC}"
#execute tests
./unittests_customvec --gtest_color=yes --gtest_output=xml ./unittests_customvec --gtest_color=yes --gtest_output=xml
echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
echo "Running unittests Debug version with double vector type"
echo "======================================================================"
echo -e "${NC}"
#execute tests
./unittests_doublevec --gtest_color=yes --gtest_output=xml
cd .. cd ..
cd .. cd ..

View File

@@ -69,6 +69,8 @@ make
#build the unit tests #build the unit tests
make unittests make unittests
cd Unittests
echo -e "${OUTPUT}" echo -e "${OUTPUT}"
echo "" echo ""
echo "======================================================================" echo "======================================================================"
@@ -76,8 +78,6 @@ echo "Running unittests Release version with vectorchecks enabled"
echo "======================================================================" echo "======================================================================"
echo -e "${NC}" echo -e "${NC}"
cd Unittests
#execute tests #execute tests
./unittests --gtest_color=yes --gtest_output=xml ./unittests --gtest_color=yes --gtest_output=xml
@@ -88,8 +88,19 @@ echo "Running unittests Release version with minimal vector type"
echo "======================================================================" echo "======================================================================"
echo -e "${NC}" echo -e "${NC}"
#execute tests
./unittests_customvec --gtest_color=yes --gtest_output=xml ./unittests_customvec --gtest_color=yes --gtest_output=xml
echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
echo "Running unittests Release version with double vector type"
echo "======================================================================"
echo -e "${NC}"
#execute tests
./unittests_doublevec --gtest_color=yes --gtest_output=xml
cd .. cd ..
cd .. cd ..
@@ -115,6 +126,8 @@ make
#build the unit tests #build the unit tests
make unittests make unittests
cd Unittests
echo -e "${OUTPUT}" echo -e "${OUTPUT}"
echo "" echo ""
echo "======================================================================" echo "======================================================================"
@@ -122,9 +135,6 @@ echo "Running unittests Debug version with vectorchecks enabled"
echo "======================================================================" echo "======================================================================"
echo -e "${NC}" echo -e "${NC}"
cd Unittests
#execute tests #execute tests
./unittests --gtest_color=yes --gtest_output=xml ./unittests --gtest_color=yes --gtest_output=xml
@@ -135,8 +145,19 @@ echo "Running unittests Debug version with minimal vector type"
echo "======================================================================" echo "======================================================================"
echo -e "${NC}" echo -e "${NC}"
#execute tests
./unittests_customvec --gtest_color=yes --gtest_output=xml ./unittests_customvec --gtest_color=yes --gtest_output=xml
echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
echo "Running unittests Debug version with double vector type"
echo "======================================================================"
echo -e "${NC}"
#execute tests
./unittests_doublevec --gtest_color=yes --gtest_output=xml
cd .. cd ..
cd .. cd ..

View File

@@ -41,20 +41,25 @@ if ( OPENMESH_BUILD_UNIT_TESTS )
# Create unittest executable # Create unittest executable
acg_add_executable(unittests ${UNITTEST_SRC}) acg_add_executable(unittests ${UNITTEST_SRC})
acg_add_executable(unittests_customvec ${UNITTEST_SRC}) acg_add_executable(unittests_customvec ${UNITTEST_SRC})
acg_add_executable(unittests_doublevec ${UNITTEST_SRC})
target_compile_definitions(unittests_customvec PRIVATE TEST_CUSTOM_TRAITS) target_compile_definitions(unittests_customvec PRIVATE TEST_CUSTOM_TRAITS)
target_compile_definitions(unittests_doublevec PRIVATE TEST_DOUBLE_TRAITS)
# For the unittest we don't want the install rpath as set by acg_add_executable # For the unittest we don't want the install rpath as set by acg_add_executable
set_target_properties ( unittests PROPERTIES BUILD_WITH_INSTALL_RPATH 0 ) set_target_properties ( unittests PROPERTIES BUILD_WITH_INSTALL_RPATH 0 )
set_target_properties ( unittests_customvec PROPERTIES BUILD_WITH_INSTALL_RPATH 0 ) set_target_properties ( unittests_customvec PROPERTIES BUILD_WITH_INSTALL_RPATH 0 )
set_target_properties ( unittests_doublevec PROPERTIES BUILD_WITH_INSTALL_RPATH 0 )
# Set output directory to ${BINARY_DIR}/Unittests # Set output directory to ${BINARY_DIR}/Unittests
set (OUTPUT_DIR "${CMAKE_BINARY_DIR}/Unittests") set (OUTPUT_DIR "${CMAKE_BINARY_DIR}/Unittests")
set_target_properties(unittests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR}) set_target_properties(unittests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR})
set_target_properties(unittests_customvec PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR}) set_target_properties(unittests_customvec PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR})
set_target_properties(unittests_doublevec PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR})
foreach(CONFIG ${CMAKE_CONFIGURATION_TYPES}) foreach(CONFIG ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${CONFIG} UPCONFIG) string(TOUPPER ${CONFIG} UPCONFIG)
set_target_properties(unittests PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${UPCONFIG} ${OUTPUT_DIR}) set_target_properties(unittests PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${UPCONFIG} ${OUTPUT_DIR})
set_target_properties(unittests_customvec PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${UPCONFIG} ${OUTPUT_DIR}) set_target_properties(unittests_customvec PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${UPCONFIG} ${OUTPUT_DIR})
set_target_properties(unittests_doublevec PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${UPCONFIG} ${OUTPUT_DIR})
endforeach() endforeach()
@@ -62,6 +67,7 @@ if ( OPENMESH_BUILD_UNIT_TESTS )
# Link against all necessary libraries # Link against all necessary libraries
target_link_libraries(unittests OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread) target_link_libraries(unittests OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread)
target_link_libraries(unittests_customvec OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread) target_link_libraries(unittests_customvec OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread)
target_link_libraries(unittests_doublevec OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread)
@@ -73,6 +79,7 @@ if ( OPENMESH_BUILD_UNIT_TESTS )
endif() endif()
target_link_libraries(unittests OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES}) target_link_libraries(unittests OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
target_link_libraries(unittests_customvec OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES}) target_link_libraries(unittests_customvec OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
target_link_libraries(unittests_doublevec OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
endif() endif()
@@ -81,10 +88,12 @@ if ( OPENMESH_BUILD_UNIT_TESTS )
# Set compiler flags # Set compiler flags
set_target_properties(unittests PROPERTIES COMPILE_FLAGS "-g -pedantic -Wno-long-long") set_target_properties(unittests PROPERTIES COMPILE_FLAGS "-g -pedantic -Wno-long-long")
set_target_properties(unittests_customvec PROPERTIES COMPILE_FLAGS "-g -pedantic -Wno-long-long") set_target_properties(unittests_customvec PROPERTIES COMPILE_FLAGS "-g -pedantic -Wno-long-long")
set_target_properties(unittests_doublevec PROPERTIES COMPILE_FLAGS "-g -pedantic -Wno-long-long")
else() else()
# Set compiler flags # Set compiler flags
set_target_properties(unittests PROPERTIES COMPILE_FLAGS "" ) set_target_properties(unittests PROPERTIES COMPILE_FLAGS "" )
set_target_properties(unittests_customvec PROPERTIES COMPILE_FLAGS "" ) set_target_properties(unittests_customvec PROPERTIES COMPILE_FLAGS "" )
set_target_properties(unittests_doublevec PROPERTIES COMPILE_FLAGS "" )
endif() endif()
if ( OPENMESH_BUILD_SHARED ) if ( OPENMESH_BUILD_SHARED )
@@ -103,14 +112,21 @@ if ( OPENMESH_BUILD_UNIT_TESTS )
"$<TARGET_FILE:${TAR}>" "$<TARGET_FILE:${TAR}>"
"${CMAKE_BINARY_DIR}/Unittests/$<TARGET_FILE_NAME:${TAR}>" "${CMAKE_BINARY_DIR}/Unittests/$<TARGET_FILE_NAME:${TAR}>"
COMMENT "Copying OpenMesh targets to unittests directory") COMMENT "Copying OpenMesh targets to unittests directory")
add_custom_command(TARGET unittests_doublevec POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy
"$<TARGET_FILE:${TAR}>"
"${CMAKE_BINARY_DIR}/Unittests/$<TARGET_FILE_NAME:${TAR}>"
COMMENT "Copying OpenMesh targets to unittests directory")
endforeach(TAR) endforeach(TAR)
endif() endif()
acg_copy_after_build(unittests ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles ${CMAKE_BINARY_DIR}/Unittests/) acg_copy_after_build(unittests ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles ${CMAKE_BINARY_DIR}/Unittests/)
acg_copy_after_build(unittests_customvec ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles ${CMAKE_BINARY_DIR}/Unittests/) acg_copy_after_build(unittests_customvec ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles ${CMAKE_BINARY_DIR}/Unittests/)
acg_copy_after_build(unittests_doublevec ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles ${CMAKE_BINARY_DIR}/Unittests/)
add_test(NAME AllTestsIn_OpenMesh_tests WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Unittests" COMMAND "${CMAKE_BINARY_DIR}/Unittests/unittests") add_test(NAME AllTestsIn_OpenMesh_tests WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Unittests" COMMAND "${CMAKE_BINARY_DIR}/Unittests/unittests")
add_test(NAME AllTestsIn_OpenMesh_tests_with_minimal_vector WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Unittests" COMMAND "${CMAKE_BINARY_DIR}/Unittests/unittests_customvec") add_test(NAME AllTestsIn_OpenMesh_tests_with_minimal_vector WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Unittests" COMMAND "${CMAKE_BINARY_DIR}/Unittests/unittests_customvec")
add_test(NAME AllTestsIn_OpenMesh_tests_with_double_vector WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Unittests" COMMAND "${CMAKE_BINARY_DIR}/Unittests/unittests_doublevec")
else(GTEST_FOUND) else(GTEST_FOUND)
message(STATUS "Google testing framework was not found, unittests disabled.") message(STATUS "Google testing framework was not found, unittests disabled.")