BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bsls::ProtocolTestImp< BSLS_PROTOCOL > Class Template Reference

#include <bsls_protocoltest.h>

Inheritance diagram for bsls::ProtocolTestImp< BSLS_PROTOCOL >:

Public Types

typedef BSLS_PROTOCOL ProtocolType
 

Public Member Functions

 ProtocolTestImp ()
 Create an object of the ProtocolTestImp class.
 
 ~ProtocolTestImp ()
 
BSLS_PROTOCOL * operator-> ()
 
const BSLS_PROTOCOL * operator-> () const
 
ProtocolTest_MethodReturnType markDone () const
 
ProtocolTest_MethodReturnRefType markDoneRef () const
 
template<class T >
markDoneVal (const T &value) const
 
void markEnter () const
 
void setTestStatus (ProtocolTest_Status *testStatus) const
 

Detailed Description

template<class BSLS_PROTOCOL>
class bsls::ProtocolTestImp< BSLS_PROTOCOL >

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.

See bsls_protocoltest

Member Typedef Documentation

◆ ProtocolType

template<class BSLS_PROTOCOL >
typedef BSLS_PROTOCOL bsls::ProtocolTestImp< BSLS_PROTOCOL >::ProtocolType

Constructor & Destructor Documentation

◆ ProtocolTestImp()

template<class BSLS_PROTOCOL >
bsls::ProtocolTestImp< BSLS_PROTOCOL >::ProtocolTestImp ( )
inline

◆ ~ProtocolTestImp()

template<class BSLS_PROTOCOL >
bsls::ProtocolTestImp< BSLS_PROTOCOL >::~ProtocolTestImp ( )
inline

Destroy this object and check the status of the test execution (success or failure). On test failure, report it to ProtocolTest_Status.

Member Function Documentation

◆ markDone()

template<class BSLS_PROTOCOL >
ProtocolTest_MethodReturnType bsls::ProtocolTestImp< BSLS_PROTOCOL >::markDone ( ) const
inline

Return a proxy object convertible to any value or pointer type. Derived classed should call this method from their implementations of protocol virtual methods to indicate that virtual methods were overridden correctly.

◆ markDoneRef()

template<class BSLS_PROTOCOL >
ProtocolTest_MethodReturnRefType bsls::ProtocolTestImp< BSLS_PROTOCOL >::markDoneRef ( ) const
inline

Return a proxy object convertible to any reference type. Derived classed should call this method from their implementations of protocol virtual methods to indicate that virtual methods were overridden correctly.

◆ markDoneVal()

template<class BSLS_PROTOCOL >
template<class T >
T bsls::ProtocolTestImp< BSLS_PROTOCOL >::markDoneVal ( const T &  value) const
inline

Return the specified value. Derived classes should call this method from their implementations of protocol virtual methods to indicate that virtual methods were overridden correctly.

◆ markEnter()

template<class BSLS_PROTOCOL >
void bsls::ProtocolTestImp< BSLS_PROTOCOL >::markEnter ( ) const
inline

Mark this object as entered for the purpose of calling a protocol method. The entered property is tested in the destructor to check for test failures (i.e., if entered == false then the test cannot fail since it never ran). Note that markEnter and markDone calls have to be paired for a protocol-method-call test to succeed.

◆ operator->() [1/2]

template<class BSLS_PROTOCOL >
ProtocolTestImp< BSLS_PROTOCOL >::ProtocolType * bsls::ProtocolTestImp< BSLS_PROTOCOL >::operator-> ( )
inline

Dereference this object as if it were a pointer to BSLS_PROTOCOL in order to call a method on BSLS_PROTOCOL. Also mark this object as entered for the purpose of calling a protocol method.

◆ operator->() [2/2]

template<class BSLS_PROTOCOL >
const ProtocolTestImp< BSLS_PROTOCOL >::ProtocolType * bsls::ProtocolTestImp< BSLS_PROTOCOL >::operator-> ( ) const
inline

Dereference this object as if it were a const BSLS_PROTOCOL *s in order to call a const method on BSLS_PROTOCOL. Also mark this object as entered for the purpose of calling a protocol method.

◆ setTestStatus()

template<class BSLS_PROTOCOL >
void bsls::ProtocolTestImp< BSLS_PROTOCOL >::setTestStatus ( ProtocolTest_Status testStatus) const
inline

Connect this protocol test object with the specified testStatus object, which will be used for test failure reporting.


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