API
 
Loading...
Searching...
No Matches
cred2Ctrl_test.cpp File Reference

Catch2 tests for the cred2Ctrl app. More...

#include "../../../tests/testXWC.hpp"
#include <atomic>
#include <array>
#include <chrono>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <fstream>
#include <string>
#include <thread>
#include <unistd.h>
#include <vector>
#include "../cred2Ctrl.hpp"
Include dependency graph for cred2Ctrl_test.cpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  libXWCTest
 Namespace for all libXWC tests.
 
namespace  libXWCTest::cred2CtrlTest
 Namespace for cred2Ctrl lifecycle unit tests.
 

Macros

#define protected   public
 

Functions

Dependentpdv_alloc_dependent ()
 Allocate a stub EDT dependent configuration object.
 
int pdv_readcfg (const char *configFile, Dependent *dd_p, Edtinfo *edtinfo)
 Read a stub EDT configuration file.
 
EdtDevedt_open_channel (const char *deviceName, int unit, int channel)
 Open a stub EDT device channel.
 
void edt_perror (char *errstr)
 Report the last stub EDT error message.
 
int pdv_initcam (EdtDev *edt_p, Dependent *dd_p, int unit, Edtinfo *edtinfo, const char *configFile, char *bitdir, int pdv_debug)
 Initialize a stub EDT camera instance.
 
void edt_close (EdtDev *edt_p)
 Close a stub EDT device channel.
 
PdvDevpdv_open_channel (const char *deviceName, int unit, int channel)
 Open a stub PDV device handle.
 
void pdv_close (PdvDev *pdv_p)
 Close a stub PDV device handle.
 
void pdv_flush_fifo (PdvDev *pdv_p)
 Flush the stub PDV FIFO.
 
void pdv_serial_read_enable (PdvDev *pdv_p)
 Enable stub PDV serial reads.
 
int pdv_get_width (PdvDev *pdv_p)
 Return the stub PDV frame width.
 
int pdv_get_height (PdvDev *pdv_p)
 Return the stub PDV frame height.
 
int pdv_get_depth (PdvDev *pdv_p)
 Return the stub PDV frame bit depth.
 
char * pdv_get_cameratype (PdvDev *pdv_p)
 Return the stub PDV camera type string.
 
void pdv_multibuf (PdvDev *pdv_p, int numBuffs)
 Configure the stub PDV ring-buffer depth.
 
void pdv_start_images (PdvDev *pdv_p, int numBuffs)
 Start stub PDV acquisition for multiple images.
 
u_charpdv_wait_last_image_timed (PdvDev *pdv_p, uint dmaTimeStamp[2])
 Wait for the last stub PDV image and fill the DMA timestamp.
 
void pdv_start_image (PdvDev *pdv_p)
 Start acquisition of the next stub PDV image.
 
int pdv_serial_read (PdvDev *pdv_p, char *buf, int size)
 Read bytes from the stub PDV serial channel.
 
int pdv_serial_command (PdvDev *pdv_p, const char *command)
 Send a command over the stub PDV serial channel.
 
int pdv_serial_wait (PdvDev *pdv_p, int timeout, int count)
 Wait for serial data on the stub PDV channel.
 
int pdv_get_waitchar (PdvDev *pdv_p, u_char *waitc)
 Return the configured stub PDV serial terminator.
 
int pdv_serial_set_baud (PdvDev *pdv_p, int baud)
 
