set(UNITY_SRC ../../third_party/unity/unity.c)
set(UNITY_INC ../../third_party/unity)
set(LIB_INC   ../../src)
set(COMPILE_OPTS
    $<$<C_COMPILER_ID:MSVC>:/W3>
    $<$<NOT:$<C_COMPILER_ID:MSVC>>:-Wall;-Wextra;-Wpedantic>
)

function(add_sexp_test target source)
    add_executable(${target} ${source} ${UNITY_SRC})
    target_include_directories(${target} PRIVATE ${UNITY_INC} ${LIB_INC})
    target_link_libraries(${target} sexp_core)
    target_compile_options(${target} PRIVATE ${COMPILE_OPTS})
    add_test(NAME ${target} COMMAND ${target})
endfunction()

add_sexp_test(test_arena       memory/test_arena.c)
add_sexp_test(test_intern      memory/test_intern.c)
add_sexp_test(test_parse       parse/test_parse.c)
add_sexp_test(test_parse_stack parse/test_parse_stack.c)
add_sexp_test(test_tree        core/test_tree.c)
add_sexp_test(test_serialize   serialize/test_serialize.c)
add_sexp_test(test_mutate      core/test_mutate.c)
add_sexp_test(test_clone       core/test_clone.c)
