added tests for backends
This commit is contained in:
@@ -18,6 +18,8 @@ set(SOURCES
|
||||
|
||||
set(LIBRARY_TARGET matador-postgres)
|
||||
|
||||
add_subdirectory(test)
|
||||
|
||||
add_library(${LIBRARY_TARGET} MODULE ${SOURCES} ${HEADER})
|
||||
|
||||
set_target_properties(${LIBRARY_TARGET}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
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)
|
||||
|
||||
SET(POSTGRES_CONNECTION_STRING "postgresql://test:test123@127.0.0.1/matador_test" CACHE STRING "postgresql connection string")
|
||||
|
||||
CONFIGURE_FILE(Connection.hpp.in ${PROJECT_BINARY_DIR}/backends/postgres/test/connection.hpp @ONLY IMMEDIATE)
|
||||
|
||||
MESSAGE(STATUS "postgresql connection string: ${POSTGRES_CONNECTION_STRING}")
|
||||
MESSAGE(STATUS "current binary dir: ${CMAKE_CURRENT_BINARY_DIR}")
|
||||
|
||||
set(TEST_SOURCES ../../tests/QueryTest.cpp)
|
||||
|
||||
set(LIBRARY_TEST_TARGET postgres_tests)
|
||||
|
||||
add_executable(${LIBRARY_TEST_TARGET} ${TEST_SOURCES})
|
||||
|
||||
target_link_libraries(${LIBRARY_TEST_TARGET} PRIVATE
|
||||
Catch2::Catch2WithMain
|
||||
matador
|
||||
${CMAKE_DL_LIBS}
|
||||
${PostgreSQL_LIBRARY})
|
||||
|
||||
target_include_directories(${LIBRARY_TEST_TARGET}
|
||||
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>/include
|
||||
PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_test(NAME matador_postgres_tests COMMAND ${LIBRARY_TEST_TARGET})
|
||||
@@ -0,0 +1,10 @@
|
||||
#ifndef POSTGRES_CONNECTION_HPP
|
||||
#define POSTGRES_CONNECTION_HPP
|
||||
|
||||
#define MATADOR_DB_TYPE "Postgres"
|
||||
|
||||
namespace matador::test::connection {
|
||||
const char* const dns = "@POSTGRES_CONNECTION_STRING@";
|
||||
}
|
||||
|
||||
#endif /*POSTGRES_CONNECTION_HPP*/
|
||||
Reference in New Issue
Block a user