mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-15 20:31:16 +08:00
Streamline test names and locations
This commit is contained in:
parent
4a8c941916
commit
8572c821aa
@ -156,6 +156,4 @@ install(
|
||||
### Tests
|
||||
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
|
||||
add_subdirectory(tests)
|
||||
add_subdirectory(test_types)
|
||||
add_subdirectory(test_scripts)
|
||||
endif()
|
||||
|
@ -35,3 +35,4 @@ if(SQLITE3_CONNECTOR OR SQLCIPHER_CONNECTOR)
|
||||
add_subdirectory(sqlite3)
|
||||
endif()
|
||||
|
||||
add_subdirectory(scripts)
|
||||
|
@ -25,5 +25,6 @@ add_subdirectory(usage)
|
||||
add_subdirectory(serialize)
|
||||
add_subdirectory(constraints)
|
||||
add_subdirectory(static_asserts)
|
||||
add_subdirectory(types)
|
||||
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
function(test_constraint name pattern)
|
||||
set(test sqlpp11.test_constraints.${name})
|
||||
set(test sqlpp11.core.constraints.${name})
|
||||
set(target sqlpp11_${name})
|
||||
add_executable(${target} EXCLUDE_FROM_ALL ${name}.cpp)
|
||||
target_link_libraries(${target} PRIVATE sqlpp11 sqlpp11_testing)
|
||||
@ -36,7 +36,7 @@ function(test_constraint name pattern)
|
||||
set_property(TARGET ${target} PROPERTY CXX_STANDARD ${SQLPP11_TESTS_CXX_STD})
|
||||
set_property(TARGET ${target} PROPERTY CXX_STANDARD_REQUIRED yes)
|
||||
set_property(TARGET ${target} PROPERTY CXX_EXTENSIONS no)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Compiling these is required to fail (testing some static_assert)
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2013-2017, Roland Bock
|
||||
# Copyright (c) 2013-2021, Roland Bock
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
@ -22,7 +22,7 @@
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
set(test_serializer_names
|
||||
set(test_names
|
||||
As
|
||||
Blob
|
||||
CustomQuery
|
||||
@ -38,9 +38,9 @@ set(test_serializer_names
|
||||
ParameterizedVerbatim
|
||||
)
|
||||
|
||||
create_test_sourcelist(test_serializer_sources test_serializer_main.cpp ${test_serializer_names})
|
||||
add_executable(sqlpp11_test_serializer ${test_serializer_sources})
|
||||
target_link_libraries(sqlpp11_test_serializer PRIVATE sqlpp11 sqlpp11_testing)
|
||||
create_test_sourcelist(test_sources test_serializer_main.cpp ${test_names})
|
||||
add_executable(sqlpp11_core_serialize ${test_sources})
|
||||
target_link_libraries(sqlpp11_core_serialize PRIVATE sqlpp11 sqlpp11_testing)
|
||||
|
||||
# conditionally bump to a higher C++ standard to test compatibility
|
||||
if (SQLPP11_TESTS_CXX_STD)
|
||||
@ -49,9 +49,9 @@ if (SQLPP11_TESTS_CXX_STD)
|
||||
set_property(TARGET sqlpp11_test_serializer PROPERTY CXX_EXTENSIONS no)
|
||||
endif()
|
||||
|
||||
foreach(test_serializer IN LISTS test_serializer_names)
|
||||
add_test(NAME sqlpp11.test_serializer.${test_serializer}
|
||||
COMMAND sqlpp11_test_serializer ${test_serializer}
|
||||
foreach(test IN LISTS test_names)
|
||||
add_test(NAME sqlpp11.core.serialize.${test}
|
||||
COMMAND sqlpp11_core_serialize ${test}
|
||||
)
|
||||
endforeach()
|
||||
|
||||
|
@ -31,7 +31,7 @@ function(test_compile name)
|
||||
set_property(TARGET sqlpp11_${name} PROPERTY CXX_STANDARD ${SQLPP11_TESTS_CXX_STD})
|
||||
set_property(TARGET sqlpp11_${name} PROPERTY CXX_STANDARD_REQUIRED yes)
|
||||
set_property(TARGET sqlpp11_${name} PROPERTY CXX_EXTENSIONS no)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
test_compile(result_row)
|
@ -55,18 +55,18 @@ endif()
|
||||
|
||||
|
||||
create_test_sourcelist(test_sources test_main.cpp ${test_names})
|
||||
add_executable(sqlpp11_tests ${test_sources})
|
||||
target_link_libraries(sqlpp11_tests PRIVATE sqlpp11 sqlpp11_testing)
|
||||
add_executable(sqlpp11_core_tests ${test_sources})
|
||||
target_link_libraries(sqlpp11_core_tests PRIVATE sqlpp11 sqlpp11_testing)
|
||||
# conditionally bump to a higher C++ standard to test compatibility
|
||||
if (SQLPP11_TESTS_CXX_STD)
|
||||
set_property(TARGET sqlpp11_tests PROPERTY CXX_STANDARD ${SQLPP11_TESTS_CXX_STD})
|
||||
set_property(TARGET sqlpp11_tests PROPERTY CXX_STANDARD_REQUIRED yes)
|
||||
set_property(TARGET sqlpp11_tests PROPERTY CXX_EXTENSIONS no)
|
||||
set_property(TARGET sqlpp11_core_tests PROPERTY CXX_STANDARD ${SQLPP11_TESTS_CXX_STD})
|
||||
set_property(TARGET sqlpp11_core_tests PROPERTY CXX_STANDARD_REQUIRED yes)
|
||||
set_property(TARGET sqlpp11_core_tests PROPERTY CXX_EXTENSIONS no)
|
||||
endif()
|
||||
|
||||
foreach(test IN LISTS test_names)
|
||||
add_test(NAME sqlpp11.tests.${test}
|
||||
COMMAND sqlpp11_tests ${test}
|
||||
add_test(NAME sqlpp11.core.usage.${test}
|
||||
COMMAND sqlpp11_core_tests ${test}
|
||||
)
|
||||
endforeach()
|
||||
|
||||
|
@ -61,7 +61,7 @@ set_property(TARGET sqlpp11_mysql_tests PROPERTY CXX_STANDARD_REQUIRED yes)
|
||||
endif()
|
||||
|
||||
foreach(test IN LISTS test_names)
|
||||
add_test(NAME sqlpp11.mysql.tests.${test}
|
||||
add_test(NAME sqlpp11.mysql.usage.${test}
|
||||
COMMAND sqlpp11_mysql_tests ${test}
|
||||
)
|
||||
endforeach()
|
||||
|
@ -27,56 +27,56 @@ include(FindPython3)
|
||||
if (${Python3_Interpreter_FOUND})
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -c "import pyparsing"
|
||||
RESULT_VARIABLE PythonRESULT
|
||||
OUTPUT_VARIABLE PythonOUTPUT
|
||||
RESULT_VARIABLE PythonRESULT
|
||||
OUTPUT_VARIABLE PythonOUTPUT
|
||||
ERROR_VARIABLE PythonERROR
|
||||
)
|
||||
|
||||
if (${PythonRESULT})
|
||||
if (${PythonRESULT})
|
||||
message(WARNING "Pyparsing is not installed. Disabling ddl2cpp tests")
|
||||
|
||||
else()
|
||||
else()
|
||||
message(STATUS "Pyparsing is installed: Enabling ddl2cpp tests.")
|
||||
|
||||
add_test(NAME sqlpp11.test.ddl2cpp.bad_will_fail
|
||||
COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../scripts/ddl2cpp" -fail-on-parse
|
||||
"${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_bad.sql"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/fail"
|
||||
test)
|
||||
set_tests_properties(sqlpp11.test.ddl2cpp.bad_will_fail PROPERTIES WILL_FAIL 1)
|
||||
add_test(NAME sqlpp11.scripts.ddl2cpp.bad_will_fail
|
||||
COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../../scripts/ddl2cpp" -fail-on-parse
|
||||
"${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_bad.sql"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/fail"
|
||||
test)
|
||||
set_tests_properties(sqlpp11.scripts.ddl2cpp.bad_will_fail PROPERTIES WILL_FAIL 1)
|
||||
|
||||
add_test(NAME sqlpp11.test.ddl2cpp.bad_has_parse_error
|
||||
COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../scripts/ddl2cpp" -fail-on-parse
|
||||
"${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_bad.sql"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/fail"
|
||||
test)
|
||||
set_tests_properties(sqlpp11.test.ddl2cpp.bad_has_parse_error PROPERTIES PASS_REGULAR_EXPRESSION "Parsing error,.*")
|
||||
add_test(NAME sqlpp11.scripts.ddl2cpp.bad_has_parse_error
|
||||
COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../../scripts/ddl2cpp" -fail-on-parse
|
||||
"${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_bad.sql"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/fail"
|
||||
test)
|
||||
set_tests_properties(sqlpp11.scripts.ddl2cpp.bad_has_parse_error PROPERTIES PASS_REGULAR_EXPRESSION "Parsing error,.*")
|
||||
|
||||
add_test(NAME sqlpp11.test.ddl2cpp.good_succeeds
|
||||
COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../scripts/ddl2cpp" -fail-on-parse
|
||||
"${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_good.sql"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/fail"
|
||||
test)
|
||||
add_test(NAME sqlpp11.scripts.ddl2cpp.good_succeeds
|
||||
COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../../scripts/ddl2cpp" -fail-on-parse
|
||||
"${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_good.sql"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/fail"
|
||||
test)
|
||||
|
||||
foreach(sample_name sample sample_identity_naming)
|
||||
set(sqlpp.test.generated.sample.include "${CMAKE_CURRENT_BINARY_DIR}/${sample_name}")
|
||||
set(sqlpp.scripts.generated.sample.include "${CMAKE_CURRENT_BINARY_DIR}/${sample_name}")
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
set(use_identity_naming)
|
||||
if(sample_name STREQUAL "sample_identity_naming")
|
||||
set(use_identity_naming -identity-naming)
|
||||
endif()
|
||||
add_custom_command(
|
||||
OUTPUT "${sqlpp.test.generated.sample.include}.h"
|
||||
COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../scripts/ddl2cpp"
|
||||
OUTPUT "${sqlpp.scripts.generated.sample.include}.h"
|
||||
COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../../scripts/ddl2cpp"
|
||||
${use_identity_naming}
|
||||
"${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_good.sql"
|
||||
"${sqlpp.test.generated.sample.include}"
|
||||
"${sqlpp.scripts.generated.sample.include}"
|
||||
test
|
||||
DEPENDS "${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_good.sql"
|
||||
VERBATIM)
|
||||
|
||||
add_executable(sqlpp.test.compiled.${sample_name} ${sample_name}.cpp "${sqlpp.test.generated.sample.include}.h")
|
||||
target_link_libraries(sqlpp.test.compiled.${sample_name} PRIVATE sqlpp11)
|
||||
add_executable(sqlpp.scripts.compiled.${sample_name} ${sample_name}.cpp "${sqlpp.scripts.generated.sample.include}.h")
|
||||
target_link_libraries(sqlpp.scripts.compiled.${sample_name} PRIVATE sqlpp11)
|
||||
endforeach()
|
||||
|
||||
endif()
|
@ -62,7 +62,7 @@ if (SQLPP11_TESTS_CXX_STD)
|
||||
endif()
|
||||
|
||||
foreach(test IN LISTS test_names)
|
||||
add_test(NAME sqlpp11.sqlite3.tests.${test}
|
||||
add_test(NAME sqlpp11.sqlite3.usage.${test}
|
||||
COMMAND sqlpp11_sqlite3_tests ${test}
|
||||
)
|
||||
endforeach()
|
||||
|
@ -107,7 +107,7 @@ int Integral(int, char*[])
|
||||
require_equal(__LINE__, rows.front().unsignedValue.value(), uint64_t_value_unsupported);
|
||||
rows.pop_front();
|
||||
|
||||
require_equal(__LINE__, rows.front().signedValue.value(), int64_t_value_min);
|
||||
require_equal(__LINE__, rows.front().signedValue.value(), int64_t{});
|
||||
require_equal(__LINE__, rows.front().unsignedValue.value(), size_t_value_max);
|
||||
rows.pop_front();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user