mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-09-02 01:50:43 +02:00
fixed tests
This commit is contained in:
@@ -1273,6 +1273,7 @@ int setVLimit(int val, char *mess) {
|
||||
LOG(logERROR, (mess));
|
||||
return FAIL;
|
||||
}
|
||||
LOG(logINFO, ("Setting vlimit to %d mV\n", val));
|
||||
vLimit = val;
|
||||
return OK;
|
||||
}
|
||||
@@ -1721,19 +1722,8 @@ int getVchipToSet(int *retval_vchip, char *mess) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
int validatePowerADCIndex(enum powerIndex ind, char *mess) {
|
||||
if (ind < 0 || ind > I_POWER_IO || ind == V_POWER_CHIP) {
|
||||
sprintf(mess, "Could not get Power ADC. Invalid index %d\n", ind);
|
||||
LOG(logERROR, (mess));
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int getPowerADC(enum powerIndex index, int *retval, char *mess) {
|
||||
*retval = -1;
|
||||
if (validatePowerADCIndex(index, mess) == FAIL)
|
||||
return FAIL;
|
||||
|
||||
enum ADCINDEX adcIndex = V_PWR_IO;
|
||||
switch (index) {
|
||||
|
||||
@@ -11336,7 +11336,7 @@ int get_voltage_limit(int file_des) {
|
||||
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
ret = getVLimit(&retval, mess);
|
||||
retval = getVLimit();
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
@@ -869,6 +869,7 @@ int setVLimit(int val, char *mess) {
|
||||
LOG(logERROR, (mess));
|
||||
return FAIL;
|
||||
}
|
||||
LOG(logINFO, ("Setting vlimit to %d mV\n", val));
|
||||
vLimit = val;
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -2136,7 +2136,7 @@ im_a:
|
||||
help: "\n\t[Ctb] Measured current of power supply a in mA."
|
||||
actions:
|
||||
GET:
|
||||
function: getMeasuredPower
|
||||
function: getMeasuredCurrent
|
||||
input: [ 'defs::I_POWER_A' ]
|
||||
output: [ OutString(t), '" mA"' ]
|
||||
|
||||
@@ -2145,7 +2145,7 @@ im_b:
|
||||
help: "\n\t[Ctb] Measured current of power supply b in mA."
|
||||
actions:
|
||||
GET:
|
||||
function: getMeasuredPower
|
||||
function: getMeasuredCurrent
|
||||
input: [ 'defs::I_POWER_B' ]
|
||||
output: [ OutString(t), '" mA"' ]
|
||||
|
||||
@@ -2154,7 +2154,7 @@ im_c:
|
||||
help: "\n\t[Ctb] Measured current of power supply c in mA."
|
||||
actions:
|
||||
GET:
|
||||
function: getMeasuredPower
|
||||
function: getMeasuredCurrent
|
||||
input: [ 'defs::I_POWER_C' ]
|
||||
output: [ OutString(t), '" mA"' ]
|
||||
|
||||
@@ -2163,7 +2163,7 @@ im_d:
|
||||
help: "\n\t[Ctb] Measured current of power supply d in mA."
|
||||
actions:
|
||||
GET:
|
||||
function: getMeasuredPower
|
||||
function: getMeasuredCurrent
|
||||
input: [ 'defs::I_POWER_D' ]
|
||||
output: [ OutString(t), '" mA"' ]
|
||||
|
||||
@@ -2172,7 +2172,7 @@ im_io:
|
||||
help: "\n\t[Ctb] Measured current of power supply io in mA."
|
||||
actions:
|
||||
GET:
|
||||
function: getMeasuredPower
|
||||
function: getMeasuredCurrent
|
||||
input: [ 'defs::I_POWER_IO' ]
|
||||
output: [ OutString(t), '" mA"' ]
|
||||
|
||||
@@ -2322,7 +2322,7 @@ powerindex:
|
||||
actions:
|
||||
GET:
|
||||
function: getPowerIndex
|
||||
output: [ 'ToString(t)' ]
|
||||
output: [ 'ToString(static_cast<int>(t))' ]
|
||||
|
||||
slowadcindex:
|
||||
inherit_actions: CTB_GET_DACINDEX
|
||||
|
||||
@@ -4827,7 +4827,7 @@ im_a:
|
||||
- false
|
||||
check_det_id: true
|
||||
convert_det_id: true
|
||||
function: getMeasuredPower
|
||||
function: getMeasuredCurrent
|
||||
input:
|
||||
- defs::I_POWER_A
|
||||
input_types:
|
||||
@@ -4852,7 +4852,7 @@ im_b:
|
||||
- false
|
||||
check_det_id: true
|
||||
convert_det_id: true
|
||||
function: getMeasuredPower
|
||||
function: getMeasuredCurrent
|
||||
input:
|
||||
- defs::I_POWER_B
|
||||
input_types:
|
||||
@@ -4877,7 +4877,7 @@ im_c:
|
||||
- false
|
||||
check_det_id: true
|
||||
convert_det_id: true
|
||||
function: getMeasuredPower
|
||||
function: getMeasuredCurrent
|
||||
input:
|
||||
- defs::I_POWER_C
|
||||
input_types:
|
||||
@@ -4902,7 +4902,7 @@ im_d:
|
||||
- false
|
||||
check_det_id: true
|
||||
convert_det_id: true
|
||||
function: getMeasuredPower
|
||||
function: getMeasuredCurrent
|
||||
input:
|
||||
- defs::I_POWER_D
|
||||
input_types:
|
||||
@@ -4927,7 +4927,7 @@ im_io:
|
||||
- false
|
||||
check_det_id: true
|
||||
convert_det_id: true
|
||||
function: getMeasuredPower
|
||||
function: getMeasuredCurrent
|
||||
input:
|
||||
- defs::I_POWER_IO
|
||||
input_types:
|
||||
@@ -7362,7 +7362,7 @@ powerindex:
|
||||
input_types:
|
||||
- std::string
|
||||
output:
|
||||
- ToString(t)
|
||||
- ToString(static_cast<int>(t))
|
||||
require_det_id: false
|
||||
store_result_in_t: true
|
||||
command_name: powerindex
|
||||
|
||||
@@ -5770,7 +5770,7 @@ std::string Caller::im_a(int action) {
|
||||
if (det_id != -1) {
|
||||
throw RuntimeError("Cannot execute im_a at module level");
|
||||
}
|
||||
auto t = det->getMeasuredPower(defs::I_POWER_A);
|
||||
auto t = det->getMeasuredCurrent(defs::I_POWER_A);
|
||||
os << OutString(t) << " mA" << '\n';
|
||||
}
|
||||
}
|
||||
@@ -5812,7 +5812,7 @@ std::string Caller::im_b(int action) {
|
||||
if (det_id != -1) {
|
||||
throw RuntimeError("Cannot execute im_b at module level");
|
||||
}
|
||||
auto t = det->getMeasuredPower(defs::I_POWER_B);
|
||||
auto t = det->getMeasuredCurrent(defs::I_POWER_B);
|
||||
os << OutString(t) << " mA" << '\n';
|
||||
}
|
||||
}
|
||||
@@ -5854,7 +5854,7 @@ std::string Caller::im_c(int action) {
|
||||
if (det_id != -1) {
|
||||
throw RuntimeError("Cannot execute im_c at module level");
|
||||
}
|
||||
auto t = det->getMeasuredPower(defs::I_POWER_C);
|
||||
auto t = det->getMeasuredCurrent(defs::I_POWER_C);
|
||||
os << OutString(t) << " mA" << '\n';
|
||||
}
|
||||
}
|
||||
@@ -5896,7 +5896,7 @@ std::string Caller::im_d(int action) {
|
||||
if (det_id != -1) {
|
||||
throw RuntimeError("Cannot execute im_d at module level");
|
||||
}
|
||||
auto t = det->getMeasuredPower(defs::I_POWER_D);
|
||||
auto t = det->getMeasuredCurrent(defs::I_POWER_D);
|
||||
os << OutString(t) << " mA" << '\n';
|
||||
}
|
||||
}
|
||||
@@ -5938,7 +5938,7 @@ std::string Caller::im_io(int action) {
|
||||
if (det_id != -1) {
|
||||
throw RuntimeError("Cannot execute im_io at module level");
|
||||
}
|
||||
auto t = det->getMeasuredPower(defs::I_POWER_IO);
|
||||
auto t = det->getMeasuredCurrent(defs::I_POWER_IO);
|
||||
os << OutString(t) << " mA" << '\n';
|
||||
}
|
||||
}
|
||||
@@ -8933,7 +8933,7 @@ std::string Caller::powerindex(int action) {
|
||||
throw RuntimeError("Cannot execute powerindex at module level");
|
||||
}
|
||||
auto t = det->getPowerIndex(args[0]);
|
||||
os << ToString(t) << '\n';
|
||||
os << ToString(static_cast<int>(t)) << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1921,6 +1921,9 @@ std::string Caller::powerdac(int action) {
|
||||
auto index = parsePowerIndex(0);
|
||||
|
||||
if (action == defs::GET_ACTION) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
auto t = det->getPowerDAC(index);
|
||||
os << args[0] << ' ' << OutString(t) << '\n';
|
||||
}
|
||||
|
||||
@@ -362,8 +362,7 @@ TEST_CASE("powerindex", "[.detectorintegration]") {
|
||||
std::ostringstream oss;
|
||||
REQUIRE_NOTHROW(
|
||||
caller.call("powerindex", {powername}, -1, GET, oss));
|
||||
REQUIRE(oss.str() ==
|
||||
std::string("powerindex ") + str_power_index + '\n');
|
||||
REQUIRE(oss.str() == "powerindex 2\n");
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(caller.call("powerindex", {"2"}, -1, GET));
|
||||
@@ -677,9 +676,11 @@ TEST_CASE("powerdac", "[.detectorintegration][dacs]") {
|
||||
std::ostringstream oss1, oss2;
|
||||
caller.call("powerdac", {names[iPower], "1200"}, -1, PUT,
|
||||
oss1);
|
||||
REQUIRE(oss1.str() == "dac " + names[iPower] + " 1200\n");
|
||||
REQUIRE(oss1.str() ==
|
||||
"powerdac " + names[iPower] + " 1200\n");
|
||||
caller.call("powerdac", {names[iPower]}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "dac " + names[iPower] + " 1200\n");
|
||||
REQUIRE(oss2.str() ==
|
||||
"powerdac " + names[iPower] + " 1200\n");
|
||||
}
|
||||
{
|
||||
// power name
|
||||
@@ -690,11 +691,11 @@ TEST_CASE("powerdac", "[.detectorintegration][dacs]") {
|
||||
{"pwrname_" + names[iPower], "1200"}, -1, PUT,
|
||||
oss1);
|
||||
REQUIRE(oss1.str() ==
|
||||
"dac pwrname_" + names[iPower] + " 1200\n");
|
||||
"powerdac pwrname_" + names[iPower] + " 1200\n");
|
||||
caller.call("powerdac", {"pwrname_" + names[iPower]}, -1,
|
||||
GET, oss2);
|
||||
REQUIRE(oss2.str() ==
|
||||
"dac pwrname_" + names[iPower] + " 1200 mV\n");
|
||||
"powerdac pwrname_" + names[iPower] + " 1200\n");
|
||||
}
|
||||
// trying to set dac when power is on
|
||||
{
|
||||
@@ -702,9 +703,11 @@ TEST_CASE("powerdac", "[.detectorintegration][dacs]") {
|
||||
std::ostringstream oss1, oss2;
|
||||
caller.call("powerdac", {names[iPower], "1200"}, -1, PUT,
|
||||
oss1);
|
||||
REQUIRE(oss1.str() == "dac " + names[iPower] + " 1200\n");
|
||||
REQUIRE(oss1.str() ==
|
||||
"powerdac " + names[iPower] + " 1200\n");
|
||||
caller.call("powerdac", {names[iPower]}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "dac " + names[iPower] + " 1200\n");
|
||||
REQUIRE(oss2.str() ==
|
||||
"powerdac " + names[iPower] + " 1200\n");
|
||||
}
|
||||
|
||||
// Reset all dacs to previous value
|
||||
|
||||
Reference in New Issue
Block a user