BloombergLP::bsls::ProtocolTestImp

Base class for a test implementation of the BSLS_PROTOCOL protocol.

Synopsis

Declared in <bsls_protocoltest.h>

template<class BSLS_PROTOCOL>
class ProtocolTestImp
    : public BSLS_PROTOCOL

Description

This mechanism class template is a base class for a test implementation of a protocol class defined by the BSLS_PROTOCOL template parameter. Its purpose is to reduce the boilerplate test code required to verify that derived virtual methods are called. It provides markDone member functions one of which should be called from each method of the protocol class test implementation to indicate that the virtual method is correctly overridden. It also overloads operator-> to serve as a proxy to BSLS_PROTOCOL and detect when BSLS_PROTOCOL methods are called.

Base Classes

NameDescription
BSLS_PROTOCOL

Type Aliases

NameDescription
ProtocolType Protocol type under test by this implementation.

Member Functions

NameDescription
ProtocolTestImp [constructor]Create an object of the ProtocolTestImp class.
~ProtocolTestImp [destructor]Destroy this object and check the status of the test execution (success or failure). On test failure, report it to ProtocolTest_Status.
markDone Return a proxy object convertible to any value or pointer type.
markDoneRef Return a proxy object convertible to any reference type.
markDoneVal Return the specified value after marking the protocol method done.
markEnter Mark this object as entered for the purpose of calling a protocol method.
operator-> Dereference this object as if it were a pointer to BSLS_PROTOCOL.
operator-> Dereference this object as if it were a const BSLS_PROTOCOL *.
setTestStatus Connect this protocol test object with the specified testStatus object, which will be used for test failure reporting.