2015-03-09 01:36:42 +08:00
|
|
|
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../tests")
|
2014-08-08 13:57:08 +08:00
|
|
|
|
2014-08-17 00:47:06 +08:00
|
|
|
add_custom_target(test_sqlpp_constraints COMMAND true)
|
|
|
|
|
|
|
|
function(test_constraint name pattern)
|
|
|
|
|
|
|
|
add_executable(
|
2014-09-02 01:17:03 +08:00
|
|
|
"${name}"
|
2014-08-17 00:47:06 +08:00
|
|
|
EXCLUDE_FROM_ALL
|
2014-09-02 01:17:03 +08:00
|
|
|
"${name}.cpp"
|
2014-08-17 00:47:06 +08:00
|
|
|
)
|
|
|
|
|
2014-09-02 01:17:03 +08:00
|
|
|
add_custom_command(OUTPUT "${name}.out"
|
|
|
|
COMMAND "${CMAKE_MAKE_PROGRAM}" "${name}" > "${CMAKE_CURRENT_BINARY_DIR}/${name}.out" 2>&1 || true
|
|
|
|
COMMAND grep "${pattern}" "${CMAKE_CURRENT_BINARY_DIR}/${name}.out" > /dev/null
|
|
|
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${name}.cpp"
|
2014-08-17 00:47:06 +08:00
|
|
|
COMMENT "${name}"
|
2014-09-02 01:17:03 +08:00
|
|
|
VERBATIM)
|
2014-08-17 00:47:06 +08:00
|
|
|
|
2014-09-02 01:17:03 +08:00
|
|
|
add_custom_target("test_${name}" DEPENDS "${name}.out" COMMAND true)
|
2014-08-17 00:47:06 +08:00
|
|
|
|
|
|
|
|
2014-09-02 01:17:03 +08:00
|
|
|
add_dependencies(test_sqlpp_constraints "test_${name}")
|
2014-08-17 00:47:06 +08:00
|
|
|
|
2014-08-19 01:17:59 +08:00
|
|
|
endfunction(test_constraint)
|
2014-08-17 00:47:06 +08:00
|
|
|
|
2015-02-24 15:02:14 +08:00
|
|
|
test_constraint(count_of_count "count() cannot be used on an aggregate function")
|
|
|
|
test_constraint(max_of_max "max() cannot be used on an aggregate function")
|
2014-08-17 00:47:06 +08:00
|
|
|
test_constraint(no_conversion_operator_if_null_not_trivial "int i = row.alpha")
|
|
|
|
test_constraint(require_insert "required column is missing")
|
|
|
|
test_constraint(must_not_insert "one assignment is prohibited")
|
2014-08-19 01:17:59 +08:00
|
|
|
test_constraint(must_not_update "one assignment is prohibited")
|
2014-08-08 13:57:08 +08:00
|
|
|
|