0
0
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:
Roland Bock 2021-10-11 10:15:16 +02:00
parent 4a8c941916
commit 8572c821aa
16 changed files with 50 additions and 50 deletions

View File

@ -156,6 +156,4 @@ install(
### Tests ### Tests
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
add_subdirectory(tests) add_subdirectory(tests)
add_subdirectory(test_types)
add_subdirectory(test_scripts)
endif() endif()

View File

@ -35,3 +35,4 @@ if(SQLITE3_CONNECTOR OR SQLCIPHER_CONNECTOR)
add_subdirectory(sqlite3) add_subdirectory(sqlite3)
endif() endif()
add_subdirectory(scripts)

View File

@ -25,5 +25,6 @@ add_subdirectory(usage)
add_subdirectory(serialize) add_subdirectory(serialize)
add_subdirectory(constraints) add_subdirectory(constraints)
add_subdirectory(static_asserts) add_subdirectory(static_asserts)
add_subdirectory(types)

View File

@ -23,7 +23,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
function(test_constraint name pattern) function(test_constraint name pattern)
set(test sqlpp11.test_constraints.${name}) set(test sqlpp11.core.constraints.${name})
set(target sqlpp11_${name}) set(target sqlpp11_${name})
add_executable(${target} EXCLUDE_FROM_ALL ${name}.cpp) add_executable(${target} EXCLUDE_FROM_ALL ${name}.cpp)
target_link_libraries(${target} PRIVATE sqlpp11 sqlpp11_testing) target_link_libraries(${target} PRIVATE sqlpp11 sqlpp11_testing)

View File

@ -1,4 +1,4 @@
# Copyright (c) 2013-2017, Roland Bock # Copyright (c) 2013-2021, Roland Bock
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without modification, # 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 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
set(test_serializer_names set(test_names
As As
Blob Blob
CustomQuery CustomQuery
@ -38,9 +38,9 @@ set(test_serializer_names
ParameterizedVerbatim ParameterizedVerbatim
) )
create_test_sourcelist(test_serializer_sources test_serializer_main.cpp ${test_serializer_names}) create_test_sourcelist(test_sources test_serializer_main.cpp ${test_names})
add_executable(sqlpp11_test_serializer ${test_serializer_sources}) add_executable(sqlpp11_core_serialize ${test_sources})
target_link_libraries(sqlpp11_test_serializer PRIVATE sqlpp11 sqlpp11_testing) target_link_libraries(sqlpp11_core_serialize PRIVATE sqlpp11 sqlpp11_testing)
# conditionally bump to a higher C++ standard to test compatibility # conditionally bump to a higher C++ standard to test compatibility
if (SQLPP11_TESTS_CXX_STD) if (SQLPP11_TESTS_CXX_STD)
@ -49,9 +49,9 @@ if (SQLPP11_TESTS_CXX_STD)
set_property(TARGET sqlpp11_test_serializer PROPERTY CXX_EXTENSIONS no) set_property(TARGET sqlpp11_test_serializer PROPERTY CXX_EXTENSIONS no)
endif() endif()
foreach(test_serializer IN LISTS test_serializer_names) foreach(test IN LISTS test_names)
add_test(NAME sqlpp11.test_serializer.${test_serializer} add_test(NAME sqlpp11.core.serialize.${test}
COMMAND sqlpp11_test_serializer ${test_serializer} COMMAND sqlpp11_core_serialize ${test}
) )
endforeach() endforeach()

View File

@ -55,18 +55,18 @@ endif()
create_test_sourcelist(test_sources test_main.cpp ${test_names}) create_test_sourcelist(test_sources test_main.cpp ${test_names})
add_executable(sqlpp11_tests ${test_sources}) add_executable(sqlpp11_core_tests ${test_sources})
target_link_libraries(sqlpp11_tests PRIVATE sqlpp11 sqlpp11_testing) target_link_libraries(sqlpp11_core_tests PRIVATE sqlpp11 sqlpp11_testing)
# conditionally bump to a higher C++ standard to test compatibility # conditionally bump to a higher C++ standard to test compatibility
if (SQLPP11_TESTS_CXX_STD) if (SQLPP11_TESTS_CXX_STD)
set_property(TARGET sqlpp11_tests PROPERTY CXX_STANDARD ${SQLPP11_TESTS_CXX_STD}) set_property(TARGET sqlpp11_core_tests PROPERTY CXX_STANDARD ${SQLPP11_TESTS_CXX_STD})
set_property(TARGET sqlpp11_tests PROPERTY CXX_STANDARD_REQUIRED yes) set_property(TARGET sqlpp11_core_tests PROPERTY CXX_STANDARD_REQUIRED yes)
set_property(TARGET sqlpp11_tests PROPERTY CXX_EXTENSIONS no) set_property(TARGET sqlpp11_core_tests PROPERTY CXX_EXTENSIONS no)
endif() endif()
foreach(test IN LISTS test_names) foreach(test IN LISTS test_names)
add_test(NAME sqlpp11.tests.${test} add_test(NAME sqlpp11.core.usage.${test}
COMMAND sqlpp11_tests ${test} COMMAND sqlpp11_core_tests ${test}
) )
endforeach() endforeach()

View File

@ -61,7 +61,7 @@ set_property(TARGET sqlpp11_mysql_tests PROPERTY CXX_STANDARD_REQUIRED yes)
endif() endif()
foreach(test IN LISTS test_names) 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} COMMAND sqlpp11_mysql_tests ${test}
) )
endforeach() endforeach()

