2016-07-25 22:09:58 +00:00
|
|
|
# test suite
|
|
|
|
|
2016-07-25 19:37:48 +00:00
|
|
|
include_directories(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
2016-08-03 08:52:02 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
|
|
|
|
foreach(pkg_config_lib CAIRO)
|
|
|
|
include_directories(${${pkg_config_lib}_INCLUDE_DIRS})
|
|
|
|
link_directories(${${pkg_config_lib}_LIBRARY_DIRS})
|
|
|
|
endforeach()
|
2016-07-25 19:37:48 +00:00
|
|
|
|
|
|
|
set(testsuite_SOURCES
|
|
|
|
harness.cpp
|
2016-12-13 11:06:29 +00:00
|
|
|
core/expr/test.cpp
|
2017-01-04 15:39:27 +00:00
|
|
|
core/locale/test.cpp
|
2016-07-31 08:43:33 +00:00
|
|
|
constraint/points_coincident/test.cpp
|
|
|
|
constraint/pt_pt_distance/test.cpp
|
|
|
|
constraint/pt_plane_distance/test.cpp
|
|
|
|
constraint/pt_line_distance/test.cpp
|
|
|
|
constraint/pt_face_distance/test.cpp
|
|
|
|
constraint/proj_pt_distance/test.cpp
|
|
|
|
constraint/pt_in_plane/test.cpp
|
|
|
|
constraint/pt_on_line/test.cpp
|
|
|
|
constraint/pt_on_face/test.cpp
|
|
|
|
constraint/equal_length_lines/test.cpp
|
|
|
|
constraint/length_ratio/test.cpp
|
|
|
|
constraint/eq_len_pt_line_d/test.cpp
|
|
|
|
constraint/eq_pt_ln_distances/test.cpp
|
|
|
|
constraint/equal_angle/test.cpp
|
|
|
|
constraint/equal_line_arc_len/test.cpp
|
|
|
|
constraint/length_difference/test.cpp
|
|
|
|
constraint/symmetric/test.cpp
|
|
|
|
constraint/symmetric_horiz/test.cpp
|
|
|
|
constraint/symmetric_vert/test.cpp
|
|
|
|
constraint/symmetric_line/test.cpp
|
|
|
|
constraint/at_midpoint/test.cpp
|
|
|
|
constraint/horizontal/test.cpp
|
|
|
|
constraint/vertical/test.cpp
|
|
|
|
constraint/diameter/test.cpp
|
|
|
|
constraint/pt_on_circle/test.cpp
|
|
|
|
constraint/same_orientation/test.cpp
|
|
|
|
constraint/angle/test.cpp
|
|
|
|
constraint/parallel/test.cpp
|
|
|
|
constraint/perpendicular/test.cpp
|
|
|
|
constraint/arc_line_tangent/test.cpp
|
|
|
|
constraint/cubic_line_tangent/test.cpp
|
|
|
|
constraint/curve_curve_tangent/test.cpp
|
|
|
|
constraint/equal_radius/test.cpp
|
|
|
|
constraint/where_dragged/test.cpp
|
|
|
|
constraint/comment/test.cpp
|
|
|
|
request/arc_of_circle/test.cpp
|
|
|
|
request/circle/test.cpp
|
|
|
|
request/cubic/test.cpp
|
|
|
|
request/cubic_periodic/test.cpp
|
|
|
|
request/datum_point/test.cpp
|
|
|
|
request/line_segment/test.cpp
|
2016-05-03 07:44:10 +00:00
|
|
|
request/ttf_text/test.cpp
|
|
|
|
group/translate_asy/test.cpp
|
2016-10-11 16:46:42 +00:00
|
|
|
group/translate_nd/test.cpp
|
2016-05-03 07:44:10 +00:00
|
|
|
)
|
2016-07-25 19:37:48 +00:00
|
|
|
|
2016-11-29 02:57:41 +00:00
|
|
|
add_executable(solvespace-testsuite
|
Use the same code for loading resources in all executables.
All of our executables need resources; e.g. the vector font is
a resource and it is necessary for generation. Before this commit,
the GUI executable loaded the resources in a nice way, and everything
else did it in a very ad-hoc, fragile way.
After this commit, all executables are placed in <build>/bin and
follow the same algorithm:
* On Windows, resources are compiled and linked into every
executable.
* On Linux, resources are copied into <build>/res (which is
tried first) and <prefix>/share/solvespace (which is tried
second).
* On macOS, resources are copied into <build>/res (which is
tried first) and <build>/bin/solvespace.app/Contents/Resources
(which is tried second).
In practice this means that we can add as many executables as we want
without duplicating lots of code. In addition, on macOS, we can
place supplementary executables into the bundle, and they can use
resources from the bundle transparently.
2016-11-28 04:16:18 +00:00
|
|
|
${testsuite_SOURCES}
|
|
|
|
$<TARGET_PROPERTY:resources,EXTRA_SOURCES>)
|
2016-07-25 19:37:48 +00:00
|
|
|
|
2016-11-29 02:57:41 +00:00
|
|
|
target_link_libraries(solvespace-testsuite
|
|
|
|
solvespace-headless
|
2016-07-25 22:09:58 +00:00
|
|
|
${COVERAGE_LIBRARY})
|
2016-07-25 19:37:48 +00:00
|
|
|
|
2016-11-29 02:57:41 +00:00
|
|
|
add_dependencies(solvespace-testsuite
|
Use the same code for loading resources in all executables.
All of our executables need resources; e.g. the vector font is
a resource and it is necessary for generation. Before this commit,
the GUI executable loaded the resources in a nice way, and everything
else did it in a very ad-hoc, fragile way.
After this commit, all executables are placed in <build>/bin and
follow the same algorithm:
* On Windows, resources are compiled and linked into every
executable.
* On Linux, resources are copied into <build>/res (which is
tried first) and <prefix>/share/solvespace (which is tried
second).
* On macOS, resources are copied into <build>/res (which is
tried first) and <build>/bin/solvespace.app/Contents/Resources
(which is tried second).
In practice this means that we can add as many executables as we want
without duplicating lots of code. In addition, on macOS, we can
place supplementary executables into the bundle, and they can use
resources from the bundle transparently.
2016-11-28 04:16:18 +00:00
|
|
|
resources)
|
|
|
|
|
2016-11-29 02:57:41 +00:00
|
|
|
add_custom_target(test_solvespace ALL
|
|
|
|
COMMAND $<TARGET_FILE:solvespace-testsuite>
|
2016-07-25 19:37:48 +00:00
|
|
|
COMMENT "Testing SolveSpace"
|
|
|
|
VERBATIM)
|
2016-07-25 22:09:58 +00:00
|
|
|
|
|
|
|
# coverage reports
|
|
|
|
|
|
|
|
if(ENABLE_COVERAGE)
|
2016-08-02 17:38:42 +00:00
|
|
|
set(LCOV_FLAGS -q --gcov-tool ${GCOV})
|
|
|
|
set(LCOV_FLAGS ${LCOV_FLAGS} --rc lcov_branch_coverage=1)
|
|
|
|
set(LCOV_FLAGS ${LCOV_FLAGS} --rc "lcov_excl_line=(ssassert|switch)")
|
|
|
|
set(LCOV_FLAGS ${LCOV_FLAGS} --rc "lcov_excl_br_line=BRANCH_ALWAYS_TAKEN")
|
2016-07-25 22:09:58 +00:00
|
|
|
set(LCOV_COLLECT -c -b ${CMAKE_SOURCE_DIR}/src -d ${CMAKE_BINARY_DIR}/src --no-external)
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/coverage_base.info
|
|
|
|
COMMAND ${LCOV} ${LCOV_FLAGS} ${LCOV_COLLECT}
|
|
|
|
-o ${CMAKE_BINARY_DIR}/coverage_base.info -i
|
2016-11-29 02:57:41 +00:00
|
|
|
DEPENDS solvespace-testsuite
|
2016-07-25 22:09:58 +00:00
|
|
|
COMMENT "Importing baseline coverage data"
|
|
|
|
VERBATIM)
|
|
|
|
|
2016-11-29 02:57:41 +00:00
|
|
|
add_custom_target(coverage_solvespace ALL
|
2016-07-25 22:09:58 +00:00
|
|
|
COMMAND ${LCOV} ${LCOV_FLAGS} ${LCOV_COLLECT}
|
|
|
|
-o ${CMAKE_BINARY_DIR}/coverage_test.info
|
|
|
|
COMMAND ${LCOV} ${LCOV_FLAGS}
|
|
|
|
-o ${CMAKE_BINARY_DIR}/coverage_full.info
|
|
|
|
-a ${CMAKE_BINARY_DIR}/coverage_base.info
|
|
|
|
-a ${CMAKE_BINARY_DIR}/coverage_test.info
|
|
|
|
COMMAND ${LCOV} ${LCOV_FLAGS} --summary
|
|
|
|
${CMAKE_BINARY_DIR}/coverage_full.info
|
|
|
|
COMMAND ${GENHTML} -q --branch-coverage --demangle-cpp --legend
|
|
|
|
${CMAKE_BINARY_DIR}/coverage_full.info
|
|
|
|
-o ${CMAKE_BINARY_DIR}/coverage/
|
|
|
|
-t "SolveSpace testbench"
|
|
|
|
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/coverage_base.info
|
2016-11-29 02:57:41 +00:00
|
|
|
DEPENDS test_solvespace
|
2016-07-25 22:09:58 +00:00
|
|
|
COMMENT "Generating coverage report"
|
|
|
|
VERBATIM)
|
|
|
|
endif()
|