API
 
Loading...
Searching...
No Matches

Unit tests for the mcp3208Ctrl application. More...

Collaboration diagram for mcp3208Ctrl Unit Tests:

Namespaces

namespace  libXWCTest::mcp3208CtrlTest
 Namespace for mcp3208Ctrl unit tests.
 

Functions

 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl Doxygen references are preserved", "[mcp3208Ctrl]")
 Preserve Doxygen links for the real mcp3208Ctrl APIs exercised by the tests.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl configuration defaults load synchronized settings", "[mcp3208Ctrl]")
 Verify synchronized-acquisition defaults load from configuration.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl configuration overrides load synchronized settings", "[mcp3208Ctrl]")
 Verify synchronized-acquisition overrides load from configuration.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl fps callback updates trigger metadata", "[mcp3208Ctrl]")
 Verify the user fps callback still updates cadence metadata.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl fps source callback updates trigger metadata", "[mcp3208Ctrl]")
 Verify the external fps source callback still updates cadence metadata.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl configuration clamps synchronized alpha", "[mcp3208Ctrl]")
 Verify synchronized alpha configuration is clamped to the valid range.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl alpha callback updates and clamps", "[mcp3208Ctrl]")
 Verify alpha callback updates and clamps the global EMA coefficient.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl synchroDelay callback updates signed offsets", "[mcp3208Ctrl]")
 Verify synchronized-delay callback updates delay state with signed offsets.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl timing diagnostics publish synchronized loop metrics", "[mcp3208Ctrl]")
 Verify synchronized-mode timing diagnostics publish loop state and derived error.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl timing diagnostics track mode transitions", "[mcp3208Ctrl]")
 Verify timing diagnostics report timer mode and update mode code across transitions.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl timing diagnostics compute wrapped phase error and lock thresholds", "[mcp3208Ctrl]")
 Verify timing diagnostics wrap phase error and require both lock thresholds.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl timing helpers convert between nanoseconds and timespec", "[mcp3208Ctrl]")
 Verify nanosecond and timespec conversions preserve normalized values.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl updateTriggerTiming uses measured semaphore period for delay model", "[mcp3208Ctrl]")
 Verify synchronized timing uses only the measured semaphore period for delay modeling.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl updateTriggerTiming applies positive synchroDelay offset", "[mcp3208Ctrl]")
 Verify synchronized timing applies a positive user offset to the modeled delay target.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl updateTriggerTiming applies negative synchroDelay offset with wrap", "[mcp3208Ctrl]")
 Verify synchronized timing applies a negative user offset with modulo wrap into the current period.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl updateTriggerTiming falls back to EMA period when fps is invalid", "[mcp3208Ctrl]")
 Verify synchronized timing falls back to EMA period when WFS fps is unavailable.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl updateTriggerTiming wraps delay with modulo period", "[mcp3208Ctrl]")
 Verify synchronized timing wraps negative raw delays into the current WFS period.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl updateTriggerTiming preserves positive raw delay", "[mcp3208Ctrl]")
 Verify synchronized timing leaves positive raw delays unchanged by modulo wrapping.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl updateTriggerTiming uses configurable timing constants", "[mcp3208Ctrl]")
 Verify synchronized timing constants directly control the modeled delay target.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl updateTriggerTiming guards non-positive period", "[mcp3208Ctrl]")
 Verify synchronized timing leaves trigger time unchanged when period estimate is non-positive.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl timer mode configureAcquisition sizes the output frame", "[mcp3208Ctrl]")
 Verify timer-driven acquisition configures the published frame geometry.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl timer mode reads configured channels", "[mcp3208Ctrl]")
 Verify timer-driven acquisition still reads one frame of ADC values.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl timer mode trigger interval initializes then measures", "[mcp3208Ctrl]")
 Verify timer-mode trigger interval diagnostics initialize then report measured intervals.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl loadImageIntoStream copies the current values", "[mcp3208Ctrl]")
 Verify the current MCP3208 values are copied into the output image buffer.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl loadImageIntoStream updates frame mapping counters", "[mcp3208Ctrl]")
 Verify published-frame counters track local and synchronized stream writes.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl synchronized mode reads on semaphore wake", "[mcp3208Ctrl]")
 Verify synchronized acquisition performs one ADC sweep per semaphore wake.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl synchronized mode tracks producer cadence from metadata", "[mcp3208Ctrl]")
 Verify synchronized mode derives producer cadence from stream metadata counters and timestamps.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl synchronized read latency EMA initializes and smooths", "[mcp3208Ctrl]")
 Verify synchronized read-latency EMA initializes from the first sample and smooths subsequent samples.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl synchronized non-delay service EMA uses global alpha", "[mcp3208Ctrl]")
 Verify synchronized non-delay service EMA uses the configurable global alpha.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl synchronized delay controller uses read latency EMA", "[mcp3208Ctrl]")
 Verify synchronized delay control uses read-latency EMA for the integrator correction.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl synchronized delay controller clamps to zero", "[mcp3208Ctrl]")
 Verify synchronized delay control clamps at zero when the control step overshoots.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl synchronized delay controller applies anti-windup at cap", "[mcp3208Ctrl]")
 Verify synchronized delay control blocks integrator windup while cadence capping is active.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl synchronized timeout requests reconfig for a stale stream", "[mcp3208Ctrl]")
 Verify synchronized timeout requests reconfiguration when the trigger stream is stale.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl synchronized stale helper detects missing streams", "[mcp3208Ctrl]")
 Verify stale-stream detection notices a missing synchronization stream backing file.
 
 libXWCTest::mcp3208CtrlTest::TEST_CASE ("mcp3208Ctrl reconfig clears cached synchronization state", "[mcp3208Ctrl]")
 Verify reconfig() clears cached synchronization state.
 

