8#include "../../../tests/testXWC.hpp"
10#include "../ocamUtils.hpp"
26namespace ocam2KCtrlTest
33TEST_CASE(
"ocam2KCtrl utility helpers parse temperature responses",
"[ocamUtils]" )
36 #ifdef OCAM2KCTRL_TEST_DOXYGEN_REF
41 SECTION(
"valid temperature responses are parsed" )
43 std::string tstr =
"Temperatures : CCD[26.3] CPU[41] POWER[34] BIAS[47] WATER[24.2] LEFT[33] RIGHT[38] "
44 "SET[200]\nCooling Power [102]mW.\n\n";
49 REQUIRE( temps.
CCD == (
float)26.3 );
50 REQUIRE( temps.
CPU == (
float)41 );
51 REQUIRE( temps.
POWER == (
float)34 );
52 REQUIRE( temps.
BIAS == (
float)47 );
53 REQUIRE( temps.
WATER == (
float)24.2 );
54 REQUIRE( temps.
LEFT == (
float)33 );
55 REQUIRE( temps.
RIGHT == (
float)38 );
56 REQUIRE( temps.
SET == (
float)20.0 );
60 SECTION(
"truncated temperature responses are rejected" )
62 std::string tstr =
"Temperatures : CCD[26.3] CPU[41] POWER[34] BIAS[47] WATER[24.2] LEFT[33] RIGHT[38] "
63 "SET[200]\nCooling Power";
75TEST_CASE(
"ocam2KCtrl utility helpers parse gain responses",
"[ocamUtils]" )
78 #ifdef OCAM2KCTRL_TEST_DOXYGEN_REF
83 SECTION(
"valid gain responses are parsed" )
86 int rv =
parseEMGain( emgain,
"Gain set to 2 \n\n" );
89 REQUIRE( emgain == 2 );
92 SECTION(
"maximum supported gains are parsed" )
95 int rv =
parseEMGain( emgain,
"Gain set to 512 \n\n" );
98 REQUIRE( emgain == 512 );
101 SECTION(
"gain responses without the trailing delimiter are rejected" )
104 int rv =
parseEMGain( emgain,
"Gain set to 512\n\n" );
107 REQUIRE( emgain == 0 );
110 SECTION(
"gain responses without a numeric value are rejected" )
113 int rv =
parseEMGain( emgain,
"Gain set to \n\n" );
116 REQUIRE( emgain == 0 );
119 SECTION(
"gain responses with trailing junk are rejected" )
122 int rv =
parseEMGain( emgain,
"Gain set to 512 rubbish added\n\n" );
125 REQUIRE( emgain == 0 );
128 SECTION(
"gain responses below the supported range are rejected" )
131 int rv =
parseEMGain( emgain,
"Gain set to 0 \n\n" );
134 REQUIRE( emgain == 0 );
137 SECTION(
"gain responses above the supported range are rejected" )
140 int rv =
parseEMGain( emgain,
"Gain set to 601 \n\n" );
143 REQUIRE( emgain == 0 );
146 SECTION(
"gain responses with invalid tokens are rejected" )
149 int rv =
parseEMGain( emgain,
"Gain set to x \n\n" );
152 REQUIRE( emgain == 0 );
TEST_CASE("ocam2KCtrl lifecycle entrypoints handle startup failures and POWERON logic", "[ocam2KCtrl]")
Verify lifecycle entrypoints cover startup failure handling and the POWERON fast-return path.
int parseTemps(ocamTemps &temps, const std::string &tstr)
Parse the OCAM temp query and fill the ocamTemps structure.
int parseEMGain(unsigned &emGain, const std::string &fstr)
Parse the EM gain response.
Namespace for all libXWC tests.
Structure to hold the OCAM camera temperature readings returned by the device.
float WATER
Cooling water temperature.
float COOLING_POWER
the cooling power in 100 mw.
float BIAS
Bias temperature.
float SET
The CCD set temeperature.
float CCD
The detector temperature.
float POWER
Power supply temperature.
float CPU
The CPU temperature.
float LEFT
The left amplifier temperature.
float RIGHT
The right amplifier temperature.