Skip to content

Commit 28ef634

Browse files
authored
introduce ctest.
Part of #9.
1 parent eaec363 commit 28ef634

8 files changed

Lines changed: 26 additions & 32 deletions

File tree

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ jobs:
1717
run: cmake .
1818
- name: Build
1919
run: cmake --build .
20+
- name: Run all the tests
21+
run: ctest

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
build/
22
.DS_Store
33
.vscode
4+
5+
Testing/

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ target_include_directories(x86 PUBLIC
1515
${SDL2_INCLUDE_DIRS}
1616
)
1717
target_include_directories(x86 PRIVATE include SDL2)
18+
19+
include(CTest)
20+
add_subdirectory(test)

test.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

test/CMakeLists.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
cmake_minimum_required(VERSION 3.26.0)
2+
3+
project(x86_tests)
4+
5+
include(FetchContent)
6+
FetchContent_Declare(
7+
googletest
8+
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
9+
)
10+
11+
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
12+
FetchContent_MakeAvailable(googletest)
13+
14+
add_executable(memory_tests ${CMAKE_SOURCE_DIR}/src/Memory.cpp ${CMAKE_SOURCE_DIR}/src/Object.cpp MemoryTests.cpp)
15+
target_link_libraries(memory_tests GTest::gtest_main)
16+
target_include_directories(memory_tests PRIVATE ../include)
17+
add_test(NAME memory_tests COMMAND memory_tests WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#include "../../include/Memory.h"
2-
#include "../../include/Cpu.h"
1+
#include "Memory.h"
2+
#include "Cpu.h"
33
#include <gtest/gtest.h>
44
#include <memory>
55
using namespace std;

tests/Memory/Makefile

Lines changed: 0 additions & 26 deletions
This file was deleted.

tests/Memory/test_memory

-1.23 MB
Binary file not shown.

0 commit comments

Comments
 (0)