Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
async_traction_test_helper.hxx
1#ifndef _UTILS_ASYNC_TRACTION_TEST_HELPER_HXX_
2#define _UTILS_ASYNC_TRACTION_TEST_HELPER_HXX_
3
4#include "utils/async_if_test_helper.hxx"
5
6#include "dcc/TrackIf.hxx"
9#include "utils/MockTrain.hxx"
10
11namespace openlcb
12{
13
16{
17protected:
19 : trainService_(ifCan_.get())
20 {
21 }
22
23 TrainService trainService_;
24 StrictMock<MockTrain> m1_, m2_;
25};
26
27} // namespace openlcb
28
29namespace dcc
30{
31
33{
34public:
35 MOCK_METHOD2(
36 packet, void(const vector<uint8_t> &payload, uintptr_t feedback_key));
37 void send(Buffer<dcc::Packet> *b, unsigned prio) OVERRIDE
38 {
39 vector<uint8_t> payload;
40 payload.assign(
41 b->data()->payload, b->data()->payload + b->data()->dlc - 1);
42 this->packet(payload, b->data()->feedback_key);
43 b->unref();
44 }
45};
46
47}
48
49#endif // _UTILS_ASYNC_TRACTION_TEST_HELPER_HXX_
Base class for all QMember types that hold data in an expandable format.
Definition Buffer.hxx:195
void send(Buffer< dcc::Packet > *b, unsigned prio) OVERRIDE
Entry point to the flow.
std::unique_ptr< IfCan > ifCan_
The interface under test.
Base class for test cases with one virtual node on a CANbus interface.
Test fixture base for traction tests.
Collection of control flows necessary for implementing the Traction Protocol.
#define OVERRIDE
Function attribute for virtual functions declaring that this funciton is overriding a funciton that s...
Definition macros.h:180