Detailed Description

Unit tests for the mcp3208Ctrl application.

Function Documentation

◆ TEST_CASE() [1/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl alpha callback updates and clamps"  ,
""  [mcp3208Ctrl] 
)

Verify alpha callback updates and clamps the global EMA coefficient.

Definition at line 436 of file mcp3208Ctrl_test.cpp.

◆ TEST_CASE() [2/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl configuration clamps synchronized alpha"  ,
""  [mcp3208Ctrl] 
)

Verify synchronized alpha configuration is clamped to the valid range.

Definition at line 415 of file mcp3208Ctrl_test.cpp.

◆ TEST_CASE() [3/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl configuration defaults load synchronized settings"  ,
""  [mcp3208Ctrl] 
)

Verify synchronized-acquisition defaults load from configuration.

Definition at line 299 of file mcp3208Ctrl_test.cpp.

◆ TEST_CASE() [4/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl configuration overrides load synchronized settings"  ,
""  [mcp3208Ctrl] 
)

Verify synchronized-acquisition overrides load from configuration.

Definition at line 328 of file mcp3208Ctrl_test.cpp.

◆ TEST_CASE() [5/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl Doxygen references are preserved"  ,
""  [mcp3208Ctrl] 
)

Preserve Doxygen links for the real mcp3208Ctrl APIs exercised by the tests.

Definition at line 262 of file mcp3208Ctrl_test.cpp.

References XWCTEST_DOXYGEN_REF.

◆ TEST_CASE() [6/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl fps callback updates trigger metadata"  ,
""  [mcp3208Ctrl] 
)

Verify the user fps callback still updates cadence metadata.

Definition at line 381 of file mcp3208Ctrl_test.cpp.

◆ TEST_CASE() [7/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl fps source callback updates trigger metadata"  ,
""  [mcp3208Ctrl] 
)

Verify the external fps source callback still updates cadence metadata.

Definition at line 398 of file mcp3208Ctrl_test.cpp.

◆ TEST_CASE() [8/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl loadImageIntoStream copies the current values"  ,
""  [mcp3208Ctrl] 
)

Verify the current MCP3208 values are copied into the output image buffer.

Definition at line 947 of file mcp3208Ctrl_test.cpp.

◆ TEST_CASE() [9/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl loadImageIntoStream updates frame mapping counters"  ,
""  [mcp3208Ctrl] 
)

Verify published-frame counters track local and synchronized stream writes.

Definition at line 962 of file mcp3208Ctrl_test.cpp.

