ifw-daq  3.0.0-pre2
IFW Data Acquisition modules
testConversion.cpp
Go to the documentation of this file.
1 /**
2  * @file
3  * @ingroup daq_ocm_daqifsupport
4  * @copyright 2022 ESO - European Southern Observatory
5  *
6  * @brief daqif:: conversion helper test
7  */
8 #include <gtest/gtest.h>
9 
10 #include <daq/conversion.hpp>
11 #include <daq/state.hpp>
12 
13 using namespace ::testing;
14 
15 TEST(Conversion, MakeOcmIfSubState) {
16  using daqif::FullState;
17  using daqif::operator==;
19  FullState({daqif::StateAcquiring, daqif::NotStarted}));
21  FullState({daqif::StateAcquiring, daqif::Acquiring}));
23  FullState({daqif::StateAcquiring, daqif::Stopping}));
25  FullState({daqif::StateAcquiring, daqif::Stopped}));
27  FullState({daqif::StateAcquiring, daqif::Aborting}));
28 
30  FullState({daqif::StateMerging, daqif::NotScheduled}));
32  FullState({daqif::StateMerging, daqif::Scheduled}));
34  FullState({daqif::StateMerging, daqif::Transferring}));
36  FullState({daqif::StateMerging, daqif::Merging}));
38  FullState({daqif::StateMerging, daqif::Releasing}));
40  FullState({daqif::StateMerging, daqif::Aborting}));
41 
43  FullState({daqif::StateCompleted, daqif::Completed}));
45  FullState({daqif::StateCompleted, daqif::Aborted}));
46 }
47 
48 TEST(Conversion, MakeDaqState) {
49  EXPECT_EQ(daq::MakeState({daqif::StateAcquiring, daqif::NotStarted}), daq::State::NotStarted);
50  EXPECT_EQ(daq::MakeState({daqif::StateAcquiring, daqif::Acquiring}), daq::State::Acquiring);
51  EXPECT_EQ(daq::MakeState({daqif::StateAcquiring, daqif::Stopping}), daq::State::Stopping);
52  EXPECT_EQ(daq::MakeState({daqif::StateAcquiring, daqif::Stopped}), daq::State::Stopped);
53  EXPECT_EQ(daq::MakeState({daqif::StateAcquiring, daqif::Aborting}),
55 
56  EXPECT_EQ(daq::MakeState({daqif::StateMerging, daqif::NotScheduled}), daq::State::NotScheduled);
57  EXPECT_EQ(daq::MakeState({daqif::StateMerging, daqif::Scheduled}), daq::State::Scheduled);
58  EXPECT_EQ(daq::MakeState({daqif::StateMerging, daqif::Transferring}), daq::State::Transferring);
59  EXPECT_EQ(daq::MakeState({daqif::StateMerging, daqif::Merging}), daq::State::Merging);
60  EXPECT_EQ(daq::MakeState({daqif::StateMerging, daqif::Releasing}), daq::State::Releasing);
61  EXPECT_EQ(daq::MakeState({daqif::StateMerging, daqif::Aborting}), daq::State::AbortingMerging);
62 
63  EXPECT_EQ(daq::MakeState({daqif::StateCompleted, daqif::Completed}), daq::State::Completed);
64  EXPECT_EQ(daq::MakeState({daqif::StateCompleted, daqif::Aborted}), daq::State::Aborted);
65 
66  EXPECT_THROW(daq::MakeState({daqif::StateAcquiring, static_cast<daqif::DaqSubState>(-123)}),
67  std::invalid_argument);
68 }
Contains support functions for daqif.
Declares daq::State and related functions.
daqif::FullState MakeState(State state) noexcept
Converts daq::State to DaqSubstate.
Definition: conversion.cpp:63
@ Completed
Completed DAQ.
@ NotScheduled
Before daq is acknowledged by dpm it remains in NotScheduled.
@ Scheduled
daq is acknowledged by dpm and is scheduled for merging (i.e.
@ Releasing
Releasing Data Product to receivers.
@ Aborted
Data acquisition has been aborted by user.
@ Merging
DAQ is being merged.
@ Stopping
Transitional state between Acquiring and Stopped.
@ AbortingMerging
Transitional state for aborting during merging.
@ Transferring
Input files are being transferred.
@ Acquiring
All data sources have reported data acquisition is in progress.
@ Stopped
All data sources have reported they have stopped acquiring data.
@ AbortingAcquiring
Transitional state for aborting during acquisition.
@ NotStarted
Initial state of data acquisition.
Describes the full state and substate.
Definition: state.hpp:17
TEST(Conversion, MakeOcmIfSubState)
EXPECT_EQ(meta.rr_uri, "zpb.rr://meta")