mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-05-02 17:44:12 +02:00
Dev/ctb clocks fix (#1434)
* introduced new type Hz, typetraits, String conversions, command generation (not yet generated) * incorrect unit typo * cmd generation and compiles * default to MHz, removed space between units for consistency with timers, min and max checks for clks * in python, but need to change the default to Hz again for clean code and intuition * allow ints, doubles, implicit conversions * dont allow raw ints, doubles and implicit conversions * fixed tests * added operators for Hz in python * fix test for min clk for xilinx ctb * fix test * fix python tests * fixed xilinx period and default clks * test fix * removed the 3 clock cycle check for ctb and implemented properly the max adc clk frq for altera ctb * removing 3 clock cycle code from xilinx as well * formatting * loadpattern before 3 clk cycles code * actualtime and measurement time to be implemented in 100ns already in fw * fix tests * pyzmq dependency forthe tests * fixed pyctbgui for freq
This commit is contained in:
@@ -76,6 +76,15 @@ TEST_CASE("conversion from duration to string", "[support]") {
|
||||
REQUIRE(ToString(us(-100)) == "-100us");
|
||||
}
|
||||
|
||||
TEST_CASE("conversion from frequency to string", "[support]") {
|
||||
REQUIRE(ToString(defs::Hz(150)) == "150Hz");
|
||||
REQUIRE(ToString(defs::Hz(1500)) == "1.5kHz");
|
||||
REQUIRE(ToString(defs::Hz(1500000)) == "1.5MHz");
|
||||
REQUIRE(ToString(defs::Hz(150), "Hz") == "150Hz");
|
||||
REQUIRE(ToString(defs::Hz(150), "kHz") == "0.15kHz");
|
||||
REQUIRE(ToString(defs::Hz(150), "MHz") == "0.00015MHz");
|
||||
}
|
||||
|
||||
TEST_CASE("Convert vector of time", "[support]") {
|
||||
std::vector<ns> vec{ns(150), us(10), ns(600)};
|
||||
REQUIRE(ToString(vec) == "[150ns, 10us, 600ns]");
|
||||
@@ -155,6 +164,15 @@ TEST_CASE("string to std::chrono::duration", "[support]") {
|
||||
REQUIRE_THROWS(StringTo<ns>("asvn"));
|
||||
}
|
||||
|
||||
TEST_CASE("string to frequency", "[support]") {
|
||||
REQUIRE(StringTo<defs::Hz>("150") == defs::Hz(150));
|
||||
REQUIRE(StringTo<defs::Hz>("150Hz") == defs::Hz(150));
|
||||
REQUIRE(StringTo<defs::Hz>("1.5kHz") == defs::Hz(1500));
|
||||
REQUIRE(StringTo<defs::Hz>("1.5MHz") == defs::Hz(1500000));
|
||||
REQUIRE_THROWS(StringTo<defs::Hz>("5xs"));
|
||||
REQUIRE_THROWS(StringTo<defs::Hz>("asvn"));
|
||||
}
|
||||
|
||||
TEST_CASE("string to detectorType") {
|
||||
using dt = slsDetectorDefs::detectorType;
|
||||
REQUIRE(StringTo<dt>("Eiger") == dt::EIGER);
|
||||
|
||||
Reference in New Issue
Block a user