mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-11 04:17:15 +02:00
tests add to namespace sls (#466)
* tests add to namespace sls * fixed for tests * finish up namespace sls for tests
This commit is contained in:
@ -6,6 +6,8 @@
|
||||
#include "tests/globals.h"
|
||||
#include <iostream>
|
||||
|
||||
namespace sls {
|
||||
|
||||
class MultiDetectorFixture {
|
||||
protected:
|
||||
DetectorImpl d;
|
||||
@ -136,7 +138,7 @@ TEST_CASE_METHOD(MultiDetectorFixture, "Get ID", "[.eigerintegration][cli]") {
|
||||
std::string hn = test::hostname;
|
||||
hn.erase(std::remove(begin(hn), end(hn), 'b'), end(hn));
|
||||
hn.erase(std::remove(begin(hn), end(hn), 'e'), end(hn));
|
||||
auto hostnames = sls::split(hn, '+');
|
||||
auto hostnames = split(hn, '+');
|
||||
CHECK(hostnames.size() == d.getNumberOfDetectors());
|
||||
for (int i = 0; i != d.getNumberOfDetectors(); ++i) {
|
||||
CHECK(d.getId(defs::DETECTOR_SERIAL_NUMBER, 0) ==
|
||||
@ -198,3 +200,5 @@ TEST_CASE_METHOD(MultiDetectorFixture, "rate correction",
|
||||
d.setRateCorrection(200);
|
||||
CHECK(d.getRateCorrection() == 200);
|
||||
}
|
||||
|
||||
} // namespace sls
|
||||
|
@ -24,6 +24,8 @@
|
||||
// extern std::string detector_type;
|
||||
// extern dt type;
|
||||
|
||||
namespace sls {
|
||||
|
||||
TEST_CASE("Single detector no receiver", "[.integration][.single]") {
|
||||
auto t = Module::getTypeFromDetector(test::hostname);
|
||||
CHECK(t == test::type);
|
||||
@ -283,14 +285,14 @@ TEST_CASE(
|
||||
CHECK(m.getRateCorrection() == ratecorr);
|
||||
|
||||
// ratecorr fail with dr 4 or 8
|
||||
CHECK_THROWS_AS(m.setDynamicRange(8), sls::RuntimeError);
|
||||
CHECK_THROWS_AS(m.setDynamicRange(8), RuntimeError);
|
||||
CHECK(m.getRateCorrection() == 0);
|
||||
m.setDynamicRange(16);
|
||||
m.setDynamicRange(16);
|
||||
m.setRateCorrection(ratecorr);
|
||||
m.setDynamicRange(16);
|
||||
m.setRateCorrection(ratecorr);
|
||||
CHECK_THROWS_AS(m.setDynamicRange(4), sls::RuntimeError);
|
||||
CHECK_THROWS_AS(m.setDynamicRange(4), RuntimeError);
|
||||
CHECK(m.getRateCorrection() == 0);
|
||||
}
|
||||
|
||||
@ -329,11 +331,11 @@ TEST_CASE("Chiptestboard Loading Patterns", "[.ctbintegration]") {
|
||||
m.setPatternWord(addr, word);
|
||||
CHECK(m.setPatternWord(addr, -1) == word);
|
||||
addr = MAX_ADDR;
|
||||
CHECK_THROWS_AS(m.setPatternWord(addr, word), sls::RuntimeError);
|
||||
CHECK_THROWS_AS(m.setPatternWord(addr, word), RuntimeError);
|
||||
CHECK_THROWS_WITH(m.setPatternWord(addr, word),
|
||||
Catch::Matchers::Contains("be between 0 and"));
|
||||
addr = -1;
|
||||
CHECK_THROWS_AS(m.setPatternWord(addr, word), sls::RuntimeError);
|
||||
CHECK_THROWS_AS(m.setPatternWord(addr, word), RuntimeError);
|
||||
CHECK_THROWS_WITH(m.setPatternWord(addr, word),
|
||||
Catch::Matchers::Contains("be between 0 and"));
|
||||
|
||||
@ -408,7 +410,7 @@ TEST_CASE("Chiptestboard Dbit offset, list, sampling, advinvert",
|
||||
CHECK(m.getReceiverDbitList().size() == 10);
|
||||
|
||||
list.push_back(64);
|
||||
CHECK_THROWS_AS(m.setReceiverDbitList(list), sls::RuntimeError);
|
||||
CHECK_THROWS_AS(m.setReceiverDbitList(list), RuntimeError);
|
||||
CHECK_THROWS_WITH(m.setReceiverDbitList(list),
|
||||
Catch::Matchers::Contains("be between 0 and 63"));
|
||||
|
||||
@ -476,7 +478,7 @@ TEST_CASE("Eiger or Jungfrau nextframenumber",
|
||||
CHECK(m.acquire() == slsDetectorDefs::OK);
|
||||
CHECK(m.getReceiverCurrentFrameIndex() == val);
|
||||
|
||||
CHECK_THROWS_AS(m.setNextFrameNumber(0), sls::RuntimeError);
|
||||
CHECK_THROWS_AS(m.setNextFrameNumber(0), RuntimeError);
|
||||
|
||||
if (m.getDetectorTypeAsString() == "Eiger") {
|
||||
val = 281474976710655;
|
||||
@ -511,8 +513,10 @@ TEST_CASE("Eiger partialread", "[.eigerintegration][partialread]") {
|
||||
m.setDynamicRange(8);
|
||||
m.setPartialReadout(256);
|
||||
CHECK(m.getPartialReadout() == 256);
|
||||
CHECK_THROWS_AS(m.setPartialReadout(1), sls::RuntimeError);
|
||||
CHECK_THROWS_AS(m.setPartialReadout(1), RuntimeError);
|
||||
CHECK(m.getPartialReadout() == 256);
|
||||
CHECK_THROWS_AS(m.setPartialReadout(0), sls::RuntimeError);
|
||||
CHECK_THROWS_AS(m.setPartialReadout(0), RuntimeError);
|
||||
m.setPartialReadout(256);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace sls
|
||||
|
@ -6,10 +6,12 @@
|
||||
#include "tests/globals.h"
|
||||
#include <iostream>
|
||||
|
||||
namespace sls {
|
||||
|
||||
using namespace Catch::literals;
|
||||
|
||||
TEST_CASE("Initialize a multi detector", "[.integration][.multi]") {
|
||||
auto hostnames = sls::split(test::hostname, '+');
|
||||
auto hostnames = split(test::hostname, '+');
|
||||
|
||||
DetectorImpl d(0, true, true);
|
||||
d.setHostname(test::hostname.c_str());
|
||||
@ -102,3 +104,6 @@ TEST_CASE("Set and read timers", "[.integration][.multi]") {
|
||||
|
||||
d.freeSharedMemory();
|
||||
}
|
||||
|
||||
} // namespace sls
|
||||
|
||||
|
Reference in New Issue
Block a user