From 0daad4bff4586d2c9d90c1ee306acba23bb515ba Mon Sep 17 00:00:00 2001 From: Abdo Eid Date: Sat, 9 Nov 2024 12:12:10 +0200 Subject: [PATCH] [TST] Edited test files --- .github/workflows/dep.yml | 2 +- CMakeLists.txt | 2 +- src/CMakeLists.txt | 6 +++++- test/CMakeLists.txt | 19 ++++++++++++++----- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/.github/workflows/dep.yml b/.github/workflows/dep.yml index 21963c1..f750823 100644 --- a/.github/workflows/dep.yml +++ b/.github/workflows/dep.yml @@ -31,4 +31,4 @@ jobs: - name: Run tests run: | cd test - ./lexer_test + ./A_Language_tests diff --git a/CMakeLists.txt b/CMakeLists.txt index c1d9ab3..547279c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,6 @@ add_subdirectory(src) # Add the GTest directory add_subdirectory(external/gtest) -# Enable testing if requested +# Enable testing enable_testing() add_subdirectory(test) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a7660a0..1416954 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -14,4 +14,8 @@ set(sources ) # Add the executable -add_executable(A_Language ${sources}) +# add_executable(A_Language ${sources}) + +add_library(A_Language_lib STATIC + ${sources} +) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6be78d8..7c69b27 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,10 +1,19 @@ -add_executable(lexer_test lexer_test.cpp) +cmake_minimum_required(VERSION 3.10) -target_link_libraries(lexer_test gtest gtest_main) +set(test A_Language_tests) -add_test(NAME lexer_test COMMAND lexer_test) +set(test_sources + lexer_test.cpp +) -unset(TESTING CACHE) +add_executable(${test} ${test_sources}) + +target_link_libraries(${test} PUBLIC + gtest_main + A_Language_lib +) + +add_test(NAME ${test} COMMAND ${test}) # set the output directory for the test binary -set_target_properties(lexer_test PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${MAINFOLDER}/test") +set_target_properties(${test} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${MAINFOLDER}/test")