mimic++ v4
Loading...
Searching...
No Matches
mimicpp::Expectation< Signature > Class Template Referenceabstract

The base interface for expectations. More...

#include <Expectation.hpp>

Inheritance diagram for mimicpp::Expectation< Signature >:
[legend]

Public Types

using CallInfoT = call::info_for_signature_t<Signature>
 The expected call type.
 
using ReturnT = signature_return_type_t<Signature>
 The return type.
 

Public Member Functions

virtual ~Expectation ()=default
 Defaulted virtual destructor.
 
 Expectation ()=default
 Defaulted default constructor.
 
 Expectation (const Expectation &)=delete
 Deleted copy-constructor.
 
Expectationoperator= (const Expectation &)=delete
 Deleted copy-assignment-operator.
 
 Expectation (Expectation &&)=delete
 Deleted move-constructor.
 
Expectationoperator= (Expectation &&)=delete
 Deleted move-assignment-operator.
 
virtual ExpectationReport report () const =0
 Creates a report of the internal state.
 
virtual bool is_satisfied () const noexcept=0
 Queries all policies, whether they are satisfied.
 
virtual MatchReport matches (const CallInfoT &call) const =0
 Queries all policies, whether they accept the given call.
 
virtual void consume (const CallInfoT &call)=0
 Informs all policies, that the given call has been accepted.
 
virtual constexpr ReturnT finalize_call (const CallInfoT &call)=0
 Requests the given call to be finalized.
 
virtual constexpr const std::source_location & from () const noexcept=0
 Returns the source-location, where this expectation has been created.
 

Detailed Description

template<typename Signature>
requires std::same_as<Signature, signature_decay_t<Signature>>
class mimicpp::Expectation< Signature >

The base interface for expectations.

Template Parameters
SignatureThe decayed signature.

Member Typedef Documentation

◆ CallInfoT

template<typename Signature >
using mimicpp::Expectation< Signature >::CallInfoT = call::info_for_signature_t<Signature>

The expected call type.

◆ ReturnT

template<typename Signature >
using mimicpp::Expectation< Signature >::ReturnT = signature_return_type_t<Signature>

The return type.

Constructor & Destructor Documentation

◆ ~Expectation()

template<typename Signature >
virtual mimicpp::Expectation< Signature >::~Expectation ( )
virtualdefault

Defaulted virtual destructor.

◆ Expectation() [1/3]

template<typename Signature >
mimicpp::Expectation< Signature >::Expectation ( )
nodiscarddefault

Defaulted default constructor.

◆ Expectation() [2/3]

template<typename Signature >
mimicpp::Expectation< Signature >::Expectation ( const Expectation< Signature > & )
delete

Deleted copy-constructor.

◆ Expectation() [3/3]

template<typename Signature >
mimicpp::Expectation< Signature >::Expectation ( Expectation< Signature > && )
delete

Deleted move-constructor.

Member Function Documentation

◆ consume()

template<typename Signature >
virtual void mimicpp::Expectation< Signature >::consume ( const CallInfoT & call)
pure virtual

Informs all policies, that the given call has been accepted.

Parameters
callThe call to be consumed.

This function is called, when a match has been made.

Implemented in mimicpp::BasicExpectation< Signature, ControlPolicy, FinalizePolicy, Policies >.

◆ finalize_call()

template<typename Signature >
virtual constexpr ReturnT mimicpp::Expectation< Signature >::finalize_call ( const CallInfoT & call)
nodiscardconstexprpure virtual

Requests the given call to be finalized.

Parameters
callThe call to be finalized.
Returns
Returns the call result.

This function is called, when a match has been made and consume has been called.

Implemented in mimicpp::BasicExpectation< Signature, ControlPolicy, FinalizePolicy, Policies >.

◆ from()

template<typename Signature >
virtual constexpr const std::source_location & mimicpp::Expectation< Signature >::from ( ) const
nodiscardconstexprpure virtualnoexcept

Returns the source-location, where this expectation has been created.

Returns
Immutable reference to the source-location.

Implemented in mimicpp::BasicExpectation< Signature, ControlPolicy, FinalizePolicy, Policies >.

◆ is_satisfied()

template<typename Signature >
virtual bool mimicpp::Expectation< Signature >::is_satisfied ( ) const
nodiscardpure virtualnoexcept

Queries all policies, whether they are satisfied.

Returns
Returns true, if all policies are satisfied.

Implemented in mimicpp::BasicExpectation< Signature, ControlPolicy, FinalizePolicy, Policies >.

◆ matches()

template<typename Signature >
virtual MatchReport mimicpp::Expectation< Signature >::matches ( const CallInfoT & call) const
nodiscardpure virtual

Queries all policies, whether they accept the given call.

Parameters
callThe call to be matched.
Returns
Returns true, if all policies accept the call.

Implemented in mimicpp::BasicExpectation< Signature, ControlPolicy, FinalizePolicy, Policies >.

◆ operator=() [1/2]

template<typename Signature >
Expectation & mimicpp::Expectation< Signature >::operator= ( const Expectation< Signature > & )
delete

Deleted copy-assignment-operator.

◆ operator=() [2/2]

template<typename Signature >
Expectation & mimicpp::Expectation< Signature >::operator= ( Expectation< Signature > && )
delete

Deleted move-assignment-operator.

◆ report()

template<typename Signature >
virtual ExpectationReport mimicpp::Expectation< Signature >::report ( ) const
nodiscardpure virtual

Creates a report of the internal state.

Returns
A newly generated report.

Implemented in mimicpp::BasicExpectation< Signature, ControlPolicy, FinalizePolicy, Policies >.

Here is the caller graph for this function:

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