int pdv_serial_get_baud (PdvDev *pdv_p)
 
 libXWCTest::cred2CtrlTest::TEST_CASE ("cred2Ctrl configuration loading writes a runtime EDT config", "[cred2Ctrl]")
 Verify configuration loading writes the runtime EDT config and applies overrides.
 
 libXWCTest::cred2CtrlTest::TEST_CASE ("cred2Ctrl helper mappings normalize responses and preset names", "[cred2Ctrl]")
 Verify local response helpers cover the C-RED 2-specific preset mappings.
 
 libXWCTest::cred2CtrlTest::TEST_CASE ("cred2Ctrl command helpers clean responses and validate acknowledgements", "[cred2Ctrl]")
 Verify serial helper wrappers clean responses and report transport failures consistently.
 
 libXWCTest::cred2CtrlTest::TEST_CASE ("cred2Ctrl syncROIFromCamera tracks camera cropping state", "[cred2Ctrl]")
 Verify ROI synchronization handles full-frame, cropped, and reconfiguring camera states.
 
 libXWCTest::cred2CtrlTest::TEST_CASE ("cred2Ctrl getter helpers parse temperatures fps and limits", "[cred2Ctrl]")
 Verify the primary getter helpers update cached state and tolerate malformed responses.
 
 libXWCTest::cred2CtrlTest::TEST_CASE ("cred2Ctrl discrete getter helpers cover fallback parsing paths", "[cred2Ctrl]")
 Verify the remaining getter helpers parse discrete fan gain and LED state.
 
 libXWCTest::cred2CtrlTest::TEST_CASE ("cred2Ctrl setter helpers validate bounds and update state", "[cred2Ctrl]")
 Verify the setter helpers validate bounds and send the expected serial commands.
 
 libXWCTest::cred2CtrlTest::TEST_CASE ("cred2Ctrl framegrabber helpers manage acquisition and ROI configuration", "[cred2Ctrl]")
 Verify framegrabber-facing helpers cover acquisition, copying, and reconfiguration logic.
 
 libXWCTest::cred2CtrlTest::TEST_CASE ("cred2Ctrl telemetry wrappers and power-off helpers update cached state", "[cred2Ctrl]")
 Verify telemetry wrappers emit their records and helper lifecycle methods reset cached state.
 
 libXWCTest::cred2CtrlTest::TEST_CASE ("cred2Ctrl appLogic handles connection and housekeeping flow", "[cred2Ctrl]")
 Verify appLogic covers connection transitions, steady-state refresh, and hardware-loss handling.
 

Detailed Description

Catch2 tests for the cred2Ctrl app.

Author
OpenAI Codex

Definition in file cred2Ctrl_test.cpp.

Macro Definition Documentation

◆ protected

#define protected   public

Definition at line 28 of file cred2Ctrl_test.cpp.

Function Documentation

◆ edt_close()

void edt_close ( EdtDev edt_p)

Close a stub EDT device channel.

Definition at line 169 of file cred2Ctrl_test.cpp.

Referenced by MagAOX::app::dev::edtCamera< derivedT >::pdvConfig().

◆ edt_open_channel()

EdtDev * edt_open_channel ( const char *  deviceName,
int  unit,
int  channel 
)

Open a stub EDT device channel.

Definition at line 134 of file cred2Ctrl_test.cpp.

Referenced by MagAOX::app::dev::edtCamera< derivedT >::pdvConfig().

◆ edt_perror()

void edt_perror ( char *  errstr)

Report the last stub EDT error message.

Definition at line 143 of file cred2Ctrl_test.cpp.

Referenced by MagAOX::app::dev::edtCamera< derivedT >::pdvConfig(), and libXWCTest::cred2CtrlTest::TEST_CASE().

◆ pdv_alloc_dependent()

Dependent * pdv_alloc_dependent ( )

Allocate a stub EDT dependent configuration object.

Definition at line 120 of file cred2Ctrl_test.cpp.

Referenced by MagAOX::app::dev::edtCamera< derivedT >::pdvConfig().

◆ pdv_close()

void pdv_close ( PdvDev pdv_p)

Close a stub PDV device handle.

Definition at line 183 of file cred2Ctrl_test.cpp.

Referenced by MagAOX::app::dev::edtCamera< derivedT >::~edtCamera(), and MagAOX::app::dev::edtCamera< derivedT >::pdvConfig().

◆ pdv_flush_fifo()

void pdv_flush_fifo ( PdvDev pdv_p)

Flush the stub PDV FIFO.

Definition at line 188 of file cred2Ctrl_test.cpp.

Referenced by MagAOX::app::dev::edtCamera< derivedT >::pdvConfig().

◆ pdv_get_cameratype()

char * pdv_get_cameratype ( PdvDev pdv_p)

Return the stub PDV camera type string.

Definition at line 216 of file cred2Ctrl_test.cpp.

Referenced by MagAOX::app::dev::edtCamera< derivedT >::pdvConfig().

◆ pdv_get_depth()

int pdv_get_depth ( PdvDev pdv_p)

Return the stub PDV frame bit depth.

Definition at line 210 of file cred2Ctrl_test.cpp.

Referenced by MagAOX::app::dev::edtCamera< derivedT >::pdvConfig().

◆ pdv_get_height()

int pdv_get_height ( PdvDev pdv_p)

Return the stub PDV frame height.

Definition at line 204 of file cred2Ctrl_test.cpp.

Referenced by MagAOX::app::dev::edtCamera< derivedT >::pdvConfig().

◆ pdv_get_waitchar()

int pdv_get_waitchar ( PdvDev pdv_p,
u_char waitc 
)

Return the configured stub PDV serial terminator.

Definition at line 330 of file cred2Ctrl_test.cpp.

Referenced by MagAOX::app::dev::edtCamera< derivedT >::pdvSerialWriteRead().

