From f196440112172f445fbace572155232e9b213f70 Mon Sep 17 00:00:00 2001 From: Camden Dixie O'Brien Date: Thu, 2 Jan 2025 00:16:17 +0000 Subject: [PATCH] Remove unused tests directory --- CMakeLists.txt | 6 ------ tests/CMakeLists.txt | 21 --------------------- tests/foo_tests.c | 20 -------------------- tests/include/testing.h | 39 --------------------------------------- tests/testing.c | 8 -------- 5 files changed, 94 deletions(-) delete mode 100644 tests/CMakeLists.txt delete mode 100644 tests/foo_tests.c delete mode 100644 tests/include/testing.h delete mode 100644 tests/testing.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ebb589..8be2672 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.10) project(epec-mcu-emulator LANGUAGES C) -option(TESTS "Build unit tests" ON) option(WERROR "Treat warnings as errors" OFF) option(SANITIZERS "Enable memory and undefined behaviour sanitizers" OFF) @@ -40,8 +39,3 @@ find_package(SDL2_image REQUIRED) add_subdirectory(engine) add_subdirectory(app) - -if (${TESTS}) - enable_testing() - add_subdirectory(tests) -endif() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt deleted file mode 100644 index bca5248..0000000 --- a/tests/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -add_library(testing testing.c) -set_default_target_options(testing) -target_include_directories(testing PUBLIC include) - -function(add_test_suite source) - string(REGEX REPLACE ".c$" "" name ${source}) - add_executable(${name} ${source}) - set_default_target_options(${name}) - target_link_libraries(${name} PRIVATE engine testing) - add_test(NAME ${name} COMMAND ${name}) -endfunction() - -function(add_test_suites) - foreach(source ${ARGN}) - add_test_suite(${source}) - endforeach() -endfunction() - -add_test_suites( - foo_tests.c -) diff --git a/tests/foo_tests.c b/tests/foo_tests.c deleted file mode 100644 index 1f3d21d..0000000 --- a/tests/foo_tests.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) Camden Dixie O'Brien - * SPDX-License-Identifier: AGPL-3.0-only - */ - -#include "foo.h" -#include "testing.h" - -static void test_foo(void) -{ - const int res = foo(); - ASSERT_EQ(42, res); -} - -int main(void) -{ - TESTING_BEGIN(); - test_foo(); - return TESTING_END(); -} diff --git a/tests/include/testing.h b/tests/include/testing.h deleted file mode 100644 index c319285..0000000 --- a/tests/include/testing.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Camden Dixie O'Brien - * SPDX-License-Identifier: AGPL-3.0-only - */ - -#ifndef TESTING_H -#define TESTING_H - -#include -#include -#include - -#define TESTING_BEGIN() fail_count = 0 -#define TESTING_END() fail_count == 0 ? EXIT_SUCCESS : EXIT_FAILURE - -#define FAIL \ - do { \ - ++fail_count; \ - printf("%s: FAIL @ %s:%d\n", __func__, __FILE__, __LINE__); \ - return; \ - } while (0) - -#define ASSERT_FALSE(p) \ - do { \ - if (p) \ - FAIL; \ - } while (0) - -#define ASSERT_TRUE(p) ASSERT_FALSE(!(p)) -#define ASSERT_EQ(x, y) ASSERT_FALSE((x) != (y)) -#define ASSERT_NE(x, y) ASSERT_FALSE((x) == (y)) -#define ASSERT_LT(x, y) ASSERT_FALSE((x) <= (y)) -#define ASSERT_NULL(p) ASSERT_FALSE(NULL != (p)) -#define ASSERT_NOT_NULL(p) ASSERT_FALSE(NULL == (p)) -#define ASSERT_MEM_EQ(p, q, n) ASSERT_FALSE(memcmp(p, q, n) != 0) - -extern int fail_count; - -#endif diff --git a/tests/testing.c b/tests/testing.c deleted file mode 100644 index 2ea878d..0000000 --- a/tests/testing.c +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright (c) Camden Dixie O'Brien - * SPDX-License-Identifier: AGPL-3.0-only - */ - -#include "testing.h" - -int fail_count;