GCC Code Coverage Report


Directory: ./
File: unit_tests/tests/controllers/modules/test_configuration_wizard.cpp
Date: 2025-11-16 14:52:24
Coverage Exec Excl Total
Lines: 100.0% 21 0 21
Functions: 100.0% 9 0 9
Branches: 25.0% 6 0 24
Decisions: -% 0 - 0

Line Branch Decision Exec Source
1 /*
2 * @file test_configuration_wizard.cpp
3 *
4 * @date: nov 11, 2025
5 * @author FDSoftware
6 */
7
8 #include "pch.h"
9 #include "tests/util/test_base.h"
10
11 class ConfigurationWizardTest : public TestBase<> {
12 };
13
14 4 TEST_F(ConfigurationWizardTest, VinFilledWasEmpty_ShouldBecomeNotEmpty) {
15 // given: VIN string is non-empty, but flag currently says empty
16 1 strcpy(engineConfiguration->vinNumber, "1M8GDM9AXKP042788");
17 1 engineConfiguration->vinIsEmpty = true;
18
19 // when
20 1 ConfigurationWizard::onConfigOnStartUpOrBurn();
21
22 // then: since VIN is filled, flag should flip to false
23
2/8
✗ Branch 5 not taken.
✓ Branch 6 taken 1 time.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✓ Branch 30 taken 1 time.
✗ Branch 31 not taken.
1 ASSERT_FALSE(engineConfiguration->vinIsEmpty);
24 }
25
26 4 TEST_F(ConfigurationWizardTest, VinFilledWasNotEmpty_ShouldStayNotEmpty) {
27 // given: VIN string is non-empty, and flag already says not empty
28 1 strcpy(engineConfiguration->vinNumber, "1M8GDM9AXKP042788");
29 1 engineConfiguration->vinIsEmpty = false;
30
31 // when
32 1 ConfigurationWizard::onConfigOnStartUpOrBurn();
33
34 // then: no change expected
35
2/8
✗ Branch 5 not taken.
✓ Branch 6 taken 1 time.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✓ Branch 30 taken 1 time.
✗ Branch 31 not taken.
1 ASSERT_FALSE(engineConfiguration->vinIsEmpty);
36 }
37
38 4 TEST_F(ConfigurationWizardTest, VinEmptyWasEmpty_ShouldStayEmpty) {
39 // given: VIN string is empty, and flag already says empty
40 1 strcpy(engineConfiguration->vinNumber, "");
41 1 engineConfiguration->vinIsEmpty = true;
42
43 // when
44 1 ConfigurationWizard::onConfigOnStartUpOrBurn();
45
46 // then: no change expected
47
2/8
✗ Branch 5 not taken.
✓ Branch 6 taken 1 time.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✓ Branch 30 taken 1 time.
✗ Branch 31 not taken.
1 ASSERT_TRUE(engineConfiguration->vinIsEmpty);
48 }
49
50 TEST_F(ConfigurationWizardTest, VinEmptyWasNotEmpty_ShouldBecomeEmpty) {
51 // given: VIN string is empty, but flag currently says not empty
52 strcpy(engineConfiguration->vinNumber, "");
53 engineConfiguration->vinIsEmpty = false;
54
55 // when
56 ConfigurationWizard::onConfigOnStartUpOrBurn();
57
58 // then: since VIN is empty, flag should flip to true
59 ASSERT_TRUE(engineConfiguration->vinIsEmpty);
60 }
61