diff --git a/CMakePresets.json b/CMakePresets.json index cc68836..f6d124a 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -22,7 +22,7 @@ "hidden": true, "cacheVariables": { "CMAKE_C_EXTENSIONS": "OFF", - "CMAKE_C_STANDARD": "20", + "CMAKE_C_STANDARD": "11", "CMAKE_C_STANDARD_REQUIRED": "ON", "CMAKE_CXX_EXTENSIONS": "OFF", "CMAKE_CXX_STANDARD": "20", diff --git a/build.sh b/build.sh index 0e61386..f5883a2 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,6 @@ mkdir build; +cmake -S . -B build -DCMAKE_BUILD_TYPE=Coverage; cd build; -cmake ..; make; cd ..; ./build/test/system_test/system_test; diff --git a/cmake/functions.cmake b/cmake/functions.cmake index 9a27e44..4ae778d 100644 --- a/cmake/functions.cmake +++ b/cmake/functions.cmake @@ -20,7 +20,8 @@ function(add_coverage_target) COMMAND ${CMAKE_CTEST_COMMAND} ) - # Generate coverage report after running tests + + # Replace the add_custom_command with this updated version add_custom_command(TARGET coverage COMMENT "Generating coverage report ..." POST_BUILD diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b1a3e5b..b26dda3 100755 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -43,13 +43,13 @@ link_libraries( # Add subdirectories for different test types add_subdirectory(system_test) -# add_subdirectory(unit_test) +add_subdirectory(unit_test) # add_subdirectory(integration_test) # Optional coverage target -# add_coverage_target( -# DEPENDS unit_test -# SOURCE_DIR ${SimpleRenderer_SOURCE_DIR} -# BINARY_DIR ${SimpleRenderer_BINARY_DIR} -# EXCLUDE_DIR ${SimpleRenderer_SOURCE_DIR}/3rd/* -# ) +add_coverage_target( + DEPENDS unit_test + SOURCE_DIR ${SimpleRenderer_SOURCE_DIR} + BINARY_DIR ${SimpleRenderer_BINARY_DIR} + EXCLUDE_DIR ${SimpleRenderer_SOURCE_DIR}/3rd/* +) diff --git a/test/system_test/main.cpp b/test/system_test/main.cpp index e5472a7..9df76e1 100755 --- a/test/system_test/main.cpp +++ b/test/system_test/main.cpp @@ -16,8 +16,6 @@ #include "simple_renderer.h" -#include - #include #include #include @@ -34,9 +32,11 @@ static void pixel(int x, int y, uint32_t color, uint32_t *buffer) { } int main(int argc, char **argv) { + // TODO: need to fix the way to use argc and argv + (void) argc; + (void) argv; // if (argc < 2) { // std::cerr << "Usage: " << argv[0] << " \n"; - // return 1; // } // std::string obj_path = argv[1]; std::string obj_path = "obj"; diff --git a/test/system_test/Window.cpp b/test/system_test/window.cpp similarity index 96% rename from test/system_test/Window.cpp rename to test/system_test/window.cpp index a5f70b8..b03f8af 100644 --- a/test/system_test/Window.cpp +++ b/test/system_test/window.cpp @@ -1,4 +1,4 @@ -#include "Window.hpp" +#include "window.hpp" #include Window::Window(int width, int height) : diff --git a/test/system_test/Window.hpp b/test/system_test/window.hpp similarity index 100% rename from test/system_test/Window.hpp rename to test/system_test/window.hpp