Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
openlcb::AsyncIfTest Class Reference

Test fixture base class with helper methods for exercising the asynchronous interface code. More...

#include <async_if_test_helper.hxx>

Inheritance diagram for openlcb::AsyncIfTest:
AsyncCanTest openlcb::AsyncNodeTest openlcb::AsyncDatagramTest openlcb::TractionTest openlcb::TwoNodeDatagramTest openlcb::StreamTestBase

Protected Member Functions

void create_allocated_alias ()
 Creates an alias allocator flow, and injects an already allocated alias.
 
void inject_allocated_alias (NodeAlias alias)
 
void expect_next_alias_allocation (NodeAlias a=0)
 
BarrierNotifiableget_notifiable ()
 
void wait_for_notification ()
 
- Protected Member Functions inherited from AsyncCanTest
void wait ()
 Delays the current thread until we are certain that all asynchrnous processing has completed.
 
void twait ()
 Delays the current thread until all asynchronous processing and all pending timers have completed.
 
void expect_any_packet ()
 Ignores all produced packets.
 
void print_all_packets ()
 Prints all packets sent to the canbus until the end of the current test function.
 
void send_packet (const string &gc_packet)
 Injects a packet to the interface.
 
void clear_expect (bool strict=false)
 Clears all existing expectations on the CAN-bus packets.
 
void send_packet_and_flush_expect (const string &pkt)
 Sends a packet to the canbus, waits for the executor to clear, and then verifies all previous expectations.
 

Protected Attributes

SyncNotifiable n_
 
BarrierNotifiable bn_
 
std::unique_ptr< IfCanifCan_
 The interface under test.
 
AliasInfo testAlias_
 Temporary object used to send aliases around in the alias allocator flow.
 
NodeAlias aliasSeed_
 The next alias we will make the allocator create.
 
bool pendingAliasAllocation_
 true if we have a pending async alias allocation task.
 
- Protected Attributes inherited from AsyncCanTest
NiceMock< MockSendcanBus_
 Helper object for setting expectations on the packets sent on the bus.
 
std::unique_ptr< HubPortprinter_
 Object for debug-printing every packet (if requested).
 

Static Protected Attributes

static int local_alias_cache_size = 10
 
static int local_node_count = 9
 
static int remote_alias_cache_size = 10
 

Friends

class ::TrainTestHelper
 

Additional Inherited Members

- Static Public Member Functions inherited from AsyncCanTest
static void SetUpTestCase ()
 Initializes test case with CAN0.
 
static void TearDownTestCase ()
 De-Initializes test case with CAN0.
 

Detailed Description

Test fixture base class with helper methods for exercising the asynchronous interface code.

Usage:

Inherit your test fixture class from AsyncIfTest.

Definition at line 367 of file async_if_test_helper.hxx.

Constructor & Destructor Documentation

◆ AsyncIfTest()

openlcb::AsyncIfTest::AsyncIfTest ( )
inlineprotected

Definition at line 374 of file async_if_test_helper.hxx.

◆ ~AsyncIfTest()

openlcb::AsyncIfTest::~AsyncIfTest ( )
inlineprotected

Definition at line 384 of file async_if_test_helper.hxx.

Member Function Documentation

◆ create_allocated_alias()

void openlcb::AsyncIfTest::create_allocated_alias ( )
inlineprotected

Creates an alias allocator flow, and injects an already allocated alias.

Definition at line 400 of file async_if_test_helper.hxx.

◆ expect_next_alias_allocation()

void openlcb::AsyncIfTest::expect_next_alias_allocation ( NodeAlias  a = 0)
inlineprotected

Definition at line 418 of file async_if_test_helper.hxx.

◆ get_notifiable()

BarrierNotifiable * openlcb::AsyncIfTest::get_notifiable ( )
inlineprotected

Definition at line 446 of file async_if_test_helper.hxx.

◆ inject_allocated_alias()

void openlcb::AsyncIfTest::inject_allocated_alias ( NodeAlias  alias)
inlineprotected

Definition at line 407 of file async_if_test_helper.hxx.

◆ wait_for_notification()

void openlcb::AsyncIfTest::wait_for_notification ( )
inlineprotected

Definition at line 452 of file async_if_test_helper.hxx.

Friends And Related Symbol Documentation

◆ ::TrainTestHelper

friend class ::TrainTestHelper
friend

Definition at line 396 of file async_if_test_helper.hxx.

Member Data Documentation

◆ aliasSeed_

NodeAlias openlcb::AsyncIfTest::aliasSeed_
protected

The next alias we will make the allocator create.

Definition at line 466 of file async_if_test_helper.hxx.

◆ bn_

BarrierNotifiable openlcb::AsyncIfTest::bn_
protected

Definition at line 458 of file async_if_test_helper.hxx.

◆ ifCan_

std::unique_ptr<IfCan> openlcb::AsyncIfTest::ifCan_
protected

The interface under test.

Definition at line 461 of file async_if_test_helper.hxx.

◆ local_alias_cache_size

int openlcb::AsyncIfTest::local_alias_cache_size = 10
staticprotected

Definition at line 370 of file async_if_test_helper.hxx.

◆ local_node_count

int openlcb::AsyncIfTest::local_node_count = 9
staticprotected

Definition at line 371 of file async_if_test_helper.hxx.

◆ n_

SyncNotifiable openlcb::AsyncIfTest::n_
protected

Definition at line 457 of file async_if_test_helper.hxx.

◆ pendingAliasAllocation_

bool openlcb::AsyncIfTest::pendingAliasAllocation_
protected

true if we have a pending async alias allocation task.

Definition at line 468 of file async_if_test_helper.hxx.

◆ remote_alias_cache_size

int openlcb::AsyncIfTest::remote_alias_cache_size = 10
staticprotected

Definition at line 372 of file async_if_test_helper.hxx.

◆ testAlias_

AliasInfo openlcb::AsyncIfTest::testAlias_
protected

Temporary object used to send aliases around in the alias allocator flow.

Definition at line 464 of file async_if_test_helper.hxx.


The documentation for this class was generated from the following file: