7 #include "../../../tests/catch2/catch.hpp"
9 #include "../rhusbMonParsers.hpp"
16 SCENARIO(
"Parsing the temp response",
"[rhusbMonParsers]" )
18 GIVEN(
"A valid response to C from the RH USB probe")
22 WHEN(
"Valid temp response, 20.0")
24 std::string tstr =
"20.0 C\r\n>";
33 WHEN(
"Valid temp response -1.2")
35 std::string tstr =
"-1.2 C\r\n>";
44 WHEN(
"Valid temp response 1.2")
46 std::string tstr =
"1.2 C\r\n>";
55 WHEN(
"Valid temp response 01.2")
57 std::string tstr =
"01.2 C\r\n>";
67 GIVEN(
"Invalid responses to C from the RH USB probe")
71 WHEN(
"Invalid temp response 20.0 C\r>")
73 std::string tstr =
"20.0 C\r>";
81 WHEN(
"Invalid temp response 20.0C\r>")
83 std::string tstr =
"20.0 C\r>";
91 WHEN(
"Invalid temp response 20.0 \r\n>")
93 std::string tstr =
"20.0 \r\n>";
101 WHEN(
"Invalid temp response 20.0 >")
103 std::string tstr =
"20.0 >";
111 WHEN(
"Invalid temp response ' C\r\n>'")
113 std::string tstr =
" C\r\n>";
121 WHEN(
"Invalid temp response 'A C\r\n>'")
123 std::string tstr =
"A C\r\n>";
133 SCENARIO(
"Parsing the humidity response",
"[rhusbMonParsers]" )
135 GIVEN(
"A valid response to H from the RH USB probe")
139 WHEN(
"Valid temp response")
141 std::string tstr =
"20.0 %RH\r\n>";
150 WHEN(
"Valid temp response")
152 std::string tstr =
"1.2 %RH\r\n>";
161 WHEN(
"Valid temp response")
163 std::string tstr =
"09.9 %RH\r\n>";
172 WHEN(
"Valid temp response")
174 std::string tstr =
"0.2 %RH\r\n>";
184 GIVEN(
"Invalid responses to H from the RH USB probe")
188 WHEN(
"Invalid humidity response 20.0 %RH\r>")
190 std::string tstr =
"20.0 %RH\r>";
198 WHEN(
"Invalid humidity response 20.0%RH\r>")
200 std::string tstr =
"20.0 %RH\r>";
208 WHEN(
"Invalid humidity response 20.0 \r\n>")
210 std::string tstr =
"20.0 \r\n>";
218 WHEN(
"Invalid humidity response 20.0 >")
220 std::string tstr =
"20.0 >";
228 WHEN(
"Invalid humidity response ' %RH\r\n>'")
230 std::string tstr =
" %RH\r\n>";
238 WHEN(
"Invalid humidity response 'A %RH\r\n>'")
240 std::string tstr =
"A %RH\r\n>";
248 WHEN(
"Invalid humidity response '-1.2 %RH\r\n>'")
250 std::string tstr =
"-1.2 %RH\r\n>";
int parseH(float &humid, const std::string &str)
Parse the RH probe H humidity command.
int parseC(float &temp, const std::string &str)
Parse the RH probe C temp command.
SCENARIO("Parsing the humidity response", "[rhusbMonParsers]")