8 #include <gtest/gtest.h>
13 using namespace ::testing;
15 TEST(Conversion, MakeOcmIfSubState) {
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}));
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}));
43 FullState({daqif::StateCompleted, daqif::Completed}));
45 FullState({daqif::StateCompleted, daqif::Aborted}));
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}),
54 daq::State::AbortingAcquiring);
56 EXPECT_EQ(
daq::MakeState({daqif::StateMerging, daqif::NotScheduled}), daq::State::NotScheduled);
57 EXPECT_EQ(
daq::MakeState({daqif::StateMerging, daqif::Scheduled}), daq::State::Scheduled);
60 EXPECT_EQ(
daq::MakeState({daqif::StateMerging, daqif::Releasing}), daq::State::Releasing);
61 EXPECT_EQ(
daq::MakeState({daqif::StateMerging, daqif::Aborting}), daq::State::AbortingMerging);
64 EXPECT_EQ(
daq::MakeState({daqif::StateCompleted, daqif::Aborted}), daq::State::Aborted);
66 EXPECT_THROW(
daq::MakeState({daqif::StateAcquiring,
static_cast<daqif::DaqSubState
>(-123)}),
67 std::invalid_argument);