2024-05-07 13:22:52 +00:00
|
|
|
include(CTest)
|
|
|
|
|
|
|
|
include_directories(${PROJECT_SOURCE_DIR}/src)
|
|
|
|
|
2024-05-30 19:43:14 +00:00
|
|
|
# ------------------------------------------------ #
|
|
|
|
# Setup Glib 2.0 #
|
|
|
|
# ------------------------------------------------ #
|
|
|
|
|
|
|
|
find_package(PkgConfig REQUIRED)
|
|
|
|
pkg_search_module(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
|
|
|
|
include_directories(PRIVATE ${GLIB_INCLUDE_DIRS})
|
|
|
|
|
2024-06-02 22:24:17 +00:00
|
|
|
# ------------------------------------------------ #
|
|
|
|
# Setup TOML-C99 #
|
|
|
|
# ------------------------------------------------ #
|
|
|
|
|
|
|
|
include_directories(${PROJECT_SOURCE_DIR}/dep/tomlc99)
|
|
|
|
|
2024-05-07 13:22:52 +00:00
|
|
|
# ------------------------------------------------------- #
|
|
|
|
# CTEST 1
|
|
|
|
# test building the syntax tree
|
|
|
|
|
|
|
|
add_executable(ast_build_tree
|
|
|
|
${PROJECT_SOURCE_DIR}/src/ast/ast.c
|
|
|
|
${PROJECT_SOURCE_DIR}/src/sys/log.c
|
2024-05-30 19:43:14 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/src/io/files.c
|
|
|
|
${PROJECT_SOURCE_DIR}/src/sys/col.c
|
2024-06-02 22:24:17 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/src/cfg/opt.c
|
|
|
|
${PROJECT_SOURCE_DIR}/dep/tomlc99/toml.c
|
2024-05-07 13:22:52 +00:00
|
|
|
build_tree.c)
|
|
|
|
set_target_properties(ast_build_tree
|
|
|
|
PROPERTIES
|
|
|
|
OUTPUT_NAME "build_tree"
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY ${GEMSTONE_BINARY_DIR}/tests/ast)
|
2024-05-30 19:43:14 +00:00
|
|
|
target_link_libraries(ast_build_tree PkgConfig::GLIB)
|
2024-05-07 13:22:52 +00:00
|
|
|
add_test(NAME ast_build_tree
|
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
|
|
|
COMMAND python ${GEMSTONE_TEST_DIR}/ast/test_ast.py check_build_tree)
|
|
|
|
|
|
|
|
# ------------------------------------------------------- #
|
|
|
|
# CTEST 2
|
|
|
|
# test node to string output
|
|
|
|
|
|
|
|
add_executable(ast_print_node
|
|
|
|
${PROJECT_SOURCE_DIR}/src/ast/ast.c
|
2024-05-08 11:49:06 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/src/sys/log.c
|
2024-05-30 19:43:14 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/src/io/files.c
|
|
|
|
${PROJECT_SOURCE_DIR}/src/sys/col.c
|
2024-06-02 22:24:17 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/src/cfg/opt.c
|
|
|
|
${PROJECT_SOURCE_DIR}/dep/tomlc99/toml.c
|
2024-05-07 13:22:52 +00:00
|
|
|
print_node.c)
|
2024-05-08 11:49:06 +00:00
|
|
|
set_target_properties(ast_print_node
|
2024-05-07 13:22:52 +00:00
|
|
|
PROPERTIES
|
2024-05-08 11:49:06 +00:00
|
|
|
OUTPUT_NAME "print_node"
|
2024-05-07 13:22:52 +00:00
|
|
|
RUNTIME_OUTPUT_DIRECTORY ${GEMSTONE_BINARY_DIR}/tests/ast)
|
2024-05-30 19:43:14 +00:00
|
|
|
target_link_libraries(ast_print_node PkgConfig::GLIB)
|
2024-05-07 13:22:52 +00:00
|
|
|
add_test(NAME ast_print_node
|
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
|
|
|
COMMAND python ${GEMSTONE_TEST_DIR}/ast/test_ast.py check_print_node)
|
|
|
|
|
2024-05-08 11:49:06 +00:00
|
|
|
# ------------------------------------------------------- #
|
|
|
|
# CTEST 3
|
|
|
|
# test graphviz output
|
|
|
|
|
|
|
|
add_executable(ast_graphviz
|
|
|
|
${PROJECT_SOURCE_DIR}/src/ast/ast.c
|
|
|
|
${PROJECT_SOURCE_DIR}/src/sys/log.c
|
2024-05-30 19:43:14 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/src/io/files.c
|
|
|
|
${PROJECT_SOURCE_DIR}/src/sys/col.c
|
2024-06-02 22:24:17 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/src/cfg/opt.c
|
|
|
|
${PROJECT_SOURCE_DIR}/dep/tomlc99/toml.c
|
2024-05-08 11:49:06 +00:00
|
|
|
print_graphviz.c)
|
|
|
|
set_target_properties(ast_graphviz
|
|
|
|
PROPERTIES
|
|
|
|
OUTPUT_NAME "print_graphviz"
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY ${GEMSTONE_BINARY_DIR}/tests/ast)
|
2024-05-30 19:43:14 +00:00
|
|
|
target_link_libraries(ast_graphviz PkgConfig::GLIB)
|
2024-05-08 11:49:06 +00:00
|
|
|
add_test(NAME ast_graphviz
|
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
|
|
|
COMMAND python ${GEMSTONE_TEST_DIR}/ast/test_ast.py check_print_graphviz)
|