File tree Expand file tree Collapse file tree 3 files changed +32
-11
lines changed
episodes/1-into-to-unit-tests/challenge Expand file tree Collapse file tree 3 files changed +32
-11
lines changed Original file line number Diff line number Diff line change @@ -4,12 +4,16 @@ COPY --chown=vscode episodes/1-into-to-unit-tests /home/vscode/1-into-to-unit-te
44
55WORKDIR /home/vscode/1-into-to-unit-tests/challenge
66
7- # test challenge with fpm
8- RUN fpm test
7+ # test challenge with CMake
8+ RUN cmake -B build
9+ RUN cmake --build build
10+ RUN ctest --test-dir build --output-on-failure
911
1012# clean build
1113RUN rm -rf build
1214
13- # Test solution with fpm
14- RUN mv ../solution/test_maths_solution.f90 test/test_maths.f90 && \
15- fpm test
15+ # Test solution with CMake
16+ RUN mv ../solution/test_maths_solution.f90 test/test_maths.f90
17+ RUN cmake -B build
18+ RUN cmake --build build
19+ RUN ctest --test-dir build --output-on-failure
Original file line number Diff line number Diff line change 1+ cmake_minimum_required (VERSION 3.9 FATAL_ERROR)
2+
3+ # Set project name
4+ project (
5+ "intro-to-unit-tests"
6+ LANGUAGES "Fortran"
7+ VERSION "0.0.1"
8+ DESCRIPTION "Exercises to teach unit testing"
9+ )
10+
11+ # Define src and test files
12+ set (PROJ_SRC_FILES "${PROJECT_SOURCE_DIR} /src/maths.f90" )
13+ set (PROJ_TEST_FILES "${PROJECT_SOURCE_DIR} /test/test_maths.f90" )
14+
15+ # Build test executable
16+ add_executable (test_maths_exec
17+ "${PROJ_SRC_FILES} "
18+ "${PROJ_TEST_FILES} "
19+ )
20+
21+ # Add test as ctest
22+ enable_testing ()
23+ add_test (NAME test_maths COMMAND test_maths_exec)
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments