mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 18:17:59 +02:00
adding config for tests
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
include_directories(
|
||||
${PROJECT_SOURCE_DIR}/catch
|
||||
include
|
||||
)
|
||||
|
||||
set(SLS_TEST_SOURCES
|
||||
|
12
tests/include/tests/config.h
Normal file
12
tests/include/tests/config.h
Normal 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";
|
||||
};
|
6
tests/include/tests/globals.h
Normal file
6
tests/include/tests/globals.h
Normal 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;
|
@ -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();
|
||||
}
|
Reference in New Issue
Block a user