Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
MockTrain.hxx
1#ifndef _UTILS_MOCKTRAIN_HXX_
2#define _UTILS_MOCKTRAIN_HXX_
3
4#include "gmock/gmock.h"
7#include "dcc/Defs.hxx"
8
9namespace openlcb {
10
14class MockTrain : public TrainImpl
15{
16public:
17 MOCK_METHOD1(set_speed, void(SpeedType speed));
18 MOCK_METHOD0(get_speed, SpeedType());
19 MOCK_METHOD0(get_commanded_speed, SpeedType());
20 MOCK_METHOD0(get_actual_speed, SpeedType());
21 MOCK_METHOD0(set_emergencystop, void());
22 MOCK_METHOD0(get_emergencystop, bool());
23 MOCK_METHOD2(set_fn, void(uint32_t address, uint16_t value));
24 MOCK_METHOD1(get_fn, uint16_t(uint32_t address));
25 MOCK_METHOD0(legacy_address, uint32_t());
27};
28
29} // namespace openlcb
30
31#endif // _UTILS_MOCKTRAIN_HXX_
Test helper class for TrainImpl using GoogleMock.
Definition MockTrain.hxx:15
Abstract base class for train implementations.
virtual void set_speed(SpeedType speed)=0
Sets the speed of the locomotive.
virtual void set_emergencystop()=0
Sets the train to emergency stop.
virtual SpeedType get_commanded_speed()
virtual void set_fn(uint32_t address, uint16_t value)=0
Sets the value of a function.
virtual bool get_emergencystop()=0
Get the current E-Stop state.
virtual uint16_t get_fn(uint32_t address)=0
virtual uint32_t legacy_address()=0
virtual SpeedType get_speed()=0
virtual SpeedType get_actual_speed()
Returns the actual speed of the locomotive, as provided by feedback from the decoder.
virtual dcc::TrainAddressType legacy_address_type()=0
This class provides a mechanism for working with velocity in different forms.
Definition Velocity.hxx:73
TrainAddressType
Which address type this legacy train node uses.
Definition dcc/Defs.hxx:46
Velocity SpeedType
Represents an OpenLCB speed value with accessors to convert to and from various formats.