irccd  3.0.3
Public Types | Public Member Functions | List of all members
irccd::test::mock Class Reference

Keep track of function invocations. More...

#include <mock.hpp>

Inheritance diagram for irccd::test::mock:
irccd::test::mock_plugin irccd::test::mock_server irccd::test::mock_stream

Public Types

using args = std::vector< std::any >
 Functions arguments. More...
 
using functions = std::unordered_map< std::string, std::vector< args > >
 Map of all functions. More...
 

Public Member Functions

void push (std::string name, args args={}) const
 
auto find (const std::string &name) const -> std::vector< args >
 
void clear (const std::string &name) const noexcept
 
void clear () const noexcept
 
auto empty () const noexcept -> bool
 

Detailed Description

Keep track of function invocations.

Member Typedef Documentation

◆ args

using irccd::test::mock::args = std::vector<std::any>

Functions arguments.

◆ functions

using irccd::test::mock::functions = std::unordered_map<std::string, std::vector<args> >

Map of all functions.

Member Function Documentation

◆ clear() [1/2]

void irccd::test::mock::clear ( ) const
noexcept

Clear all function invocations.

◆ clear() [2/2]

void irccd::test::mock::clear ( const std::string &  name) const
noexcept

Clear all function invocations by name.

Parameters
namethe function name

◆ empty()

auto irccd::test::mock::empty ( ) const -> bool
noexcept

Tells if no functions have been called.

Returns
true if no functions have been called

◆ find()

auto irccd::test::mock::find ( const std::string &  name) const -> std::vector< args >

Get all function invocations by name.

Parameters
namethe function name
Returns
the list of functions and their arguments or empty if not called

◆ push()

void irccd::test::mock::push ( std::string  name,
args  args = {} 
) const

Register a new function invocation.

Parameters
namethe function name
argsthe arguments list

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