API
 
Loading...
Searching...
No Matches

Catch2 tests for the ocam2KCtrl app. More...

#include "../../../tests/testXWC.hpp"
#include <chrono>
#include <array>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <semaphore.h>
#include <stdexcept>
#include <string>
#include <thread>
#include <unistd.h>
#include <vector>
#include "../ocam2KCtrl.hpp"
Include dependency graph for ocam2KCtrl_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::ocam2KCtrlTest
 Namespace for ocam2KCtrl 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.
 
const char * ocam2_sdkVersion ()
 Return sdk version.
 
const char * ocam2_sdkBuild ()
 Return sdk build.
 
ocam2_rc ocam2_init (ocam2_mode mode, const char *descrbFile, ocam2_id *id)
 Create a camera instance with the provided mode.
 
void ocam2_descramble (ocam2_id id, unsigned int *number, short *image, const short *imageRaw)
 Create a camera instance with the provided mode.
 
ocam2_rc ocam2_exit (ocam2_id id)
 Clear a camera instance.
 
ocam2_mode ocam2_getMode (ocam2_id id)
 Return the camera mode.
 
const char * ocam2_modeStr (ocam2_mode mode)
 Return a description text for camera mode.
 
 libXWCTest::ocam2KCtrlTest::TEST_CASE ("ocam2KCtrl sync stream creation uses a 1x1 uint8 layout", "[ocam2KCtrl]")
 Verify the sync stream is created as a 1x1 uint8 ImageStreamIO buffer.
 
 libXWCTest::ocam2KCtrlTest::TEST_CASE ("ocam2KCtrl sync stream publication mirrors metadata and posts semaphores", "[ocam2KCtrl]")
 Verify the sync stream mirrors main-stream metadata and posts a semaphore.
 
 libXWCTest::ocam2KCtrlTest::TEST_CASE ("ocam2KCtrl ensureSyncStream reuses and replaces existing stream state", "[ocam2KCtrl]")
 Verify sync-stream preparation reuses valid streams and recovers from stale or mismatched ones.
 
 libXWCTest::ocam2KCtrlTest::TEST_CASE ("ocam2KCtrl stateString reports mode fps gain and setpoint", "[ocam2KCtrl]")
 Verify the stdCamera state string is assembled from the OCAM state members.
 
 libXWCTest::ocam2KCtrlTest::TEST_CASE ("ocam2KCtrl stateStringValid requires OPERATING and on-target temperature control", "[ocam2KCtrl]")
 Verify the state string validity depends on operating state and temperature lock.
 
 libXWCTest::ocam2KCtrlTest::TEST_CASE ("ocam2KCtrl configuration loading handles defaults and supported gain limits", "[ocam2KCtrl]")
 Verify OCAM-specific configuration values load defaults, overrides, and gain clamps.
 
 libXWCTest::ocam2KCtrlTest::TEST_CASE ("ocam2KCtrl getTemps handles valid and malformed serial responses", "[ocam2KCtrl]")
 Verify temperature queries handle valid and malformed serial responses.
 
 libXWCTest::ocam2KCtrlTest::TEST_CASE ("ocam2KCtrl getFPS handles valid and malformed serial responses", "[ocam2KCtrl]")
 Verify FPS queries handle valid and malformed serial responses, plus synchro mode.
 
 libXWCTest::ocam2KCtrlTest::TEST_CASE ("ocam2KCtrl temperature control helpers handle valid and invalid requests", "[ocam2KCtrl]")
 Verify the temperature-control helpers handle safe, unsafe, and valid setpoint requests.
 
 libXWCTest::ocam2KCtrlTest::TEST_CASE ("ocam2KCtrl setShutter rejects invalid shutter requests", "[ocam2KCtrl]")
 Verify the shutter adapter rejects invalid requests before touching the DSS threads.
 
 libXWCTest::ocam2KCtrlTest::TEST_CASE ("ocam2KCtrl helper interfaces reset local state and power-off lifecycle flags", "[ocam2KCtrl]")
 Verify simple helper methods update local app state without hardware dependencies.
 
 libXWCTest::ocam2KCtrlTest::TEST_CASE ("ocam2KCtrl startAcquisition resets frame tracking and starts EDT buffers", "[ocam2KCtrl]")
 Verify acquisition startup requests EDT buffering and resets the image counter.
 
 libXWCTest::ocam2KCtrlTest::TEST_CASE ("ocam2KCtrl acquireAndCheckValid handles valid, skipped, and corrupt frame numbers", "[ocam2KCtrl]")
 Verify frame acquisition timestamps and frame-number handling across valid and invalid sequences.
 
 libXWCTest::ocam2KCtrlTest::TEST_CASE ("ocam2KCtrl loadImageIntoStream uses the OCAM descramble output", "[ocam2KCtrl]")
 Verify the raw image pointer is passed through to the OCAM descramble routine.
 
 libXWCTest::ocam2KCtrlTest::TEST_CASE ("ocam2KCtrl serial gain helpers handle valid and invalid responses", "[ocam2KCtrl]")
 Verify the serial gain helpers accept valid responses and handle malformed or tripped ones.
 
 libXWCTest::ocam2KCtrlTest::TEST_CASE ("ocam2KCtrl serial setter commands send the expected sequence", "[ocam2KCtrl]")
 Verify the serial setter commands send the expected OCAM command sequence.
 
 libXWCTest::ocam2KCtrlTest::TEST_CASE ("ocam2KCtrl configureAcquisition handles valid and invalid OCAM modes", "[ocam2KCtrl]")
 Verify acquisition configuration programs the OCAM mode and handles invalid frame shapes.
 
 libXWCTest::ocam2KCtrlTest::TEST_CASE ("ocam2KCtrl INDI callbacks update local state", "[ocam2KCtrl]")
 Verify the INDI callbacks update confirmation state and sync-frequency-driven reconfiguration.
 
 libXWCTest::ocam2KCtrlTest::TEST_CASE ("ocam2KCtrl static INDI callback wrappers forward requests to the instance", "[ocam2KCtrl]")
 Verify the generated static INDI wrappers forward into the instance callbacks.
 
 libXWCTest::ocam2KCtrlTest::TEST_CASE ("ocam2KCtrl telemetry wrappers record snapshots and stale intervals", "[ocam2KCtrl]")
 Verify telemetry wrapper helpers emit their records and interval checks trigger stale telemetry.
 
 libXWCTest::ocam2KCtrlTest::TEST_CASE ("ocam2KCtrl appLogic handles connection and housekeeping flow", "[ocam2KCtrl]")
 Verify appLogic covers connection transitions, error handling, and READY-state housekeeping.
 
 libXWCTest::ocam2KCtrlTest::TEST_CASE ("ocam2KCtrl reconfig reloads the next mode through edtCamera", "[ocam2KCtrl]")
 Verify reconfiguration reloads the requested mode and leaves the app in READY.
 

