| 11 | #include "controllers/phase_handler.h" |
| 12 | |
| 13 | TEST(PhaseHandlerTest, Phases) |
| 14 | { |
| 15 | MockPhaseHandler handler; |
| 16 | |
| 17 | handler.SetPhase(phase_t::selection); |
| 18 | EXPECT_TRUE(handler.IsSelection()); |
| 19 | EXPECT_FALSE(handler.IsBusFree()); |
| 20 | EXPECT_FALSE(handler.IsCommand()); |
| 21 | EXPECT_FALSE(handler.IsStatus()); |
| 22 | EXPECT_FALSE(handler.IsDataIn()); |
| 23 | EXPECT_FALSE(handler.IsDataOut()); |
| 24 | EXPECT_FALSE(handler.IsMsgIn()); |
| 25 | EXPECT_FALSE(handler.IsMsgOut()); |
| 26 | |
| 27 | handler.SetPhase(phase_t::busfree); |
| 28 | EXPECT_TRUE(handler.IsBusFree()); |
| 29 | EXPECT_FALSE(handler.IsSelection()); |
| 30 | EXPECT_FALSE(handler.IsCommand()); |
| 31 | EXPECT_FALSE(handler.IsStatus()); |
| 32 | EXPECT_FALSE(handler.IsDataIn()); |
| 33 | EXPECT_FALSE(handler.IsDataOut()); |
| 34 | EXPECT_FALSE(handler.IsMsgIn()); |
| 35 | EXPECT_FALSE(handler.IsMsgOut()); |
| 36 | |
| 37 | handler.SetPhase(phase_t::command); |
| 38 | EXPECT_TRUE(handler.IsCommand()); |
| 39 | EXPECT_FALSE(handler.IsBusFree()); |
| 40 | EXPECT_FALSE(handler.IsSelection()); |
| 41 | EXPECT_FALSE(handler.IsStatus()); |
| 42 | EXPECT_FALSE(handler.IsDataIn()); |
| 43 | EXPECT_FALSE(handler.IsDataOut()); |
| 44 | EXPECT_FALSE(handler.IsMsgIn()); |
| 45 | EXPECT_FALSE(handler.IsMsgOut()); |
| 46 | |
| 47 | handler.SetPhase(phase_t::status); |
| 48 | EXPECT_TRUE(handler.IsStatus()); |
| 49 | EXPECT_FALSE(handler.IsBusFree()); |
| 50 | EXPECT_FALSE(handler.IsSelection()); |
| 51 | EXPECT_FALSE(handler.IsCommand()); |
| 52 | EXPECT_FALSE(handler.IsDataIn()); |
| 53 | EXPECT_FALSE(handler.IsDataOut()); |
| 54 | EXPECT_FALSE(handler.IsMsgIn()); |
| 55 | EXPECT_FALSE(handler.IsMsgOut()); |
| 56 | |
| 57 | handler.SetPhase(phase_t::datain); |
| 58 | EXPECT_TRUE(handler.IsDataIn()); |
| 59 | EXPECT_FALSE(handler.IsBusFree()); |
| 60 | EXPECT_FALSE(handler.IsSelection()); |
| 61 | EXPECT_FALSE(handler.IsCommand()); |
| 62 | EXPECT_FALSE(handler.IsStatus()); |
| 63 | EXPECT_FALSE(handler.IsDataOut()); |
| 64 | EXPECT_FALSE(handler.IsMsgIn()); |
| 65 | EXPECT_FALSE(handler.IsMsgOut()); |
| 66 | |
| 67 | handler.SetPhase(phase_t::dataout); |
| 68 | EXPECT_TRUE(handler.IsDataOut()); |
| 69 | EXPECT_FALSE(handler.IsBusFree()); |
| 70 | EXPECT_FALSE(handler.IsSelection()); |
nothing calls this directly
no test coverage detected