changed constructor

This commit is contained in:
Erik Frojdh
2019-01-24 11:12:24 +01:00
parent c3472f295b
commit a1c0d28ddb
16 changed files with 113 additions and 334 deletions

View File

@ -0,0 +1,53 @@
MESSAGE( STATUS "CMAKE_CURRENT_SOURCE_DIR: " ${CMAKE_CURRENT_SOURCE_DIR} )
MESSAGE( STATUS "PROJECT_SOURCE_DIR: " ${PROJECT_SOURCE_DIR} )
include_directories(
${PROJECT_SOURCE_DIR}/catch
)
if(USE_TESTS)
set(TEST_SOURCES
src/test-slsDetector.cpp
# src/test.cpp
)
add_executable(a ${TEST_SOURCES})
target_link_libraries(a
slsDetectorShared
slsSupportLib
pthread
rt
)
set_target_properties(a PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
endif()
#option(USE_TESTS "Determines whether to build tests." OFF)
# if(USE_TESTS)
# # Prepare "Catch" library for other executables
# set(CATCH_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/catch)
# add_library(Catch INTERFACE)
# target_include_directories(Catch INTERFACE ${CATCH_INCLUDE_DIR})
# # Make test executable
# add_executable(tests ${BASE_TEST_SOURCES})
# target_link_libraries(tests Catch)
# set_target_properties(tests PROPERTIES
# RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
# )
# #enable_testing()
# #add_test(NAME CommandLineClient COMMAND tests)
# endif()
# install(TARGETS sls_client DESTINATION bin)

View File

@ -0,0 +1,11 @@
// #include "catch.hpp"
// #include "multiSlsDetector.h"
// #include <iostream>
// TEST_CASE("Initialize a detector") {
// multiSlsDetector det(0, true, true);
// std::cout << "Size: " << det.getNumberOfDetectors() << std::endl;
// std::cout << "Hostname: " << det.getHostname() << std::endl;
// REQUIRE(false);
// }

View File

@ -0,0 +1,30 @@
#include "catch.hpp"
#include "logger.h"
#include <iostream>
#include <vector>
#include "slsDetector.h"
#include "sls_detector_defs.h"
#define VERBOSE
int main(){
const std::string hostname = "beb083";
// const std::string hostname = "129.129.202.194";
auto type = slsDetector::getDetectorTypeAsEnum(hostname);
auto d = slsDetector(type);
d.setHostname(hostname.c_str());
// auto d = slsDetector();
std::cout << "type: " << d.getDetectorTypeAsString() << '\n';
std::cout << "hostname: " << d.getHostname() << '\n';
std::cout << "threshold: " << d.getThresholdEnergy() << '\n';
std::cout << "exptime: " << d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME) << '\n';
// auto d2 = slsDetector(type, 0, 1);
// d2.setHostname("beb098");.
// auto d2 = slsDetector();
// std::cout << "hn: " << d2.getHostname() << '\n';
return 0;
}

View File

@ -0,0 +1,3 @@
// tests-main.cpp
#define CATCH_CONFIG_MAIN
#include "catch.hpp"