mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 15:20:02 +02:00
moved test framework
This commit is contained in:
parent
ab2eb607c8
commit
129e12fd97
@ -1,2 +1,6 @@
|
|||||||
BasedOnStyle: LLVM
|
BasedOnStyle: LLVM
|
||||||
IndentWidth: 4
|
IndentWidth: 4
|
||||||
|
|
||||||
|
UseTab: Never
|
||||||
|
ColumnLimit: 0
|
||||||
|
AlignConsecutiveAssignments: false
|
@ -6,7 +6,7 @@ option (USE_HDF5 "HDF5 File format" OFF)
|
|||||||
option (USE_TEXTCLIENT "Text Client" OFF)
|
option (USE_TEXTCLIENT "Text Client" OFF)
|
||||||
option (USE_RECEIVER "Receiver" OFF)
|
option (USE_RECEIVER "Receiver" OFF)
|
||||||
option (USE_GUI "GUI" OFF)
|
option (USE_GUI "GUI" OFF)
|
||||||
|
option (USE_TESTS "TESTS" ON)
|
||||||
|
|
||||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0)
|
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -Wno-misleading-indentation")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -Wno-misleading-indentation")
|
||||||
@ -70,5 +70,9 @@ if (CALIBRATE)
|
|||||||
endif()
|
endif()
|
||||||
endif(CALIBRATE)
|
endif(CALIBRATE)
|
||||||
|
|
||||||
|
if (USE_TESTS)
|
||||||
|
add_subdirectory(tests)
|
||||||
|
endif(USE_TESTS)
|
||||||
|
|
||||||
install(FILES ${ZMQ_STATIC_ARCHIVE}
|
install(FILES ${ZMQ_STATIC_ARCHIVE}
|
||||||
DESTINATION lib)
|
DESTINATION lib)
|
||||||
|
@ -20,9 +20,9 @@
|
|||||||
//#include <time.h> //clock()
|
//#include <time.h> //clock()
|
||||||
|
|
||||||
#include "container_utils.h"
|
#include "container_utils.h"
|
||||||
|
#include <chrono>
|
||||||
#include <future>
|
#include <future>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <chrono>
|
|
||||||
|
|
||||||
multiSlsDetector::multiSlsDetector(int id, bool verify, bool update)
|
multiSlsDetector::multiSlsDetector(int id, bool verify, bool update)
|
||||||
: detId(id), sharedMemory(0), thisMultiDetector(0),
|
: detId(id), sharedMemory(0), thisMultiDetector(0),
|
||||||
@ -597,7 +597,8 @@ void multiSlsDetector::setDetectorOffset(dimension d, int off, int detPos) {
|
|||||||
void multiSlsDetector::updateOffsets() {
|
void multiSlsDetector::updateOffsets() {
|
||||||
// cannot paralllize due to slsdetector calling this via parentdet->
|
// cannot paralllize due to slsdetector calling this via parentdet->
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << std::endl << "Updating Multi-Detector Offsets" << std::endl;
|
std::cout << std::endl
|
||||||
|
<< "Updating Multi-Detector Offsets" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
int offsetX = 0, offsetY = 0, numX = 0, numY = 0;
|
int offsetX = 0, offsetY = 0, numX = 0, numY = 0;
|
||||||
int maxChanX = thisMultiDetector->maxNumberOfChannelsPerDetector[X];
|
int maxChanX = thisMultiDetector->maxNumberOfChannelsPerDetector[X];
|
||||||
@ -3727,7 +3728,7 @@ void multiSlsDetector::processData() {
|
|||||||
if (getJoinThreadFlag()) {
|
if (getJoinThreadFlag()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//otherwise error when connecting to the receiver too fast
|
// otherwise error when connecting to the receiver too fast
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,28 +1,30 @@
|
|||||||
MESSAGE( STATUS "CMAKE_CURRENT_SOURCE_DIR: " ${CMAKE_CURRENT_SOURCE_DIR} )
|
MESSAGE( STATUS "CMAKE_CURRENT_SOURCE_DIR: " ${CMAKE_CURRENT_SOURCE_DIR} )
|
||||||
MESSAGE( STATUS "PROJECT_SOURCE_DIR: " ${PROJECT_SOURCE_DIR} )
|
MESSAGE( STATUS "PROJECT_SOURCE_DIR: " ${PROJECT_SOURCE_DIR} )
|
||||||
|
|
||||||
# set(SOURCES
|
|
||||||
# slsDetectorClient.cpp
|
|
||||||
# )
|
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
include
|
|
||||||
tests
|
|
||||||
${PROJECT_SOURCE_DIR}/catch
|
${PROJECT_SOURCE_DIR}/catch
|
||||||
|
${PROJECT_SOURCE_DIR}/slsSupportLib/include
|
||||||
|
${PROJECT_SOURCE_DIR}/slsDetectorSoftware/multiSlsDetector
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(USE_TESTS)
|
if(USE_TESTS)
|
||||||
set(LOCAL_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tests)
|
set(LOCAL_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||||
set(TEST_SOURCES
|
set(TEST_SOURCES
|
||||||
# ${BASE_TEST_DIR}/test-MultiDetectorCaller.cpp
|
|
||||||
${LOCAL_TEST_DIR}/test-container_utils.cpp
|
${LOCAL_TEST_DIR}/test-container_utils.cpp
|
||||||
|
${LOCAL_TEST_DIR}/test-multiDetector.cpp
|
||||||
${LOCAL_TEST_DIR}/test.cpp
|
${LOCAL_TEST_DIR}/test.cpp
|
||||||
# PARENT_SCOPE
|
# PARENT_SCOPE
|
||||||
)
|
)
|
||||||
add_executable(t2 ${TEST_SOURCES})
|
add_executable(test ${TEST_SOURCES})
|
||||||
set_target_properties(t2 PROPERTIES
|
target_link_libraries(test
|
||||||
|
slsDetectorShared
|
||||||
|
pthread
|
||||||
|
)
|
||||||
|
set_target_properties(test PROPERTIES
|
||||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
11
tests/src/test-multiDetector.cpp
Normal file
11
tests/src/test-multiDetector.cpp
Normal 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);
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user