ifw-daq  3.0.0-pre2
IFW Data Acquisition modules
testState.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:: state helper test
7  */
8 #include <gtest/gtest.h>
9 
10 #include <daqif/state.hpp>
11 
12 using namespace ::testing;
13 
15  EXPECT_TRUE(daqif::IsStateValid(daqif::StateAcquiring, daqif::NotStarted));
16  EXPECT_TRUE(daqif::IsStateValid(daqif::StateAcquiring, daqif::Starting));
17  EXPECT_TRUE(daqif::IsStateValid(daqif::StateAcquiring, daqif::Acquiring));
18  EXPECT_TRUE(daqif::IsStateValid(daqif::StateAcquiring, daqif::Stopping));
19  EXPECT_TRUE(daqif::IsStateValid(daqif::StateAcquiring, daqif::Stopped));
20  EXPECT_TRUE(daqif::IsStateValid(daqif::StateAcquiring, daqif::Aborting));
21  EXPECT_FALSE(daqif::IsStateValid(daqif::StateAcquiring, daqif::NotScheduled));
22  EXPECT_FALSE(daqif::IsStateValid(daqif::StateAcquiring, daqif::Scheduled));
23  EXPECT_FALSE(daqif::IsStateValid(daqif::StateAcquiring, daqif::Transferring));
24  EXPECT_FALSE(daqif::IsStateValid(daqif::StateAcquiring, daqif::Merging));
25  EXPECT_FALSE(daqif::IsStateValid(daqif::StateAcquiring, daqif::Releasing));
26 
27  EXPECT_FALSE(daqif::IsStateValid(daqif::StateMerging, daqif::NotStarted));
28  EXPECT_FALSE(daqif::IsStateValid(daqif::StateMerging, daqif::Starting));
29  EXPECT_FALSE(daqif::IsStateValid(daqif::StateMerging, daqif::Acquiring));
30  EXPECT_FALSE(daqif::IsStateValid(daqif::StateMerging, daqif::Stopping));
31  EXPECT_FALSE(daqif::IsStateValid(daqif::StateMerging, daqif::Stopped));
32  EXPECT_TRUE(daqif::IsStateValid(daqif::StateMerging, daqif::NotScheduled));
33  EXPECT_TRUE(daqif::IsStateValid(daqif::StateMerging, daqif::Scheduled));
34  EXPECT_TRUE(daqif::IsStateValid(daqif::StateMerging, daqif::Transferring));
35  EXPECT_TRUE(daqif::IsStateValid(daqif::StateMerging, daqif::Merging));
36  EXPECT_TRUE(daqif::IsStateValid(daqif::StateMerging, daqif::Releasing));
37  EXPECT_TRUE(daqif::IsStateValid(daqif::StateMerging, daqif::Aborting));
38 
39  EXPECT_TRUE(daqif::IsStateValid(daqif::StateCompleted, daqif::Completed));
40  EXPECT_TRUE(daqif::IsStateValid(daqif::StateCompleted, daqif::Aborted));
41  EXPECT_FALSE(daqif::IsStateValid(daqif::StateCompleted, daqif::NotStarted));
42  EXPECT_FALSE(daqif::IsStateValid(daqif::StateCompleted, daqif::Starting));
43  EXPECT_FALSE(daqif::IsStateValid(daqif::StateCompleted, daqif::Acquiring));
44  EXPECT_FALSE(daqif::IsStateValid(daqif::StateCompleted, daqif::Stopping));
45  EXPECT_FALSE(daqif::IsStateValid(daqif::StateCompleted, daqif::Stopped));
46  EXPECT_FALSE(daqif::IsStateValid(daqif::StateCompleted, daqif::NotScheduled));
47  EXPECT_FALSE(daqif::IsStateValid(daqif::StateCompleted, daqif::Scheduled));
48  EXPECT_FALSE(daqif::IsStateValid(daqif::StateCompleted, daqif::Transferring));
49  EXPECT_FALSE(daqif::IsStateValid(daqif::StateCompleted, daqif::Merging));
50  EXPECT_FALSE(daqif::IsStateValid(daqif::StateCompleted, daqif::Releasing));
51  EXPECT_FALSE(daqif::IsStateValid(daqif::StateCompleted, daqif::Aborting));
52 }
53 
Contains State support functions for daqif.
TEST(State, IsStateValid)
Definition: testState.cpp:14
State
Observable states of the data acquisition process.
Definition: state.hpp:39
bool IsStateValid(DaqState state, DaqSubState substate)
Validate state combination.
Definition: state.cpp:16