Skip to content

Commit 81ec5f8

Browse files
committed
Enable testing in cmake
1 parent c7faa79 commit 81ec5f8

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ set(CMAKE_CXX_STANDARD 17)
55

66
add_subdirectory(src)
77
add_subdirectory(test)
8+
9+
enable_testing()

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ $ mkdir build
3030
$ cd build
3131
$ cmake ..
3232
$ make
33+
$ make test (optional step)
3334
$ ./src/8bit <program.asm>
3435
```
3536

test/CMakeLists.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,22 @@ include_directories(include)
33

44
add_executable(8bit-tests test_main.cpp core/BusTest.cpp core/FlagsRegisterTest.cpp core/StepCounterTest.cpp core/ProgramCounterTest.cpp core/ArithmeticLogicUnitTest.cpp core/EmulatorIntegrationTest.cpp core/AssemblerTest.cpp core/UtilsTest.cpp core/InstructionDecoderTest.cpp core/RandomAccessMemoryTest.cpp core/MemoryAddressRegisterTest.cpp core/TimeSourceTest.cpp core/ClockTest.cpp core/OutputRegisterTest.cpp core/InstructionRegisterTest.cpp core/GenericRegisterTest.cpp)
55
target_link_libraries(8bit-tests 8bit-core)
6+
7+
enable_testing()
8+
9+
add_test(ArithmeticLogicUnitTest 8bit-tests --source-file=*ArithmeticLogicUnitTest.cpp)
10+
add_test(AssemblerTest 8bit-tests --source-file=*AssemblerTest.cpp)
11+
add_test(BusTest 8bit-tests --source-file=*BusTest.cpp)
12+
add_test(ClockTest 8bit-tests --source-file=*ClockTest.cpp)
13+
add_test(EmulatorIntegrationTest 8bit-tests --source-file=*EmulatorIntegrationTest.cpp)
14+
add_test(FlagsRegisterTest 8bit-tests --source-file=*FlagsRegisterTest.cpp)
15+
add_test(GenericRegisterTest 8bit-tests --source-file=*GenericRegisterTest.cpp)
16+
add_test(InstructionDecoderTest 8bit-tests --source-file=*InstructionDecoderTest.cpp)
17+
add_test(InstructionRegisterTest 8bit-tests --source-file=*InstructionRegisterTest.cpp)
18+
add_test(MemoryAddressRegisterTest 8bit-tests --source-file=*MemoryAddressRegisterTest.cpp)
19+
add_test(OutputRegisterTest 8bit-tests --source-file=*OutputRegisterTest.cpp)
20+
add_test(ProgramCounterTest 8bit-tests --source-file=*ProgramCounterTest.cpp)
21+
add_test(RandomAccessMemoryTest 8bit-tests --source-file=*RandomAccessMemoryTest.cpp)
22+
add_test(StepCounterTest 8bit-tests --source-file=*StepCounterTest.cpp)
23+
add_test(TimeSourceTest 8bit-tests --source-file=*TimeSourceTest.cpp)
24+
add_test(UtilsTest 8bit-tests --source-file=*UtilsTest.cpp)

0 commit comments

Comments
 (0)