View File

@ -38,45 +38,45 @@ if (${Python3_Interpreter_FOUND})
else() else()
message(STATUS "Pyparsing is installed: Enabling ddl2cpp tests.") message(STATUS "Pyparsing is installed: Enabling ddl2cpp tests.")
add_test(NAME sqlpp11.test.ddl2cpp.bad_will_fail add_test(NAME sqlpp11.scripts.ddl2cpp.bad_will_fail
COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../scripts/ddl2cpp" -fail-on-parse COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../../scripts/ddl2cpp" -fail-on-parse
"${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_bad.sql" "${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_bad.sql"
"${CMAKE_CURRENT_BINARY_DIR}/fail" "${CMAKE_CURRENT_BINARY_DIR}/fail"
test) test)
set_tests_properties(sqlpp11.test.ddl2cpp.bad_will_fail PROPERTIES WILL_FAIL 1) set_tests_properties(sqlpp11.scripts.ddl2cpp.bad_will_fail PROPERTIES WILL_FAIL 1)
add_test(NAME sqlpp11.test.ddl2cpp.bad_has_parse_error add_test(NAME sqlpp11.scripts.ddl2cpp.bad_has_parse_error
COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../scripts/ddl2cpp" -fail-on-parse COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../../scripts/ddl2cpp" -fail-on-parse
"${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_bad.sql" "${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_bad.sql"
"${CMAKE_CURRENT_BINARY_DIR}/fail" "${CMAKE_CURRENT_BINARY_DIR}/fail"
test) test)
set_tests_properties(sqlpp11.test.ddl2cpp.bad_has_parse_error PROPERTIES PASS_REGULAR_EXPRESSION "Parsing error,.*") set_tests_properties(sqlpp11.scripts.ddl2cpp.bad_has_parse_error PROPERTIES PASS_REGULAR_EXPRESSION "Parsing error,.*")
add_test(NAME sqlpp11.test.ddl2cpp.good_succeeds add_test(NAME sqlpp11.scripts.ddl2cpp.good_succeeds
COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../scripts/ddl2cpp" -fail-on-parse COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../../scripts/ddl2cpp" -fail-on-parse
"${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_good.sql" "${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_good.sql"
"${CMAKE_CURRENT_BINARY_DIR}/fail" "${CMAKE_CURRENT_BINARY_DIR}/fail"
test) test)
foreach(sample_name sample sample_identity_naming) 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}) include_directories(${CMAKE_CURRENT_BINARY_DIR})
set(use_identity_naming) set(use_identity_naming)
if(sample_name STREQUAL "sample_identity_naming") if(sample_name STREQUAL "sample_identity_naming")
set(use_identity_naming -identity-naming) set(use_identity_naming -identity-naming)
endif() endif()
add_custom_command( add_custom_command(
OUTPUT "${sqlpp.test.generated.sample.include}.h" OUTPUT "${sqlpp.scripts.generated.sample.include}.h"
COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../scripts/ddl2cpp" COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../../scripts/ddl2cpp"
${use_identity_naming} ${use_identity_naming}
"${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_good.sql" "${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_good.sql"
"${sqlpp.test.generated.sample.include}" "${sqlpp.scripts.generated.sample.include}"
test test
DEPENDS "${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_good.sql" DEPENDS "${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_good.sql"
VERBATIM) VERBATIM)
add_executable(sqlpp.test.compiled.${sample_name} ${sample_name}.cpp "${sqlpp.test.generated.sample.include}.h") add_executable(sqlpp.scripts.compiled.${sample_name} ${sample_name}.cpp "${sqlpp.scripts.generated.sample.include}.h")
target_link_libraries(sqlpp.test.compiled.${sample_name} PRIVATE sqlpp11) target_link_libraries(sqlpp.scripts.compiled.${sample_name} PRIVATE sqlpp11)
endforeach() endforeach()
endif() endif()

View File

@ -62,7 +62,7 @@ if (SQLPP11_TESTS_CXX_STD)
endif() endif()
foreach(test IN LISTS test_names) 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} COMMAND sqlpp11_sqlite3_tests ${test}
) )
endforeach() endforeach()

View File

@ -107,7 +107,7 @@ int Integral(int, char*[])
require_equal(__LINE__, rows.front().unsignedValue.value(), uint64_t_value_unsupported); require_equal(__LINE__, rows.front().unsignedValue.value(), uint64_t_value_unsupported);
rows.pop_front(); 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); require_equal(__LINE__, rows.front().unsignedValue.value(), size_t_value_max);
rows.pop_front(); rows.pop_front();