Files
Jungfraujoch/tests/PreviewCounterTest.cpp
leonarski_f d315506633 * Enhancements for XFEL
* Enhancements for EIGER
* Writer is more flexible and capable of handling DECTRIS data
2024-03-05 20:41:47 +01:00

21 lines
834 B
C++

// Copyright (2019-2023) Paul Scherrer Institute
#include <thread>
#include <catch2/catch.hpp>
#include "../receiver/PreviewCounter.h"
TEST_CASE("PreviewCount", "") {
PreviewCounter counter(std::chrono::seconds(1));
REQUIRE(counter.GeneratePreview()); // at first run it should generate preview
REQUIRE(!counter.GeneratePreview()); // immediately after not
std::this_thread::sleep_for(std::chrono::seconds(1));
REQUIRE(counter.GeneratePreview());
REQUIRE(!counter.GeneratePreview()); // immediately after not
REQUIRE(!counter.GeneratePreview()); // immediately after not
REQUIRE(!counter.GeneratePreview()); // immediately after not
std::this_thread::sleep_for(std::chrono::seconds(1));
REQUIRE(counter.GeneratePreview());
REQUIRE(!counter.GeneratePreview()); // immediately after not
}