7#include "../../../tests/catch2/catch.hpp"
9#include "../ocamUtils.hpp"
20SCENARIO(
"Parsing the temp response",
"[ocamUtils]" )
22 GIVEN(
"A valid response to temp from the OCAM" )
26 WHEN(
"Valid temp response" )
28 std::string tstr =
"Temperatures : CCD[26.3] CPU[41] POWER[34] BIAS[47] WATER[24.2] LEFT[33] RIGHT[38] "
29 "SET[200]\nCooling Power [102]mW.\n\n";
35 REQUIRE( temps.
CCD == (
float)26.3 );
36 REQUIRE( temps.
CPU == (
float)41 );
37 REQUIRE( temps.
POWER == (
float)34 );
38 REQUIRE( temps.
BIAS == (
float)47 );
39 REQUIRE( temps.
WATER == (
float)24.2 );
40 REQUIRE( temps.
LEFT == (
float)33 );
41 REQUIRE( temps.
RIGHT == (
float)38 );
42 REQUIRE( temps.
SET == (
float)20.0 );
47 GIVEN(
"An invalid response to temp from the OCAM, too short" )
51 WHEN(
"Temp response is too short" )
53 std::string tstr =
"Temperatures : CCD[26.3] CPU[41] POWER[34] BIAS[47] WATER[24.2] LEFT[33] RIGHT[38] "
54 "SET[200]\nCooling Power";
68SCENARIO(
"Parsing the gain response",
"[ocamUtils]" )
70 GIVEN(
"A valid response to gain from the OCAM" )
74 WHEN(
"Valid gain response, gain=2" )
76 std::string tstr =
"Gain set to 2 \n\n";
83 REQUIRE( emgain == 2 );
87 GIVEN(
"A valid response to gain from the OCAM" )
91 WHEN(
"Valid gain response, gain=512" )
93 std::string tstr =
"Gain set to 512 \n\n";
100 REQUIRE( emgain == 512 );
104 GIVEN(
"An invalid response to gain from the OCAM" )
108 WHEN(
"Invalid gain response, too short, no trailing space" )
110 std::string tstr =
"Gain set to 512\n\n";
117 REQUIRE( emgain == 0 );
120 WHEN(
"Invalid gain response, too short, no gain" )
122 std::string tstr =
"Gain set to \n\n";
129 REQUIRE( emgain == 0 );
132 WHEN(
"Invalid gain response, too long" )
134 std::string tstr =
"Gain set to 512 rubbish added\n\n";
141 REQUIRE( emgain == 0 );
144 WHEN(
"Invalid gain response, low gain" )
146 std::string tstr =
"Gain set to 0 \n\n";
153 REQUIRE( emgain == 0 );
156 WHEN(
"Invalid gain response, high gain" )
158 std::string tstr =
"Gain set to 601 \n\n";
165 REQUIRE( emgain == 0 );
168 WHEN(
"Invalid gain response, bad gain" )
170 std::string tstr =
"Gain set to x \n\n";
177 REQUIRE( emgain == 0 );
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.
SCENARIO("Parsing the temp response", "[ocamUtils]")
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.