Skip to content

Commit 8314f71

Browse files
Fix Section 4.5.1 of Math Component Tutorial (#1243)
* fix: fprime-util impl --ut command not working #1238 * fix list formatting #1238 * lestarch: sp * Remove Placeholder Instructions Co-authored-by: M Starch <LeStarch@googlemail.com>
1 parent 595cf36 commit 8314f71

File tree

2 files changed

+28
-14
lines changed

2 files changed

+28
-14
lines changed

.github/actions/spelling/expect.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,6 +1150,7 @@ PINGSEND
11501150
pinit
11511151
pkill
11521152
pkts
1153+
placeholders
11531154
plainnat
11541155
plantuml
11551156
plugin

docs/Tutorials/MathComponent/Tutorial.md

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -756,19 +756,35 @@ Do the following in directory `Ref/MathSender`:
756756
1. Run `mkdir -p test/ut` to create the directory where
757757
the unit tests will reside.
758758

759-
1. Run the command `fprime-util impl --ut`.
759+
2. Update Ref/MathSender/CMakeLists.txt:
760+
Go back to the directory `Ref/MathSender`.
761+
Add the following lines to `CMakeLists.txt`:
762+
763+
```cmake
764+
# Register the unit test build
765+
set(UT_SOURCE_FILES
766+
"${CMAKE_CURRENT_LIST_DIR}/MathSender.fpp"
767+
)
768+
register_fprime_ut()
769+
```
770+
771+
This code tells the build system how to build
772+
and run the unit tests.
773+
774+
4. Run `fprime-util generate --ut` to generate the unit test cache.
775+
776+
5. Run the command `fprime-util impl --ut`.
760777
It should generate files `Tester.cpp` and `Tester.hpp`.
761778

762-
1. Move these files to the `test/ut` directory:
779+
6. Move these files to the `test/ut` directory:
763780

764-
```bash
765-
mv Tester.* test/ut
766-
```
781+
```bash
782+
mv Tester.* test/ut
783+
```
767784

768785
**Create a stub main.cpp file:**
769786
Now go to the directory `Ref/MathSender/test/ut`.
770-
In that directory, create a file `main.cpp` with the
771-
following contents:
787+
In that directory, create the file `main.cpp` and add the following contents:
772788

773789
```c++
774790
#include "Tester.hpp"
@@ -784,23 +800,20 @@ This file is a stub for running tests using the
784800
Right now there aren't any tests to run; we will add one
785801
in the next section.
786802
787-
**Update Ref/MathSender/CMakeLists.txt:**
788-
Go back to the directory `Ref/MathSender`.
789-
Add the following lines to `CMakeLists.txt`:
803+
7. Add the new files to the build.
790804
805+
Open `MathSender/CMakeLists.txt` and modify the `UT_SOURCE_FILES` by adding
806+
your new test files:
791807
```cmake
792808
# Register the unit test build
793809
set(UT_SOURCE_FILES
794810
"${CMAKE_CURRENT_LIST_DIR}/MathSender.fpp"
795-
"${CMAKE_CURRENT_LIST_DIR}/test/ut/Tester.cpp"
796811
"${CMAKE_CURRENT_LIST_DIR}/test/ut/main.cpp"
812+
"${CMAKE_CURRENT_LIST_DIR}/test/ut/Tester.cpp"
797813
)
798814
register_fprime_ut()
799815
```
800816

801-
This code tells the build system how to build
802-
and run the unit tests.
803-
804817
**Run the build:**
805818
Now we can check that the unit test build is working.
806819

0 commit comments

Comments
 (0)