Detailed Description

Catch2 tests for the ocam2KCtrl app.

Author
OpenAI Codex

Definition in file ocam2KCtrl_test.cpp.

Macro Definition Documentation

◆ protected

#define protected   public

Definition at line 28 of file ocam2KCtrl_test.cpp.

Function Documentation

◆ edt_close()

void edt_close ( EdtDev edt_p)

Close a stub EDT device channel.

Definition at line 197 of file ocam2KCtrl_test.cpp.

◆ edt_open_channel()

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

Open a stub EDT device channel.

Definition at line 162 of file ocam2KCtrl_test.cpp.

◆ edt_perror()

void edt_perror ( char *  errstr)

Report the last stub EDT error message.

Definition at line 171 of file ocam2KCtrl_test.cpp.

◆ ocam2_descramble()

void ocam2_descramble ( ocam2_id  id,
unsigned int *  number,
short *  image,
const short *  imageRaw 
)

Create a camera instance with the provided mode.

Parameters
[in]idcamera identifier
[out]numberImage number
[out]imageDescrambled image
[in]imageRawRaw image
Returns
none

Definition at line 389 of file ocam2KCtrl_test.cpp.

◆ ocam2_exit()

ocam2_rc ocam2_exit ( ocam2_id  id)

Clear a camera instance.

Parameters
[in]idcamera identifier
Returns
Return OK or Error

Definition at line 407 of file ocam2KCtrl_test.cpp.

References OCAM2_OK.

◆ ocam2_getMode()

ocam2_mode ocam2_getMode ( ocam2_id  id)

Return the camera mode.

