tests: Infrastructure for unit tests

This commit is contained in:
MerryMage 2016-03-20 14:58:24 +00:00
parent 25dfc94cb4
commit 12da8ebc2e
4 changed files with 10487 additions and 0 deletions

10445
externals/catch/catch.hpp vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -5,6 +5,7 @@ add_subdirectory(common)
add_subdirectory(core) add_subdirectory(core)
add_subdirectory(video_core) add_subdirectory(video_core)
add_subdirectory(audio_core) add_subdirectory(audio_core)
add_subdirectory(tests)
if (ENABLE_SDL2) if (ENABLE_SDL2)
add_subdirectory(citra) add_subdirectory(citra)
endif() endif()

32
src/tests/CMakeLists.txt Normal file
View File

@ -0,0 +1,32 @@
set(SRCS
tests.cpp
)
set(HEADERS
)
create_directory_groups(${SRCS} ${HEADERS})
include_directories(../../externals/catch)
add_executable(tests ${SRCS} ${HEADERS})
target_link_libraries(tests core video_core audio_core common)
target_link_libraries(tests ${SDL2_LIBRARY} ${OPENGL_gl_LIBRARY} inih glad)
if (MSVC)
target_link_libraries(tests getopt)
endif()
target_link_libraries(tests ${PLATFORM_LIBRARIES})
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|OpenBSD|NetBSD")
install(TARGETS tests RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
endif()
if (MSVC)
include(WindowsCopyFiles)
set(DLL_DEST "${CMAKE_BINARY_DIR}/bin/$<CONFIG>/")
windows_copy_files(tests ${SDL2_DLL_DIR} ${DLL_DEST} SDL2.dll)
unset(DLL_DEST)
endif()

9
src/tests/tests.cpp Normal file
View File

@ -0,0 +1,9 @@
// Copyright 2016 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#define CATCH_CONFIG_MAIN
#include <catch.hpp>
// Catch provides the main function since we've given it the
// CATCH_CONFIG_MAIN preprocessor directive.