Commit 88fc421d authored by Yuelong Yu's avatar Yuelong Yu
Browse files

added test folder

parent d138f10f
# The Googletest integration code is adapted from
# https://github.com/kaizouman/gtest-cmake-example/blob/master/test/CMakeLists.txt
include(ExternalProject)
ExternalProject_Add(gtest
# use release version only
URL https://github.com/google/googletest/archive/release-1.8.0.zip
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/googletest
# Disable installation
INSTALL_COMMAND ""
)
ExternalProject_Get_Property(gtest source_dir binary_dir)
# Create library targets and add dependencies/properties/includes
add_library(libgtest IMPORTED STATIC GLOBAL)
add_dependencies(libgtest gtest)
set_target_properties(libgtest PROPERTIES
"IMPORTED_LOCATION" "${binary_dir}/googlemock/gtest/libgtest.a"
)
add_library(libgmock IMPORTED STATIC GLOBAL)
add_dependencies(libgmock gtest)
set_target_properties(libgmock PROPERTIES
"IMPORTED_LOCATION" "${binary_dir}/googlemock/libgmock.a"
)
include_directories(
"${source_dir}/googletest/include"
"${source_dir}/googlemock/include"
)
#copy necessary files for testing
#file(COPY testdata DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
#add src
add_subdirectory("src")
function(add executable source_files)
add_executable(${executable} ${source_files})
target_link_libraries(${executable}
agipdrecv
libgtest
libgmock
)
add_test(NAME ${executable} COMMAND ${executable})
endfunction()
#copy necessary files for testing
#file(COPY ../testdata DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
# All Tests#######################################
# set(MODULETEST_NAME "moduletest")
# set(MODULETEST_SRC
# ModuleTest.cpp
# TestUtils.cpp
# main.cpp)
# set(CONFIGTEST_NAME "configurationtest")
# set(CONFIGTEST_SRC
# ConfigReaderTest.cpp
# TestUtils.cpp
# main.cpp)
# set(COMPRESSIONTEST_NAME "compressiontest")
# set(COMPRESSIONTEST_SRC
# CompressionTest.cpp
# TestUtils.cpp
# main.cpp)
# set(DECODERTEST_NAME "imagedecodertest")
# set(DECODERTEST_SRC
# ImageDecoderTest.cpp
# TestUtils.cpp
# main.cpp)
# set(DCTEST_NAME "distortioncorrectiontest")
# set(DCTEST_SRC
# DistortionCorrectorTest.cpp
# TestUtils.cpp
# main.cpp)
# #add tests
# add("${MODULETEST_NAME}" "${MODULETEST_SRC}")
# add("${CONFIGTEST_NAME}" "${CONFIGTEST_SRC}")
# add("${COMPRESSIONTEST_NAME}" "${COMPRESSIONTEST_SRC}")
# add("${DECODERTEST_NAME}" "${DECODERTEST_SRC}")
# add("${DCTEST_NAME}" "${DCTEST_SRC}")
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment