mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
New command line app and removing slsDetectorCommand (#69)
* WIP * WIP * WIP * WIP * config2 working * removed slsDetectorCommand * WIP * added test file * more tests
This commit is contained in:

committed by
Dhanya Thattil

parent
6a27207875
commit
fa2c842745
@ -1,8 +1,9 @@
|
||||
target_sources(tests PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-SharedMemory.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-slsDetector.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-multiSlsDetector.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-multiSlsDetectorClient.cpp
|
||||
# ${CMAKE_CURRENT_SOURCE_DIR}/test-multiSlsDetectorClient.cpp
|
||||
# TODO! Migrate tests!
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-Result.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdLineParser.cpp
|
||||
)
|
||||
|
@ -158,6 +158,25 @@ SCENARIO("Parsing strings with -h or --help", "[support]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("Parsing consecutive strings resets not found det id"){
|
||||
CmdLineParser p;
|
||||
p.Parse("1:exptime 0.5");
|
||||
REQUIRE(p.detector_id() == 1);
|
||||
p.Parse("exptime 0.5");
|
||||
REQUIRE(p.detector_id() == -1);
|
||||
p.Parse("3:exptime 0.5");
|
||||
REQUIRE(p.detector_id() == 3);
|
||||
|
||||
}
|
||||
|
||||
TEST_CASE("Parsing consecutive strings resets not found multi id"){
|
||||
CmdLineParser p;
|
||||
p.Parse("1-1:exptime 0.5");
|
||||
REQUIRE(p.multi_id() == 1);
|
||||
p.Parse("1:exptime 0.5");
|
||||
REQUIRE(p.multi_id() == 0);
|
||||
}
|
||||
|
||||
TEST_CASE("Parse with no arguments results in no command and default id",
|
||||
"[support]") {
|
||||
// build up argc and argv
|
||||
|
4807
slsDetectorSoftware/tests/test-CmdProxy.cpp
Normal file
4807
slsDetectorSoftware/tests/test-CmdProxy.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,83 +0,0 @@
|
||||
|
||||
#include "catch.hpp"
|
||||
#include "container_utils.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "slsDetector.h"
|
||||
#include "string_utils.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace sls;
|
||||
|
||||
// SCENARIO("Multi detector operation", "[detector]") {
|
||||
|
||||
// multiSlsDetector::freeSharedMemory(20, -1);
|
||||
|
||||
// GIVEN("An empty multi detector") {
|
||||
// multiSlsDetector m(20);
|
||||
// THEN("the size is zero") {
|
||||
// CHECK(m.getNumberOfDetectors() == 0);
|
||||
// CHECK(m.getDataBytes() == 0);
|
||||
// CHECK(m.getTotalNumberOfChannels() == 0);
|
||||
// }
|
||||
|
||||
// WHEN("we add a detector") {
|
||||
// m.addSlsDetector(sls::make_unique<slsDetector>(
|
||||
// slsDetectorDefs::detectorType::EIGER, 20, 0));
|
||||
// THEN("the size and number of detector changes") {
|
||||
// CHECK(m.getNumberOfDetectors() == 1);
|
||||
// CHECK(m.getTotalNumberOfChannels() == 256 * 1024);
|
||||
// }
|
||||
|
||||
// WHEN("we add another detector") {
|
||||
// m.addSlsDetector(sls::make_unique<slsDetector>(
|
||||
// slsDetectorDefs::detectorType::EIGER, 20, 1));
|
||||
// THEN("the size and number of detector changes") {
|
||||
// CHECK(m.getNumberOfDetectors() == 2);
|
||||
// CHECK(m.getTotalNumberOfChannels() == 2 * 256 * 1024);
|
||||
// }
|
||||
|
||||
// WHEN("We set the trimen") {
|
||||
// std::vector<int> energies{5000, 6000, 7000, 8000, 9000};
|
||||
// m.setTrimEn(energies);
|
||||
// THEN("we read back the same values") {
|
||||
// CHECK(m.getTrimEn() == energies);
|
||||
// }
|
||||
// }
|
||||
// WHEN("We set the trimen to different values") {
|
||||
// std::vector<int> en0{5000, 6000, 7000, 8000, 9000};
|
||||
// std::vector<int> en1{6000, 7000, 8000, 9000};
|
||||
// m.setTrimEn(en0, 0);
|
||||
// m.setTrimEn(en1, 1);
|
||||
// THEN("we read back the same values") {
|
||||
// CHECK(m.getTrimEn(0) == en0);
|
||||
// CHECK(m.getTrimEn(1) == en1);
|
||||
// CHECK(m.getTrimEn() == std::vector<int>{-1});
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// m.freeSharedMemory();
|
||||
// }
|
||||
// }
|
||||
|
||||
// TEST_CASE("Set and get partialFramesPadding", "[detector][somenewtag]"){
|
||||
|
||||
// multiSlsDetector::freeSharedMemory(20, -1);
|
||||
// multiSlsDetector m(20);
|
||||
// m.addSlsDetector(sls::make_unique<slsDetector>(
|
||||
// slsDetectorDefs::detectorType::EIGER, 20, 0));
|
||||
// m.addSlsDetector(sls::make_unique<slsDetector>(
|
||||
// slsDetectorDefs::detectorType::EIGER, 20, 1));
|
||||
|
||||
// m.setPartialFramesPadding(false);
|
||||
// CHECK(m.getPartialFramesPadding() == 0);
|
||||
|
||||
// m.setPartialFramesPadding(true);
|
||||
// CHECK(m.getPartialFramesPadding() == 1);
|
||||
|
||||
// m.setPartialFramesPadding(false, 0);
|
||||
// CHECK(m.getPartialFramesPadding() == -1);
|
||||
|
||||
// m.freeSharedMemory();
|
||||
// }
|
Reference in New Issue
Block a user