mimic++ v4
Loading...
Searching...
No Matches
mimicpp::BasicExpectation< Signature, ControlPolicy, FinalizePolicy, Policies > Class Template Referencefinal

The actual expectation template. More...

#include <Expectation.hpp>

Inheritance diagram for mimicpp::BasicExpectation< Signature, ControlPolicy, FinalizePolicy, Policies >:
[legend]
Collaboration diagram for mimicpp::BasicExpectation< Signature, ControlPolicy, FinalizePolicy, Policies >:
[legend]

Public Types

using ControlPolicyT = ControlPolicy
 
using FinalizerT = FinalizePolicy
 
using PolicyListT = std::tuple<Policies...>
 
using CallInfoT = call::info_for_signature_t<Signature>
 
using ReturnT = typename Expectation<Signature>::ReturnT
 

Public Member Functions

template<typename ControlPolicyArg , typename FinalizerArg , typename... PolicyArgs>
requires std::constructible_from<ControlPolicyT, ControlPolicyArg> && std::constructible_from<FinalizerT, FinalizerArg> && std::constructible_from<PolicyListT, PolicyArgs...>
constexpr BasicExpectation (const std::source_location &sourceLocation, ControlPolicyArg &&controlArg, FinalizerArg &&finalizerArg, PolicyArgs &&... args) noexcept(std::is_nothrow_constructible_v< ControlPolicyT, ControlPolicyArg > &&std::is_nothrow_constructible_v< FinalizerT, FinalizerArg > &&(std::is_nothrow_constructible_v< Policies, PolicyArgs > &&...))
 Constructs the expectation with the given arguments.
 
ExpectationReport report () const override
 Creates a report of the internal state.
 
constexpr bool is_satisfied () const noexcept override
 Queries all policies, whether they are satisfied.
 
MatchReport matches (const CallInfoT &call) const override
 Queries all policies, whether they accept the given call.
 
constexpr void consume (const CallInfoT &call) override
 Informs all policies, that the given call has been accepted.
 
constexpr ReturnT finalize_call (const CallInfoT &call) override
 Requests the given call to be finalized.
 
constexpr const std::source_location & from () const noexcept override
 Returns the source-location, where this expectation has been created.
 

Detailed Description

template<typename Signature, control_policy ControlPolicy, finalize_policy_for< Signature > FinalizePolicy, expectation_policy_for< Signature >... Policies>
class mimicpp::BasicExpectation< Signature, ControlPolicy, FinalizePolicy, Policies >

The actual expectation template.

Template Parameters
SignatureThe decayed signature.
ControlPolicyThe applied control-policy.
FinalizePolicyThe applied finalize-policy.
PoliciesAll applied expectation-policies.

Member Typedef Documentation

◆ CallInfoT

template<typename Signature , control_policy ControlPolicy, finalize_policy_for< Signature > FinalizePolicy, expectation_policy_for< Signature >... Policies>
using mimicpp::BasicExpectation< Signature, ControlPolicy, FinalizePolicy, Policies >::CallInfoT = call::info_for_signature_t<Signature>

◆ ControlPolicyT

template<typename Signature , control_policy ControlPolicy, finalize_policy_for< Signature > FinalizePolicy, expectation_policy_for< Signature >... Policies>
using mimicpp::BasicExpectation< Signature, ControlPolicy, FinalizePolicy, Policies >::ControlPolicyT = ControlPolicy

◆ FinalizerT

template<typename Signature , control_policy ControlPolicy, finalize_policy_for< Signature > FinalizePolicy, expectation_policy_for< Signature >... Policies>
using mimicpp::BasicExpectation< Signature, ControlPolicy, FinalizePolicy, Policies >::FinalizerT = FinalizePolicy

◆ PolicyListT

template<typename Signature , control_policy ControlPolicy, finalize_policy_for< Signature > FinalizePolicy, expectation_policy_for< Signature >... Policies>
using mimicpp::BasicExpectation< Signature, ControlPolicy, FinalizePolicy, Policies >::PolicyListT = std::tuple<Policies...>

◆ ReturnT