◆ TEST_CASE() [10/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl reconfig clears cached synchronization state"  ,
""  [mcp3208Ctrl] 
)

Verify reconfig() clears cached synchronization state.

Definition at line 1342 of file mcp3208Ctrl_test.cpp.

◆ TEST_CASE() [11/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl synchroDelay callback updates signed offsets"  ,
""  [mcp3208Ctrl] 
)

Verify synchronized-delay callback updates delay state with signed offsets.

Definition at line 456 of file mcp3208Ctrl_test.cpp.

◆ TEST_CASE() [12/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl synchronized delay controller applies anti-windup at cap"  ,
""  [mcp3208Ctrl] 
)

Verify synchronized delay control blocks integrator windup while cadence capping is active.

Definition at line 1274 of file mcp3208Ctrl_test.cpp.

◆ TEST_CASE() [13/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl synchronized delay controller clamps to zero"  ,
""  [mcp3208Ctrl] 
)

Verify synchronized delay control clamps at zero when the control step overshoots.

Definition at line 1244 of file mcp3208Ctrl_test.cpp.

◆ TEST_CASE() [14/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl synchronized delay controller uses read latency EMA"  ,
""  [mcp3208Ctrl] 
)

Verify synchronized delay control uses read-latency EMA for the integrator correction.

Definition at line 1202 of file mcp3208Ctrl_test.cpp.

References MagAOX::app::mcp3208Ctrl::timespecToNs().

◆ TEST_CASE() [15/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl synchronized mode reads on semaphore wake"  ,
""  [mcp3208Ctrl] 
)

Verify synchronized acquisition performs one ADC sweep per semaphore wake.

Definition at line 983 of file mcp3208Ctrl_test.cpp.

References MagAOX::app::mcp3208Ctrl::timespecToNs().

◆ TEST_CASE() [16/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl synchronized mode tracks producer cadence from metadata"  ,
""  [mcp3208Ctrl] 
)

Verify synchronized mode derives producer cadence from stream metadata counters and timestamps.

Definition at line 1021 of file mcp3208Ctrl_test.cpp.

◆ TEST_CASE() [17/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl synchronized non-delay service EMA uses global alpha"  ,
""  [mcp3208Ctrl] 
)

Verify synchronized non-delay service EMA uses the configurable global alpha.

Definition at line 1158 of file mcp3208Ctrl_test.cpp.

◆ TEST_CASE() [18/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl synchronized read latency EMA initializes and smooths"  ,
""  [mcp3208Ctrl] 
)

Verify synchronized read-latency EMA initializes from the first sample and smooths subsequent samples.

Definition at line 1111 of file mcp3208Ctrl_test.cpp.

References MagAOX::app::mcp3208Ctrl::timespecToNs().

◆ TEST_CASE() [19/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl synchronized stale helper detects missing streams"  ,
""  [mcp3208Ctrl] 
)

Verify stale-stream detection notices a missing synchronization stream backing file.

Definition at line 1325 of file mcp3208Ctrl_test.cpp.

◆ TEST_CASE() [20/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl synchronized timeout requests reconfig for a stale stream"  ,
""  [mcp3208Ctrl] 
)

Verify synchronized timeout requests reconfiguration when the trigger stream is stale.

Definition at line 1299 of file mcp3208Ctrl_test.cpp.

◆ TEST_CASE() [21/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl timer mode configureAcquisition sizes the output frame"  ,
""  [mcp3208Ctrl] 
)

Verify timer-driven acquisition configures the published frame geometry.

Definition at line 883 of file mcp3208Ctrl_test.cpp.

◆ TEST_CASE() [22/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl timer mode reads configured channels"  ,
""  [mcp3208Ctrl] 
)

Verify timer-driven acquisition still reads one frame of ADC values.

Definition at line 900 of file mcp3208Ctrl_test.cpp.

◆ TEST_CASE() [23/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl timer mode trigger interval initializes then measures"  ,
""  [mcp3208Ctrl] 
)

Verify timer-mode trigger interval diagnostics initialize then report measured intervals.

Definition at line 922 of file mcp3208Ctrl_test.cpp.

◆ TEST_CASE() [24/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl timing diagnostics compute wrapped phase error and lock thresholds"  ,
""  [mcp3208Ctrl] 
)

