Dev/fix port size (#805)

* port datatype changing from int to uint16_t
* throwing for -1 given for uint16_t ports
This commit is contained in:
2023-09-28 09:36:39 +02:00
committed by GitHub
parent 77d13f0794
commit 9834b07b47
61 changed files with 519 additions and 345 deletions

View File

@ -11,6 +11,26 @@ namespace sls {
using test::GET;
using test::PUT;
void test_valid_port(const std::string &command,
const std::vector<std::string> &arguments, int detector_id,
int action) {
Detector det;
CmdProxy proxy(&det);
std::vector<std::string> arg(arguments);
if (arg.empty())
arg.push_back("0");
int test_values[3] = {77797, -1, 0};
for (int i = 0; i != 3; ++i) {
int port_number = test_values[i];
arg[arg.size() - 1] = std::to_string(port_number);
REQUIRE_THROWS(proxy.Call(command, arg, detector_id, action));
/*REQUIRE_THROWS_WITH(proxy.Call(command, arguments, detector_id,
action), "Invalid port range. Must be between 1 - 65535.");*/
}
}
void test_dac(defs::dacIndex index, const std::string &dacname, int dacvalue) {
Detector det;
CmdProxy proxy(&det);