cmake_minimum_required(VERSION 3.24) project(UserScript) set(CMAKE_CXX_STANDARD 23) set(CMAKE_VERBOSE_MAKEFILE ON) set(FETCHCONTENT_QUIET OFF) set(CATCH_CONFIG_DISABLE_EXCEPTIONS ON) Include(FetchContent) FetchContent_Declare( Catch2 GIT_REPOSITORY https://github.com/catchorg/Catch2.git GIT_TAG v3.3.2 ) FetchContent_MakeAvailable(Catch2) enable_testing() include(CTest) include(Catch) add_library(UserScript STATIC src/interpreter.cpp src/lex_parse.cpp) add_executable(ushell script_exe/main.cpp) target_link_libraries(ushell PUBLIC UserScript) include_directories(include) add_executable(tests tests/lexer_test.cpp tests/parser_test.cpp) target_link_libraries(tests PUBLIC UserScript Catch2::Catch2WithMain) catch_discover_tests(tests) function(add_script_test [testname filename resultname]) message("Added test: ${ARGV0}") add_test( NAME "${ARGV0}" WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" COMMAND $ "compare" "${ARGV1}" "${ARGV2}" ) endfunction() add_script_test("Scripting 001: Operators" tests/scripts/001.script tests/scripts/001.results) add_script_test("Scripting 002: Statements and Conditionals" tests/scripts/002.script tests/scripts/002.results) add_script_test("Scripting 003: While loops" tests/scripts/003.script tests/scripts/003.results) add_script_test("Scripting 004: While loops with bad terminator" tests/scripts/004.script tests/scripts/004.results) add_script_test("Scripting 005: If statements with bad terminator" tests/scripts/005.script tests/scripts/005.results)