Verify timing diagnostics wrap phase error and require both lock thresholds.

Definition at line 584 of file mcp3208Ctrl_test.cpp.

◆ TEST_CASE() [25/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl timing diagnostics publish synchronized loop metrics"  ,
""  [mcp3208Ctrl] 
)

Verify synchronized-mode timing diagnostics publish loop state and derived error.

Definition at line 483 of file mcp3208Ctrl_test.cpp.

References MagAOX::app::mcp3208Ctrl::timespecToNs().

◆ TEST_CASE() [26/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl timing diagnostics track mode transitions"  ,
""  [mcp3208Ctrl] 
)

Verify timing diagnostics report timer mode and update mode code across transitions.

Definition at line 541 of file mcp3208Ctrl_test.cpp.

◆ TEST_CASE() [27/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl timing helpers convert between nanoseconds and timespec"  ,
""  [mcp3208Ctrl] 
)

Verify nanosecond and timespec conversions preserve normalized values.

Definition at line 612 of file mcp3208Ctrl_test.cpp.

References MagAOX::app::mcp3208Ctrl::nsToTimespec(), and MagAOX::app::mcp3208Ctrl::timespecToNs().

◆ TEST_CASE() [28/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl updateTriggerTiming applies negative synchroDelay offset with wrap"  ,
""  [mcp3208Ctrl] 
)

Verify synchronized timing applies a negative user offset with modulo wrap into the current period.

Definition at line 698 of file mcp3208Ctrl_test.cpp.

References MagAOX::app::mcp3208Ctrl::timespecToNs().

◆ TEST_CASE() [29/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl updateTriggerTiming applies positive synchroDelay offset"  ,
""  [mcp3208Ctrl] 
)

Verify synchronized timing applies a positive user offset to the modeled delay target.

Definition at line 668 of file mcp3208Ctrl_test.cpp.

References MagAOX::app::mcp3208Ctrl::timespecToNs().

◆ TEST_CASE() [30/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl updateTriggerTiming falls back to EMA period when fps is invalid"  ,
""  [mcp3208Ctrl] 
)

Verify synchronized timing falls back to EMA period when WFS fps is unavailable.

Definition at line 728 of file mcp3208Ctrl_test.cpp.

References MagAOX::app::mcp3208Ctrl::timespecToNs().

◆ TEST_CASE() [31/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl updateTriggerTiming guards non-positive period"  ,
""  [mcp3208Ctrl] 
)

Verify synchronized timing leaves trigger time unchanged when period estimate is non-positive.

Definition at line 852 of file mcp3208Ctrl_test.cpp.

◆ TEST_CASE() [32/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl updateTriggerTiming preserves positive raw delay"  ,
""  [mcp3208Ctrl] 
)

Verify synchronized timing leaves positive raw delays unchanged by modulo wrapping.

Definition at line 790 of file mcp3208Ctrl_test.cpp.

References MagAOX::app::mcp3208Ctrl::timespecToNs().

◆ TEST_CASE() [33/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl updateTriggerTiming uses configurable timing constants"  ,
""  [mcp3208Ctrl] 
)

Verify synchronized timing constants directly control the modeled delay target.

Definition at line 818 of file mcp3208Ctrl_test.cpp.

References MagAOX::app::mcp3208Ctrl::timespecToNs().

◆ TEST_CASE() [34/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl updateTriggerTiming uses measured semaphore period for delay model"  ,
""  [mcp3208Ctrl] 
)

Verify synchronized timing uses only the measured semaphore period for delay modeling.

Definition at line 626 of file mcp3208Ctrl_test.cpp.

References MagAOX::app::mcp3208Ctrl::timespecToNs().

◆ TEST_CASE() [35/35]

libXWCTest::mcp3208CtrlTest::TEST_CASE ( "mcp3208Ctrl updateTriggerTiming wraps delay with modulo period"  ,
""  [mcp3208Ctrl] 
)

Verify synchronized timing wraps negative raw delays into the current WFS period.

Definition at line 760 of file mcp3208Ctrl_test.cpp.

References MagAOX::app::mcp3208Ctrl::timespecToNs().