backend tests progress

This commit is contained in:
2024-01-29 07:22:28 +01:00
parent 615143efb0
commit 47848ff674
21 changed files with 410 additions and 27 deletions
+2
View File
@@ -20,6 +20,8 @@ set(SOURCES
set(LIBRARY_TARGET matador-mysql)
add_subdirectory(test)
add_library(${LIBRARY_TARGET} MODULE ${SOURCES} ${HEADER})
set_target_properties(${LIBRARY_TARGET}
+42
View File
@@ -0,0 +1,42 @@
Include(FetchContent)
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.4.0 # or a later release
)
FetchContent_MakeAvailable(Catch2)
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras)
include(CTest)
include(Catch)
set(MYSQL_CONNECTION_STRING "mysql://test:test123!@127.0.0.1:3306/testdb")
configure_file(Connection.hpp.in ${PROJECT_BINARY_DIR}/backends/mysql/test/connection.hpp @ONLY IMMEDIATE)
message(STATUS "mysql connection string: ${MYSQL_CONNECTION_STRING}")
set(TEST_SOURCES
../../tests/QueryTest.cpp
../../tests/SessionTest.cpp
../../tests/ConnectionTest.cpp
../../tests/SessionRecordTest.cpp)
set(LIBRARY_TEST_TARGET mysql_tests)
add_executable(${LIBRARY_TEST_TARGET} ${TEST_SOURCES})
target_link_libraries(${LIBRARY_TEST_TARGET} PRIVATE
Catch2::Catch2WithMain
matador
${CMAKE_DL_LIBS}
${MySQL_LIBRARY})
target_include_directories(${LIBRARY_TEST_TARGET}
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>/include
PRIVATE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>/test
PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
catch_discover_tests(${LIBRARY_TEST_TARGET} TEST_SUFFIX " (MySQL)")
+8
View File
@@ -0,0 +1,8 @@
#ifndef MYSQL_CONNECTION_HPP
#define MYSQL_CONNECTION_HPP
namespace matador::test::connection {
const char* const dns = "@MYSQL_CONNECTION_STRING@";
}
#endif /*SQLITE_CONNECTION_HPP*/