Integration tests for the command line (#26)

* WIP

* first test

* format

* test frames

* also 0:
This commit is contained in:
Erik Fröjdh
2019-05-31 14:40:45 +02:00
committed by Dhanya Thattil
parent 0eec57f8a2
commit 4b1a9bea32
4 changed files with 67 additions and 22 deletions

View File

@@ -2,4 +2,5 @@ target_sources(tests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/test-SharedMemory.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test-slsDetector.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test-multiSlsDetector.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test-multiSlsDetectorClient.cpp
)

View File

@@ -0,0 +1,40 @@
#include "catch.hpp"
#include "multiSlsDetectorClient.h"
#include "sls_detector_defs.h"
#include <sstream>
auto GET = slsDetectorDefs::GET_ACTION;
auto PUT = slsDetectorDefs::PUT_ACTION;
TEST_CASE("rx_fifodepth", "[.cmd]") {
auto oss = std::ostringstream{};
multiSlsDetectorClient("rx_fifodepth 10", PUT, nullptr, oss);
REQUIRE(oss.str() == "rx_fifodepth 10\n");
oss = std::ostringstream{};
multiSlsDetectorClient("rx_fifodepth 100", PUT, nullptr, oss);
REQUIRE(oss.str() == "rx_fifodepth 100\n");
oss = std::ostringstream{};
multiSlsDetectorClient("rx_fifodepth", GET, nullptr, oss);
REQUIRE(oss.str() == "rx_fifodepth 100\n");
oss = std::ostringstream{};
multiSlsDetectorClient("0:rx_fifodepth", GET, nullptr, oss);
REQUIRE(oss.str() == "0:rx_fifodepth 100\n");
}
TEST_CASE("frames", "[.cmd]"){
auto oss = std::ostringstream{};
multiSlsDetectorClient("frames 1000", PUT, nullptr, oss);
REQUIRE(oss.str() == "frames 1000\n");
oss = std::ostringstream{};
multiSlsDetectorClient("frames", GET, nullptr, oss);
REQUIRE(oss.str() == "frames 1000\n");
oss = std::ostringstream{};
multiSlsDetectorClient("frames 1", PUT, nullptr, oss);
REQUIRE(oss.str() == "frames 1\n");
}