mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 15:00:02 +02:00
starting tests
This commit is contained in:
parent
c19c787904
commit
284ce30a81
@ -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" 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")
|
||||
|
@ -5,34 +5,28 @@
|
||||
#include <string>
|
||||
|
||||
class Timer {
|
||||
using clock = std::chrono::high_resolution_clock;
|
||||
using clock = std::chrono::high_resolution_clock;
|
||||
using time_point = std::chrono::time_point<clock>;
|
||||
|
||||
public:
|
||||
public:
|
||||
Timer(std::string name = "0")
|
||||
: t0(clock::now())
|
||||
, name_(name)
|
||||
{
|
||||
: t0(clock::now()), name_(name) {
|
||||
}
|
||||
|
||||
double elapsed_ms()
|
||||
{
|
||||
double elapsed_ms() {
|
||||
return std::chrono::duration<double, std::milli>(clock::now() - t0).count();
|
||||
}
|
||||
double elapsed_s()
|
||||
{
|
||||
double elapsed_s() {
|
||||
return std::chrono::duration<double>(clock::now() - t0).count();
|
||||
}
|
||||
void print_elapsed()
|
||||
{
|
||||
void print_elapsed() {
|
||||
std::cout << "Timer \"" << name_ << "\": Elapsed time " << elapsed_ms() << " ms\n";
|
||||
}
|
||||
void restart()
|
||||
{
|
||||
void restart() {
|
||||
t0 = clock::now();
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
time_point t0;
|
||||
std::string name_;
|
||||
};
|
||||
|
@ -7,6 +7,7 @@ include_directories(
|
||||
${PROJECT_SOURCE_DIR}/catch
|
||||
${PROJECT_SOURCE_DIR}/slsSupportLib/include
|
||||
${PROJECT_SOURCE_DIR}/slsDetectorSoftware/multiSlsDetector
|
||||
${PROJECT_SOURCE_DIR}/slsDetectorSoftware/sharedMemory
|
||||
)
|
||||
|
||||
|
||||
@ -15,7 +16,8 @@ if(USE_TESTS)
|
||||
set(LOCAL_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||
set(TEST_SOURCES
|
||||
${LOCAL_TEST_DIR}/test-container_utils.cpp
|
||||
${LOCAL_TEST_DIR}/test-multiDetector.cpp
|
||||
${LOCAL_TEST_DIR}/test-MySocketTCP.cpp
|
||||
#${LOCAL_TEST_DIR}/test-multiDetector.cpp
|
||||
${LOCAL_TEST_DIR}/test.cpp
|
||||
# PARENT_SCOPE
|
||||
)
|
||||
@ -23,6 +25,7 @@ if(USE_TESTS)
|
||||
target_link_libraries(test
|
||||
slsDetectorShared
|
||||
pthread
|
||||
rt
|
||||
)
|
||||
set_target_properties(test PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
|
13
tests/src/test-MySocketTCP.cpp
Normal file
13
tests/src/test-MySocketTCP.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
#include "catch.hpp"
|
||||
#include "MySocketTCP.h"
|
||||
// #include "multiSlsDetector.h"
|
||||
#include <iostream>
|
||||
TEST_CASE("Construct") {
|
||||
|
||||
|
||||
// MySocketTCP(const char* const host_ip_or_name, unsigned short int const port_number): genericSocket(host_ip_or_name, port_number,TCP){setPacketSize(TCP_PACKET_SIZE);}; // sender (client): where to? ip
|
||||
unsigned short int const port_number = 1966;
|
||||
auto receiver = MySocketTCP(port_number);
|
||||
REQUIRE(false);
|
||||
|
||||
}
|
@ -7,7 +7,6 @@
|
||||
using sls::allEqual;
|
||||
using sls::allEqualTo;
|
||||
using sls::anyEqualTo;
|
||||
|
||||
using sls::allEqualToWithTol;
|
||||
using sls::allEqualWithTol;
|
||||
using sls::anyEqualToWithTol;
|
||||
|
@ -1,11 +1,11 @@
|
||||
#include "catch.hpp"
|
||||
#include "multiSlsDetector.h"
|
||||
// #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);
|
||||
// #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