Parameters
[in]idcamera identifier
Returns
camera mode as ocam2_mode

Definition at line 414 of file ocam2KCtrl_test.cpp.

◆ ocam2_init()

ocam2_rc ocam2_init ( ocam2_mode  mode,
const char *  descrbFile,
ocam2_id id 
)

Create a camera instance with the provided mode.

Parameters
[in]modecamera mode
[in]descrbFiledescrambling file to use
[out]idcamera identifier
Returns
Return OK or Error

Definition at line 377 of file ocam2KCtrl_test.cpp.

◆ ocam2_modeStr()

const char * ocam2_modeStr ( ocam2_mode  mode)

Return a description text for camera mode.

Parameters
[in]modecamera mode
Returns
camera mode description as a string

Definition at line 420 of file ocam2KCtrl_test.cpp.

◆ ocam2_sdkBuild()

const char * ocam2_sdkBuild ( )

Return sdk build.

Returns
sdk build as a string

Definition at line 372 of file ocam2KCtrl_test.cpp.

◆ ocam2_sdkVersion()

const char * ocam2_sdkVersion ( )

Return sdk version.

Returns
sdk version as a string

Definition at line 367 of file ocam2KCtrl_test.cpp.

◆ pdv_alloc_dependent()

Dependent * pdv_alloc_dependent ( )

Allocate a stub EDT dependent configuration object.

Definition at line 149 of file ocam2KCtrl_test.cpp.

◆ pdv_close()

void pdv_close ( PdvDev pdv_p)

Close a stub PDV device handle.

Definition at line 211 of file ocam2KCtrl_test.cpp.

◆ pdv_flush_fifo()

void pdv_flush_fifo ( PdvDev pdv_p)

Flush the stub PDV FIFO.

Definition at line 216 of file ocam2KCtrl_test.cpp.

◆ pdv_get_cameratype()

char * pdv_get_cameratype ( PdvDev pdv_p)

Return the stub PDV camera type string.

Definition at line 244 of file ocam2KCtrl_test.cpp.

◆ pdv_get_depth()

int pdv_get_depth ( PdvDev pdv_p)

Return the stub PDV frame bit depth.

Definition at line 238 of file ocam2KCtrl_test.cpp.

◆ pdv_get_height()

int pdv_get_height ( PdvDev pdv_p)

Return the stub PDV frame height.

Definition at line 232 of file ocam2KCtrl_test.cpp.

◆ pdv_get_waitchar()

int pdv_get_waitchar ( PdvDev pdv_p,
u_char waitc 
)

Return the configured stub PDV serial terminator.

Definition at line 357 of file ocam2KCtrl_test.cpp.

◆ pdv_get_width()

int pdv_get_width ( PdvDev pdv_p)

Return the stub PDV frame width.

Definition at line 226 of file ocam2KCtrl_test.cpp.

◆ 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 179 of file ocam2KCtrl_test.cpp.

◆ pdv_multibuf()

void pdv_multibuf ( PdvDev pdv_p,
int  numBuffs 
)

Configure the stub PDV ring-buffer depth.

Definition at line 251 of file ocam2KCtrl_test.cpp.

◆ pdv_open_channel()

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

Open a stub PDV device handle.

Definition at line 202 of file ocam2KCtrl_test.cpp.

◆ pdv_readcfg()

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

Read a stub EDT configuration file.

Definition at line 154 of file ocam2KCtrl_test.cpp.

◆ 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 305 of file ocam2KCtrl_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 278 of file ocam2KCtrl_test.cpp.

◆ pdv_serial_read_enable()

void pdv_serial_read_enable ( PdvDev pdv_p)

Enable stub PDV serial reads.

Definition at line 221 of file ocam2KCtrl_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 337 of file ocam2KCtrl_test.cpp.

◆ pdv_start_image()

void pdv_start_image ( PdvDev pdv_p)

Start acquisition of the next stub PDV image.

Definition at line 272 of file ocam2KCtrl_test.cpp.

◆ pdv_start_images()

void pdv_start_images ( PdvDev pdv_p,
int  numBuffs 
)

Start stub PDV acquisition for multiple images.

Definition at line 257 of file ocam2KCtrl_test.cpp.

◆ 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 264 of file ocam2KCtrl_test.cpp.