mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-28 01:24:07 +08:00
Test: TestSubscriber renamed to TestListener
This commit is contained in:
parent
aeee4b9e37
commit
fc490e93e1
@ -61,7 +61,7 @@ TEST(Dispatcher, Reception)
|
||||
makeDataType(uavcan::DataTypeKindService, 1)
|
||||
};
|
||||
|
||||
typedef TestSubscriber<512, 2, 2> Subscriber;
|
||||
typedef TestListener<512, 2, 2> Subscriber;
|
||||
typedef std::auto_ptr<Subscriber> SubscriberPtr;
|
||||
static const int NUM_SUBSCRIBERS = 6;
|
||||
SubscriberPtr subscribers[NUM_SUBSCRIBERS] =
|
||||
|
||||
@ -38,7 +38,7 @@ TEST(TransferListener, BasicMFT)
|
||||
uavcan::PoolManager<1> poolmgr;
|
||||
poolmgr.addPool(&pool);
|
||||
|
||||
TestSubscriber<256, 1, 1> subscriber(type, poolmgr);
|
||||
TestListener<256, 1, 1> subscriber(type, poolmgr);
|
||||
|
||||
/*
|
||||
* Test data
|
||||
@ -89,7 +89,7 @@ TEST(TransferListener, CrcFailure)
|
||||
const uavcan::DataTypeDescriptor type(uavcan::DataTypeKindMessage, 123, uavcan::DataTypeSignature(123456789), "A");
|
||||
|
||||
uavcan::PoolManager<1> poolmgr; // No dynamic memory
|
||||
TestSubscriber<256, 2, 2> subscriber(type, poolmgr); // Static buffer only, 2 entries
|
||||
TestListener<256, 2, 2> subscriber(type, poolmgr); // Static buffer only, 2 entries
|
||||
|
||||
/*
|
||||
* Generating transfers with damaged payload (CRC is not valid)
|
||||
@ -132,7 +132,7 @@ TEST(TransferListener, BasicSFT)
|
||||
const uavcan::DataTypeDescriptor type(uavcan::DataTypeKindMessage, 123, uavcan::DataTypeSignature(123456789), "A");
|
||||
|
||||
uavcan::PoolManager<1> poolmgr; // No dynamic memory. At all.
|
||||
TestSubscriber<0, 0, 5> subscriber(type, poolmgr); // Max buf size is 0, i.e. SFT-only
|
||||
TestListener<0, 0, 5> subscriber(type, poolmgr); // Max buf size is 0, i.e. SFT-only
|
||||
|
||||
TransferListenerEmulator emulator(subscriber, type);
|
||||
const Transfer transfers[] =
|
||||
@ -167,7 +167,7 @@ TEST(TransferListener, Cleanup)
|
||||
const uavcan::DataTypeDescriptor type(uavcan::DataTypeKindMessage, 123, uavcan::DataTypeSignature(123456789), "A");
|
||||
|
||||
uavcan::PoolManager<1> poolmgr; // No dynamic memory
|
||||
TestSubscriber<256, 1, 2> subscriber(type, poolmgr); // Static buffer only, 1 entry
|
||||
TestListener<256, 1, 2> subscriber(type, poolmgr); // Static buffer only, 1 entry
|
||||
|
||||
/*
|
||||
* Generating transfers
|
||||
@ -221,7 +221,7 @@ TEST(TransferListener, MaximumTransferLength)
|
||||
const uavcan::DataTypeDescriptor type(uavcan::DataTypeKindMessage, 123, uavcan::DataTypeSignature(123456789), "A");
|
||||
|
||||
uavcan::PoolManager<1> poolmgr;
|
||||
TestSubscriber<uavcan::MaxTransferPayloadLen * 2, 2, 2> subscriber(type, poolmgr);
|
||||
TestListener<uavcan::MaxTransferPayloadLen * 2, 2, 2> subscriber(type, poolmgr);
|
||||
|
||||
static const std::string DATA_OK(uavcan::MaxTransferPayloadLen, 'z');
|
||||
|
||||
|
||||
@ -113,9 +113,9 @@ TEST(TransferSender, Basic)
|
||||
}
|
||||
}
|
||||
|
||||
TestSubscriber<512, 2, 2> sub_msg(TYPES[0], poolmgr);
|
||||
TestSubscriber<512, 2, 2> sub_srv_req(TYPES[1], poolmgr);
|
||||
TestSubscriber<512, 2, 2> sub_srv_resp(TYPES[1], poolmgr);
|
||||
TestListener<512, 2, 2> sub_msg(TYPES[0], poolmgr);
|
||||
TestListener<512, 2, 2> sub_srv_req(TYPES[1], poolmgr);
|
||||
TestListener<512, 2, 2> sub_srv_resp(TYPES[1], poolmgr);
|
||||
|
||||
dispatcher_rx.registerMessageListener(&sub_msg);
|
||||
dispatcher_rx.registerServiceRequestListener(&sub_srv_req);
|
||||
|
||||
@ -110,14 +110,14 @@ struct Transfer
|
||||
* which are dispatched/filtered by uavcan::Dispatcher.
|
||||
*/
|
||||
template <unsigned int MAX_BUF_SIZE, unsigned int NUM_STATIC_BUFS, unsigned int NUM_STATIC_RECEIVERS>
|
||||
class TestSubscriber : public uavcan::TransferListener<MAX_BUF_SIZE, NUM_STATIC_BUFS, NUM_STATIC_RECEIVERS>
|
||||
class TestListener : public uavcan::TransferListener<MAX_BUF_SIZE, NUM_STATIC_BUFS, NUM_STATIC_RECEIVERS>
|
||||
{
|
||||
typedef uavcan::TransferListener<MAX_BUF_SIZE, NUM_STATIC_BUFS, NUM_STATIC_RECEIVERS> Base;
|
||||
|
||||
std::queue<Transfer> transfers_;
|
||||
|
||||
public:
|
||||
TestSubscriber(const uavcan::DataTypeDescriptor& data_type, uavcan::IAllocator& allocator)
|
||||
TestListener(const uavcan::DataTypeDescriptor& data_type, uavcan::IAllocator& allocator)
|
||||
: Base(data_type, allocator)
|
||||
{ }
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user