moved test framework

This commit is contained in:
Erik Frojdh 2018-10-22 11:21:18 +02:00
parent ab2eb607c8
commit 129e12fd97
7 changed files with 37 additions and 15 deletions

View File

@ -1,2 +1,6 @@
BasedOnStyle: LLVM
IndentWidth: 4
UseTab: Never
ColumnLimit: 0
AlignConsecutiveAssignments: false

View File

@ -6,7 +6,7 @@ option (USE_HDF5 "HDF5 File format" OFF)
option (USE_TEXTCLIENT "Text Client" OFF)
option (USE_RECEIVER "Receiver" OFF)
option (USE_GUI "GUI" OFF)
option (USE_TESTS "TESTS" ON)
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -Wno-misleading-indentation")
@ -70,5 +70,9 @@ if (CALIBRATE)
endif()
endif(CALIBRATE)
if (USE_TESTS)
add_subdirectory(tests)
endif(USE_TESTS)
install(FILES ${ZMQ_STATIC_ARCHIVE}
DESTINATION lib)

View File

@ -20,9 +20,9 @@
//#include <time.h> //clock()
#include "container_utils.h"
#include <chrono>
#include <future>
#include <vector>
#include <chrono>
multiSlsDetector::multiSlsDetector(int id, bool verify, bool update)
: detId(id), sharedMemory(0), thisMultiDetector(0),
@ -597,7 +597,8 @@ void multiSlsDetector::setDetectorOffset(dimension d, int off, int detPos) {
void multiSlsDetector::updateOffsets() {
// cannot paralllize due to slsdetector calling this via parentdet->
#ifdef VERBOSE
std::cout << std::endl << "Updating Multi-Detector Offsets" << std::endl;
std::cout << std::endl
<< "Updating Multi-Detector Offsets" << std::endl;
#endif
int offsetX = 0, offsetY = 0, numX = 0, numY = 0;
int maxChanX = thisMultiDetector->maxNumberOfChannelsPerDetector[X];

View File

@ -1,28 +1,30 @@
MESSAGE( STATUS "CMAKE_CURRENT_SOURCE_DIR: " ${CMAKE_CURRENT_SOURCE_DIR} )
MESSAGE( STATUS "PROJECT_SOURCE_DIR: " ${PROJECT_SOURCE_DIR} )
# set(SOURCES
# slsDetectorClient.cpp
# )
include_directories(
include
tests
${PROJECT_SOURCE_DIR}/catch
${PROJECT_SOURCE_DIR}/slsSupportLib/include
${PROJECT_SOURCE_DIR}/slsDetectorSoftware/multiSlsDetector
)
if(USE_TESTS)
set(LOCAL_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tests)
set(LOCAL_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
set(TEST_SOURCES
# ${BASE_TEST_DIR}/test-MultiDetectorCaller.cpp
${LOCAL_TEST_DIR}/test-container_utils.cpp
${LOCAL_TEST_DIR}/test-multiDetector.cpp
${LOCAL_TEST_DIR}/test.cpp
# PARENT_SCOPE
)
add_executable(t2 ${TEST_SOURCES})
set_target_properties(t2 PROPERTIES
add_executable(test ${TEST_SOURCES})
target_link_libraries(test
slsDetectorShared
pthread
)
set_target_properties(test PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
endif()

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);
}