◆ pdv_get_width()

int pdv_get_width ( PdvDev pdv_p)

Return the stub PDV frame width.

Definition at line 198 of file cred2Ctrl_test.cpp.

Referenced by MagAOX::app::dev::edtCamera< derivedT >::pdvConfig().

◆ pdv_initcam()

int pdv_initcam ( EdtDev edt_p,
Dependent dd_p,
int  unit,
Edtinfo edtinfo,
const char *  configFile,
char *  bitdir,
int  pdv_debug 
)

Initialize a stub EDT camera instance.

Definition at line 151 of file cred2Ctrl_test.cpp.

Referenced by MagAOX::app::dev::edtCamera< derivedT >::pdvConfig().

◆ pdv_multibuf()

void pdv_multibuf ( PdvDev pdv_p,
int  numBuffs 
)

Configure the stub PDV ring-buffer depth.

Definition at line 223 of file cred2Ctrl_test.cpp.

Referenced by MagAOX::app::dev::edtCamera< derivedT >::pdvConfig().

◆ pdv_open_channel()

PdvDev * pdv_open_channel ( const char *  deviceName,
int  unit,
int  channel 
)

Open a stub PDV device handle.

Definition at line 174 of file cred2Ctrl_test.cpp.

Referenced by MagAOX::app::dev::edtCamera< derivedT >::pdvConfig().

◆ pdv_readcfg()

int pdv_readcfg ( const char *  configFile,
Dependent dd_p,
Edtinfo edtinfo 
)

Read a stub EDT configuration file.

Definition at line 125 of file cred2Ctrl_test.cpp.

Referenced by MagAOX::app::dev::edtCamera< derivedT >::pdvConfig().

◆ pdv_serial_command()

int pdv_serial_command ( PdvDev pdv_p,
const char *  command 
)

Send a command over the stub PDV serial channel.

Definition at line 278 of file cred2Ctrl_test.cpp.

Referenced by MagAOX::app::dev::edtCamera< derivedT >::pdvSerialWriteRead(), and libXWCTest::cred2CtrlTest::TEST_CASE().

◆ pdv_serial_get_baud()

int pdv_serial_get_baud ( PdvDev pdv_p)

Definition at line 353 of file cred2Ctrl_test.cpp.

◆ pdv_serial_read()

int pdv_serial_read ( PdvDev pdv_p,
char *  buf,
int  size 
)

Read bytes from the stub PDV serial channel.

Definition at line 251 of file cred2Ctrl_test.cpp.

Referenced by MagAOX::app::dev::edtCamera< derivedT >::pdvSerialWriteRead(), and libXWCTest::cred2CtrlTest::TEST_CASE().

◆ pdv_serial_read_enable()

void pdv_serial_read_enable ( PdvDev pdv_p)

Enable stub PDV serial reads.

Definition at line 193 of file cred2Ctrl_test.cpp.

Referenced by MagAOX::app::dev::edtCamera< derivedT >::pdvConfig().

◆ pdv_serial_set_baud()

int pdv_serial_set_baud ( PdvDev pdv_p,
int  baud 
)

Definition at line 340 of file cred2Ctrl_test.cpp.

◆ pdv_serial_wait()

int pdv_serial_wait ( PdvDev pdv_p,
int  timeout,
int  count 
)

Wait for serial data on the stub PDV channel.

Definition at line 310 of file cred2Ctrl_test.cpp.

Referenced by MagAOX::app::dev::edtCamera< derivedT >::pdvSerialWriteRead(), and libXWCTest::cred2CtrlTest::TEST_CASE().

◆ pdv_start_image()

void pdv_start_image ( PdvDev pdv_p)

Start acquisition of the next stub PDV image.

Definition at line 245 of file cred2Ctrl_test.cpp.

Referenced by MagAOX::app::dev::edtCamera< derivedT >::pdvAcquire().

◆ pdv_start_images()

void pdv_start_images ( PdvDev pdv_p,
int  numBuffs 
)

Start stub PDV acquisition for multiple images.

Definition at line 230 of file cred2Ctrl_test.cpp.

Referenced by MagAOX::app::dev::edtCamera< derivedT >::pdvStartAcquisition().

◆ pdv_wait_last_image_timed()

u_char * pdv_wait_last_image_timed ( PdvDev pdv_p,
uint  dmaTimeStamp[2] 
)

Wait for the last stub PDV image and fill the DMA timestamp.

Definition at line 237 of file cred2Ctrl_test.cpp.

Referenced by MagAOX::app::dev::edtCamera< derivedT >::pdvAcquire().