adding config for tests

This commit is contained in:
Erik Frojdh
2019-04-23 17:37:02 +02:00
parent 72091f47d9
commit 02fd4b356e
9 changed files with 258 additions and 91 deletions

View File

@ -1,5 +1,6 @@
include_directories(
${PROJECT_SOURCE_DIR}/catch
include
)
set(SLS_TEST_SOURCES

View File

@ -0,0 +1,12 @@
#pragma once
#include <string>
#include "sls_detector_defs.h"
struct SingleDetectorConfig {
slsDetectorDefs::detectorType type_enum =
slsDetectorDefs::detectorType::CHIPTESTBOARD;
const std::string hostname = "bchip173";
const std::string type_string = "Chiptestboard";
const std::string my_ip = "129.129.205.171";
};

View File

@ -0,0 +1,6 @@
#include "sls_detector_defs.h"
using dt = slsDetectorDefs::detectorType;
using di = slsDetectorDefs::dacIndex;
extern std::string hostname;
extern std::string detector_type;
extern dt type;

View File

@ -1,3 +1,38 @@
// tests-main.cpp
#define CATCH_CONFIG_MAIN
#include "catch.hpp"
// #define CATCH_CONFIG_MAIN
// #include "catch.hpp"
#define CATCH_CONFIG_RUNNER
#include "catch.hpp"
#include "sls_detector_defs.h"
#include "tests/config.h"
#include <string>
// using namespace Catch::clara;
using Opt = Catch::clara::Opt;
using dt = slsDetectorDefs::detectorType;
std::string hostname;
std::string detector_type;
dt type;
int main(int argc, char *argv[]) {
Catch::Session session;
auto cli = session.cli() |
Opt(hostname, "hostname")["-hn"]["--hostname"](
"Detector hostname for integration tests") |
Opt(detector_type, "detector_type")["-dt"]["--detector_type"](
"Detector type for integration tests");
session.cli(cli);
auto ret = session.applyCommandLine(argc, argv);
if (ret) {
return ret;
}
type = slsDetectorDefs::detectorTypeToEnum(detector_type);
return session.run();
}