API
 
Loading...
Searching...
No Matches
cred2Ctrl_lifecycle_test.cpp
Go to the documentation of this file.
1/** \file cred2Ctrl_lifecycle_test.cpp
2 * \brief Isolated Catch2 lifecycle tests for the cred2Ctrl app.
3 * \author OpenAI Codex
4 *
5 * \ingroup cred2Ctrl_files
6 */
7
8#define CRED2CTRL_TEST_SUPPORT_ONLY
9#include "cred2Ctrl_test.cpp"
10#undef CRED2CTRL_TEST_SUPPORT_ONLY
11
12namespace libXWCTest
13{
14
15/** \addtogroup cred2Ctrl_unit_test
16 * \brief Additional lifecycle tests for the cred2Ctrl application.
17 *
18 * \ingroup application_unit_test
19 */
20
21/// Namespace for `cred2Ctrl` lifecycle unit tests.
22/** \ingroup cred2Ctrl_unit_test
23 */
24namespace cred2CtrlTest
25{
26
27/// Verify lifecycle entrypoints cover startup failure handling and successful startup cleanup.
28/**
29 * \ingroup cred2Ctrl_unit_test
30 */
31TEST_CASE( "cred2Ctrl lifecycle entrypoints handle startup failures and success", "[cred2Ctrl]" )
32{
33 resetStubState();
34
35 // clang-format off
36 #ifdef CRED2CTRL_TEST_DOXYGEN_REF
38 #endif
39 // clang-format on
40
41 SECTION( "appStartup reports failure when no startup mode is available" )
42 {
43 cred2Ctrl_test app;
44
45 loadDefaultConfig( app, "startup_missing_mode" );
46 app.m_startupMode.clear();
47
48 REQUIRE( app.appStartup() < 0 );
49 }
50
51 SECTION( "appStartup reports failure when the EDT runtime config cannot be read" )
52 {
53 cred2Ctrl_test app;
54
55 loadDefaultConfig( app, "startup_bad_edt" );
56 g_edtStubState.readcfgReturn = -1;
57
58 REQUIRE( app.appStartup() < 0 );
59 }
60
61 SECTION( "appStartup succeeds once the runtime mode and telemetry path are configured" )
62 {
63 cred2Ctrl_test app;
64 startupScope startup( app );
65
66 loadDefaultConfig( app, "startup_success" );
67
68 const int startupRv = app.appStartup();
69 startup.markStarted( startupRv == 0 );
70
71 REQUIRE( startupRv == 0 );
72 REQUIRE( app.m_pdv != nullptr );
73 REQUIRE( app.m_raw_width == 640 );
74 REQUIRE( app.m_raw_height == 512 );
75 REQUIRE( app.m_raw_depth == 16 );
76 REQUIRE( app.m_cameraType == "stub_pdv" );
77 REQUIRE( g_edtStubState.readcfgCalls > 0 );
78 REQUIRE( g_edtStubState.multibufCalls > 0 );
79 }
80
81 SECTION( "appStartup reports failure when the read-only fps property has already been registered" )
82 {
83 cred2Ctrl_test app;
84 pcf::IndiProperty fpsLimits;
85
86 loadDefaultConfig( app, "startup_duplicate_property" );
87 REQUIRE( app.createROIndiNumber( fpsLimits, "fps_limits" ) == 0 );
88 REQUIRE( app.registerIndiPropertyReadOnly( fpsLimits ) == 0 );
89
90 REQUIRE( app.appStartup() < 0 );
91 }
92}
93
94} // namespace cred2CtrlTest
95} // namespace libXWCTest
virtual int appStartup()
Startup function.
Catch2 tests for the cred2Ctrl app.
TEST_CASE("cred2Ctrl lifecycle entrypoints handle startup failures and success", "[cred2Ctrl]")
Verify lifecycle entrypoints cover startup failure handling and successful startup cleanup.
#define XWCTEST_DOXYGEN_REF(fxn)
This inserts an unused call to a function signature to make doxygen make the link.
Definition testXWC.hpp:18
Namespace for all libXWC tests.