API
zaberUtils_test.cpp
Go to the documentation of this file.
1 /** \file zaberUtils_test.cpp
2  * \brief Catch2 tests for the zaberUtils in the zaberLowLevel app.
3  * \author Jared R. Males (jaredmales@gmail.com)
4  *
5  * History:
6  */
7 #include "../../../tests/catch2/catch.hpp"
8 
9 #include "../zaberUtils.hpp"
10 
11 using namespace MagAOX::app;
12 
13 namespace zaberUtils_test
14 {
15 
16 SCENARIO( "Parsing the system.serial response", "[zaberUtils]" )
17 {
18  GIVEN("A valid response to system.serial")
19  {
20  int rv;
21 
22  WHEN("Valid response")
23  {
24  std::string tstr = "@01 0 OK IDLE WR 49822@02 0 OK IDLE WR 49820@03 0 OK IDLE WR 49821\n";
25 
26  std::vector<int> address;
27  std::vector<std::string> serial;
28 
29  rv = parseSystemSerial(address, serial, tstr);
30 
31  REQUIRE(rv == 0);
32  REQUIRE( address[0] == 1 );
33  REQUIRE( address[1] == 2 );
34  REQUIRE( address[2] == 3 );
35 
36  REQUIRE( serial[0] == "49822" );
37  REQUIRE( serial[1] == "49820" );
38  REQUIRE( serial[2] == "49821" );
39  }
40  }
41 }
42 
43 } //namespace zaberUtils_test
#define GIVEN(desc)
Definition: catch.hpp:17763
#define WHEN(desc)
Definition: catch.hpp:17765
#define REQUIRE(...)
Definition: catch.hpp:17676
int parseSystemSerial(std::vector< int > &address, std::vector< std::string > &serial, const std::string &response)
Parse the system.serial query.
Definition: zaberUtils.hpp:30
SCENARIO("Parsing the system.serial response", "[zaberUtils]")