template<typename Signature , control_policy ControlPolicy, finalize_policy_for< Signature > FinalizePolicy, expectation_policy_for< Signature >... Policies>
using mimicpp::BasicExpectation< Signature, ControlPolicy, FinalizePolicy, Policies >::ReturnT = typename Expectation<Signature>::ReturnT

Constructor & Destructor Documentation

◆ BasicExpectation()

template<typename Signature , control_policy ControlPolicy, finalize_policy_for< Signature > FinalizePolicy, expectation_policy_for< Signature >... Policies>
template<typename ControlPolicyArg , typename FinalizerArg , typename... PolicyArgs>
requires std::constructible_from<ControlPolicyT, ControlPolicyArg> && std::constructible_from<FinalizerT, FinalizerArg> && std::constructible_from<PolicyListT, PolicyArgs...>
mimicpp::BasicExpectation< Signature, ControlPolicy, FinalizePolicy, Policies >::BasicExpectation ( const std::source_location & sourceLocation,
ControlPolicyArg && controlArg,
FinalizerArg && finalizerArg,
PolicyArgs &&... args )
inlineexplicitconstexprnoexcept

Constructs the expectation with the given arguments.

Template Parameters
ControlPolicyArgThe control-policy constructor argument types.
FinalizerArgThe finalize-policy constructor argument types.
PolicyArgsThe expectation-policies constructor argument types.
Parameters
sourceLocationThe source-location, where the construction has been requested from.
controlArgThe control-policy constructor argument.
finalizerArgThe finalize-policy constructor argument.
argsThe expectation-policies constructor arguments.

Member Function Documentation

◆ consume()

template<typename Signature , control_policy ControlPolicy, finalize_policy_for< Signature > FinalizePolicy, expectation_policy_for< Signature >... Policies>
void mimicpp::BasicExpectation< Signature, ControlPolicy, FinalizePolicy, Policies >::consume ( const CallInfoT & call)
inlineconstexproverridevirtual

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.

Implements mimicpp::Expectation< Signature >.

◆ finalize_call()

template<typename Signature , control_policy ControlPolicy, finalize_policy_for< Signature > FinalizePolicy, expectation_policy_for< Signature >... Policies>
ReturnT mimicpp::BasicExpectation< Signature, ControlPolicy, FinalizePolicy, Policies >::finalize_call ( const CallInfoT & call)
inlinenodiscardconstexproverridevirtual

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.

Implements mimicpp::Expectation< Signature >.

◆ from()

template<typename Signature , control_policy ControlPolicy, finalize_policy_for< Signature > FinalizePolicy, expectation_policy_for< Signature >... Policies>
const std::source_location & mimicpp::BasicExpectation< Signature, ControlPolicy, FinalizePolicy, Policies >::from ( ) const
inlinenodiscardconstexproverridevirtualnoexcept

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

Returns
Immutable reference to the source-location.

Implements mimicpp::Expectation< Signature >.

◆ is_satisfied()

template<typename Signature , control_policy ControlPolicy, finalize_policy_for< Signature > FinalizePolicy, expectation_policy_for< Signature >... Policies>
bool mimicpp::BasicExpectation< Signature, ControlPolicy, FinalizePolicy, Policies >::is_satisfied ( ) const
inlinenodiscardconstexproverridevirtualnoexcept

Queries all policies, whether they are satisfied.

Returns
Returns true, if all policies are satisfied.

Implements mimicpp::Expectation< Signature >.

◆ matches()

template<typename Signature , control_policy ControlPolicy, finalize_policy_for< Signature > FinalizePolicy, expectation_policy_for< Signature >... Policies>
MatchReport mimicpp::BasicExpectation< Signature, ControlPolicy, FinalizePolicy, Policies >::matches ( const CallInfoT & call) const
inlinenodiscardoverridevirtual

Queries all policies, whether they accept the given call.

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

Implements mimicpp::Expectation< Signature >.

◆ report()

template<typename Signature , control_policy ControlPolicy, finalize_policy_for< Signature > FinalizePolicy, expectation_policy_for< Signature >... Policies>
ExpectationReport mimicpp::BasicExpectation< Signature, ControlPolicy, FinalizePolicy, Policies >::report ( ) const
inlinenodiscardoverridevirtual

Creates a report of the internal state.

Returns
A newly generated report.

Implements mimicpp::Expectation< Signature >.


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