GCC Code Coverage Report


Directory: components/
File: examples/flight_controller/src/flight_controller.c
Date: 2025-10-25 23:13:53
Coverage Exec Excl Total
Lines: 100.0% 11 0 11
Functions: 100.0% 2 0 2
Branches: 100.0% 6 0 6

Line Branch Exec Source
1 /** @file */
2 #include "flight_controller.h"
3
4 // Example function to demonstrate the use of MC/DC (code coverage metric).
5 // See this youtube video for more information:
6 // https://www.youtube.com/watch?v=k0_PF8MtEEo
7
8 /**
9 * ```{impl} Abort decision logic
10 * :id: SWIMPL_FC-001
11 * :implements: SWDD_FC-100, SWDD_FC-101, SWDD_FC-102
12 * ```
13 */
14 8 boolean CheckAbort(boolean off_course, boolean abort_commanded, boolean valid_abort_command)
15 {
16
6/6
✓ Branch 2 → 3 taken 6 times.
✓ Branch 2 → 5 taken 2 times.
✓ Branch 3 → 4 taken 4 times.
✓ Branch 3 → 6 taken 2 times.
✓ Branch 4 → 5 taken 2 times.
✓ Branch 4 → 6 taken 2 times.
8 if (off_course || (abort_commanded && valid_abort_command))
17 {
18 4 return TRUE;
19 }
20 else
21 {
22 4 return FALSE;
23 }
24 }
25
26 /**
27 * ```{impl} Flight Controller's main runnable
28 * :id: SWIMPL_FC-002
29 * :implements: SWDD_FC-103, SWDD_FC-200, SWDD_FC-201, SWDD_FC-202, SWDD_FC-203, SWDD_FC-204
30 * ```
31 */
32 4 void flightController(void)
33 {
34 boolean off_course;
35 4 RteGetOffCourse(&off_course);
36 4 boolean abort_commanded = RteGetAbortCommanded();
37 4 boolean valid_abort_command = RteGetValidAbortCommand();
38
39 4 boolean abort = CheckAbort(off_course, abort_commanded, valid_abort_command);
40 4 RteSetSelfDestructState(abort);
41 4 }
42