[#BloombergLP-bsls-ProtocolTestImp] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bsls.adoc[bsls]::ProtocolTestImp :relfileprefix: ../../ :mrdocs: 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. == Synopsis Declared in `<bsls_protocoltest.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class BSLS_PROTOCOL> class ProtocolTestImp : public BSLS_PROTOCOL ---- == Base Classes [cols="1,4"] |=== | Name| Description | `BSLS_PROTOCOL` | |=== == Type Aliases [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bsls/ProtocolTestImp/ProtocolType.adoc[`ProtocolType`] | Protocol type under test by this implementation. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bsls/ProtocolTestImp/2constructor.adoc[`ProtocolTestImp`] [.small]#[constructor]# | Create an object of the `ProtocolTestImp` class. | xref:BloombergLP/bsls/ProtocolTestImp/2destructor.adoc[`~ProtocolTestImp`] [.small]#[destructor]# | Destroy this object and check the status of the test execution (success or failure). On test failure, report it to `ProtocolTest_Status`. | xref:BloombergLP/bsls/ProtocolTestImp/markDone.adoc[`markDone`] | 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. | xref:BloombergLP/bsls/ProtocolTestImp/markDoneRef.adoc[`markDoneRef`] | 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. | xref:BloombergLP/bsls/ProtocolTestImp/markDoneVal.adoc[`markDoneVal`] | 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. | xref:BloombergLP/bsls/ProtocolTestImp/markEnter.adoc[`markEnter`] | 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. | xref:BloombergLP/bsls/ProtocolTestImp/operator_ptr-04.adoc[`operator‐>`] | 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. | xref:BloombergLP/bsls/ProtocolTestImp/operator_ptr-05.adoc[`operator‐>`] | 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. | xref:BloombergLP/bsls/ProtocolTestImp/setTestStatus.adoc[`setTestStatus`] | Connect this protocol test object with the specified `testStatus` object, which will be used for test failure reporting. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#