removed pointers added constructor

This commit is contained in:
Erik Frojdh
2019-04-17 16:19:18 +02:00
parent b46e107f35
commit ee20cfab1e
4 changed files with 83 additions and 68 deletions

View File

@ -1,6 +1,6 @@
#include "catch.hpp"
#include "sls_detector_defs.h"
#include "slsDetector.h"
#include "sls_detector_defs.h"
using dt = slsDetectorDefs::detectorType;
@ -18,10 +18,10 @@ TEST_CASE("sls_detector_module default construction", "[support][new]") {
CHECK(m.chanregs == nullptr);
}
TEST_CASE("sls_detector_module from type", "[support][new]") {
TEST_CASE("sls_detector_module from type", "[support]") {
sls_detector_module m(dt::EIGER);
CHECK(m.serialnumber == 0);
CHECK(m.nchan == 256*256*4);
CHECK(m.nchan == 256 * 256 * 4);
CHECK(m.nchip == 4);
CHECK(m.ndac == 16);
CHECK(m.reg == 0);
@ -30,4 +30,24 @@ TEST_CASE("sls_detector_module from type", "[support][new]") {
CHECK(m.eV == 0);
CHECK(m.dacs != nullptr);
CHECK(m.chanregs != nullptr);
}
TEST_CASE("assign module", "[support]") {
sls_detector_module m0;
sls_detector_module m1(dt::EIGER);
m1.serialnumber = 14;
m1.reg = 500;
m1.iodelay = 750;
m0 = m1; // Assignment operator
CHECK(m0.serialnumber == 14);
CHECK(m0.reg == 500);
CHECK(m0.iodelay == 750);
CHECK(m0.nchan == 256 * 256 * 4);
auto m3 = m1; // Copy constructor
CHECK(m3.serialnumber == 14);
CHECK(m3.reg == 500);
CHECK(m3.iodelay == 750);
CHECK(m3.nchan == 256 * 256 * 4);
}