Qt-Mocks 0.8.0-alpha.9
Mocking library using Qt Test inspired by Google Test
 
Loading...
Searching...
No Matches
qt_mocks Namespace Reference

Namespaces

namespace  common_matchers
 
namespace  internal
 

Classes

class  ErrorRaiser
 Encapsulates an error to be raised by a mocked function. More...
 
struct  Expectations
 A manager for collecting all function expectations for a given mocked object. Each expectation will be expected to be invoked in the order in which the expectations are built. More...
 
class  ValueGenerator
 Encapsulates a value to be generated by a mocked function. More...
 
class  ValueGiver
 Encapsulates a value to be returned by a mocked function. More...
 

Functions

template<typename ClassType, typename MemberReturnType, typename MatcherType>
common_matchers::MemberFunctionMatcher< ClassType, MemberReturnType, MatcherType > accessor (MemberReturnType(ClassType::*memberFunction)() const, MatcherType matcher)
 Creates a matcher that will expect that an object's no-argument member function meets the conditions of a matcher. This function is most often the accessor to an object's private or protected member variable.
 
template<typename ... MatcherTypes>
auto allOf (MatcherTypes &&... matchers)
 A matcher that ensures that all of the supplied matcher objects pass.
 
template<typename ... MatcherTypes>
auto anyOf (MatcherTypes &&... matchers)
 A matcher that ensures that any of the supplied matcher objects pass.
 
template<typename ValueType>
common_matchers::BetweenExclusiveMatcher< ValueType > between (const ValueType &beginValue, const ValueType &endValue)
 Creates a matcher that will expect that a value is between two values, exclusive, to the test value.
 
template<typename ValueType>
common_matchers::BetweenBeginInclusiveMatcher< ValueType > betweenBeginInclusive (const ValueType &beginValue, const ValueType &endValue)
 Creates a matcher that will expect that a value is between two values, beginning inclusive and ending exclusive, to the test value.
 
template<typename ValueType>
common_matchers::BetweenEndInclusiveMatcher< ValueType > betweenEndInclusive (const ValueType &beginValue, const ValueType &endValue)
 Creates a matcher that will expect that a value is between two values, beginning exclusive and ending inclusive, to the test value.
 
template<typename ValueType>
common_matchers::BetweenInclusiveMatcher< ValueType > betweenInclusive (const ValueType &beginValue, const ValueType &endValue)
 Creates a matcher that will expect that a value is between two values, beginning and ending inclusive, to the test value.
 
template<typename ValueType>
common_matchers::ContainsStringMatcher< ValueType > containsString (const ValueType &expected)
 Creates a matcher that checks if a value contains the specified substring.
 
QT_MOCKS_EXPORT::QString copyright () noexcept
 Provides the copyright of the library.
 
QT_MOCKS_EXPORT::QString description () noexcept
 Provides the description of the library.
 
QT_MOCKS_EXPORT common_matchers::EqualMatcher<::QString > equals (const char *const expected)
 Creates a matcher that will expect that a value is equal to the matcher's expected value.
 
template<typename ValueType>
common_matchers::EqualMatcher< ValueType > equals (const ValueType &expected)
 Creates a matcher that will expect that a value is equal to the matcher's expected value.
 
template<typename ClassType, typename MemberVariableType, typename MatcherType>
common_matchers::MemberVariableMatcher< ClassType, MemberVariableType, MatcherType > field (MemberVariableType ClassType::*const memberVariable, const MatcherType &matcher)
 Creates a matcher that will expect that an object's member variable meets the conditions of a matcher.
 
template<typename FunctionType>
auto generate (FunctionType &&generator)
 
template<typename ReturnType>
ValueGiver< ReturnType > give (ReturnType value) noexcept
 
template<typename ValueType>
common_matchers::GreaterThanMatcher< ValueType > greaterThan (const ValueType &expected)
 Creates a matcher that will expect that a value is greater-than the matcher's expected value.
 
template<typename ValueType>
common_matchers::GreaterThanEqualMatcher< ValueType > greaterThanEqual (const ValueType &expected)
 Creates a matcher that will expect that a value is greater-than or equal to the matcher's expected value.
 
QT_MOCKS_EXPORT common_matchers::BooleanMatcher isFalse ()
 Creates a matcher that a value will be false against it.
 
QT_MOCKS_EXPORT common_matchers::BooleanMatcher isTrue ()
 Creates a matcher that a value will be true against it.
 
template<typename ValueType>
common_matchers::LessThanMatcher< ValueType > lessThan (const ValueType &expected)
 Creates a matcher that will expect that a value is less-than the matcher's expected value.
 
template<typename ValueType>
common_matchers::LessThanEqualMatcher< ValueType > lessThanEqual (const ValueType &expected)
 Creates a matcher that will expect that a value is less-than or equal to the matcher's expected value.
 
QT_MOCKS_EXPORT::QString licence () noexcept
 Provides the licence of the library.
 
QT_MOCKS_EXPORT::QString metadataVersion () noexcept
 Provides the semantic version with the metadata of the library.
 
template<typename MatcherType>
common_matchers::NegationMatcher< typename MatcherType::MatcherValueType > not_ (MatcherType &&matcher)
 Creates a matcher that will negate the result of another matcher.
 
template<typename ValueType>
common_matchers::NotEqualMatcher< ValueType > notEquals (const ValueType &expected)
 Creates a matcher that will expect that a value is not equal to the matcher's expected value.
 
::QTextStream & operator<< (::QTextStream &stream, const long double value)
 
template<typename KeyType, typename ElementType>
::QTextStream & operator<< (::QTextStream &stream, const std::map< KeyType, ElementType > &container)
 
template<typename FirstValueType, typename SecondValueType>
::QTextStream & operator<< (::QTextStream &stream, const std::pair< FirstValueType, SecondValueType > &p)
 
template<typename ElementType>
::QTextStream & operator<< (::QTextStream &stream, const std::set< ElementType > &container)
 
template<typename ElementType>
::QTextStream & operator<< (::QTextStream &stream, const std::vector< ElementType > &container)
 
template<typename MissingStreamInsertionType>
std::enable_if_t< ! internal::HasStreamInsertion< MissingStreamInsertionType >::value, ::QTextStream & > operator<< (const internal::OstreamRef output, const MissingStreamInsertionType &object)
 
template<typename ExceptionType, typename ... ExceptionArguments>
ErrorRaiser< ExceptionType > raise (ExceptionArguments &&... arguments)
 
QT_MOCKS_EXPORT common_matchers::EqualMatcher< qsizetype > sizeIsEqualTo (const qsizetype expected)
 Creates a matcher that checks if a size value equals the expected value.
 
QT_MOCKS_EXPORT common_matchers::GreaterThanMatcher< qsizetype > sizeIsGreaterThan (const qsizetype expected)
 Creates a matcher that checks if a size value is greater than the expected value.
 
QT_MOCKS_EXPORT common_matchers::LessThanMatcher< qsizetype > sizeIsLessThan (const qsizetype expected)
 Creates a matcher that checks if a size value is less than the expected value.
 
QT_MOCKS_EXPORT::QString url () noexcept
 Provides the URL of the library.
 
QT_MOCKS_EXPORT::QString version () noexcept
 Provides the semantic version without the metadata of the library.
 

Function Documentation

◆ accessor()

template<typename ClassType, typename MemberReturnType, typename MatcherType>
common_matchers::MemberFunctionMatcher< ClassType, MemberReturnType, MatcherType > qt_mocks::accessor ( MemberReturnType(ClassType::* memberFunction )() const,
MatcherType matcher )
nodiscard

Creates a matcher that will expect that an object's no-argument member function meets the conditions of a matcher. This function is most often the accessor to an object's private or protected member variable.

Template Parameters
ClassTypeThe type of the class the member points to.
MemberReturnTypeThe return type of the member function.
MatcherTypeThe type of the matcher to be negated.
Parameters
memberFunctionA pointer to the no-argument member function within the object to use to obtain the actual value to compare against the matcher's expected value.
matcherThe matcher that tests the value of the object's member function.

◆ allOf()

template<typename ... MatcherTypes>
auto qt_mocks::allOf ( MatcherTypes &&... matchers)
nodiscard

A matcher that ensures that all of the supplied matcher objects pass.

Template Parameters
MatcherTypesThe types of each of the matcher to run.
Parameters
matchersThe various matchers to run.

◆ anyOf()

template<typename ... MatcherTypes>
auto qt_mocks::anyOf ( MatcherTypes &&... matchers)
nodiscard

A matcher that ensures that any of the supplied matcher objects pass.

Template Parameters
MatcherTypesThe types of each of the matcher to run.
Parameters
matchersThe various matchers to run.

◆ between()

template<typename ValueType>
common_matchers::BetweenExclusiveMatcher< ValueType > qt_mocks::between ( const ValueType & beginValue,
const ValueType & endValue )
nodiscard

Creates a matcher that will expect that a value is between two values, exclusive, to the test value.

Template Parameters
ValueTypeThis is the type the match object will compare against.
Parameters
beginValueThe expected value must be greater than this value.
endValueThe expected value must be less than this value.

◆ betweenBeginInclusive()

template<typename ValueType>
common_matchers::BetweenBeginInclusiveMatcher< ValueType > qt_mocks::betweenBeginInclusive ( const ValueType & beginValue,
const ValueType & endValue )
nodiscard

Creates a matcher that will expect that a value is between two values, beginning inclusive and ending exclusive, to the test value.

Template Parameters
ValueTypeThis is the type the match object will compare against.
Parameters
beginValueThe expected value must be greater than or equal to this value.
endValueThe expected value must be less than this value.

◆ betweenEndInclusive()

template<typename ValueType>
common_matchers::BetweenEndInclusiveMatcher< ValueType > qt_mocks::betweenEndInclusive ( const ValueType & beginValue,
const ValueType & endValue )
nodiscard

Creates a matcher that will expect that a value is between two values, beginning exclusive and ending inclusive, to the test value.

Template Parameters
ValueTypeThis is the type the match object will compare against.
Parameters
beginValueThe expected value must be greater than this value.
endValueThe expected value must be less than or equal to this value.

◆ betweenInclusive()

template<typename ValueType>
common_matchers::BetweenInclusiveMatcher< ValueType > qt_mocks::betweenInclusive ( const ValueType & beginValue,
const ValueType & endValue )
nodiscard

Creates a matcher that will expect that a value is between two values, beginning and ending inclusive, to the test value.

Template Parameters
ValueTypeThis is the type the match object will compare against.
Parameters
beginValueThe expected value must be greater than or equal to this value.
endValueThe expected value must be less than or equal to this value.

◆ containsString()

template<typename ValueType>
common_matchers::ContainsStringMatcher< ValueType > qt_mocks::containsString ( const ValueType & expected)
nodiscard

Creates a matcher that checks if a value contains the specified substring.

Template Parameters
ValueTypeThe type of the value string to be matched.
Parameters
expectedThe substring that is expected to be contained in the value.
Returns
A matcher that verifies whether the given value contains the specified substring.

◆ copyright()

QT_MOCKS_EXPORT::QString qt_mocks::copyright ( )
nodiscardnoexcept

Provides the copyright of the library.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ description()

QT_MOCKS_EXPORT::QString qt_mocks::description ( )
nodiscardnoexcept

Provides the description of the library.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ equals() [1/2]

QT_MOCKS_EXPORT common_matchers::EqualMatcher<::QString > qt_mocks::equals ( const char *const expected)
nodiscard

Creates a matcher that will expect that a value is equal to the matcher's expected value.

Template Parameters
ValueTypeThis is the type the match object will compare against.
Parameters
expectedThe expected value of the test value.
Returns
The matcher that will compare against the expected value as a QString.

◆ equals() [2/2]

template<typename ValueType>
common_matchers::EqualMatcher< ValueType > qt_mocks::equals ( const ValueType & expected)
nodiscard

Creates a matcher that will expect that a value is equal to the matcher's expected value.

Template Parameters
ValueTypeThis is the type the match object will compare against.
Parameters
expectedThe expected value of the test value.

◆ field()

template<typename ClassType, typename MemberVariableType, typename MatcherType>
common_matchers::MemberVariableMatcher< ClassType, MemberVariableType, MatcherType > qt_mocks::field ( MemberVariableType ClassType::*const memberVariable,
const MatcherType & matcher )
nodiscard

Creates a matcher that will expect that an object's member variable meets the conditions of a matcher.

Template Parameters
ClassTypeThe type of the class the member points to.
MemberVariableTypeThe type of the member variable.
MatcherTypeThe type of the matcher to be negated.
Parameters
memberVariableA pointer to the member variable contained within the object to use when comparing the actual value, the member variable, to the matcher's expected value.
matcherThe matcher that tests the value of the object's member variable.

◆ generate()

template<typename FunctionType>
auto qt_mocks::generate ( FunctionType && generator)

Creates a means to generate a value for a mocked function's return value.

Template Parameters
FunctionTypeThe callable type that takes no arguments and returns the value expected by the mocked function.
Parameters
generatorThe functor that generates a value upon each invocation.
Returns
an object containing all the information on what the mocked function should generate.

◆ give()

template<typename ReturnType>
ValueGiver< ReturnType > qt_mocks::give ( ReturnType value)
noexcept

Creates a means to specify exactly what value should a mocked function return.

Template Parameters
ReturnTypeThe type of the value to be returned.
Parameters
valueThe value that should be returned.
Returns
an object containing all the information on what the mocked function should return.

◆ greaterThan()

template<typename ValueType>
common_matchers::GreaterThanMatcher< ValueType > qt_mocks::greaterThan ( const ValueType & expected)
nodiscard

Creates a matcher that will expect that a value is greater-than the matcher's expected value.

Template Parameters
ValueTypeThis is the type the match object will compare against.
Parameters
expectedThe expected value of the test value.

◆ greaterThanEqual()

template<typename ValueType>
common_matchers::GreaterThanEqualMatcher< ValueType > qt_mocks::greaterThanEqual ( const ValueType & expected)
nodiscard

Creates a matcher that will expect that a value is greater-than or equal to the matcher's expected value.

Template Parameters
ValueTypeThis is the type the match object will compare against.
Parameters
expectedThe expected value of the test value.

◆ isFalse()

QT_MOCKS_EXPORT common_matchers::BooleanMatcher qt_mocks::isFalse ( )
nodiscard

Creates a matcher that a value will be false against it.

◆ isTrue()

QT_MOCKS_EXPORT common_matchers::BooleanMatcher qt_mocks::isTrue ( )
nodiscard

Creates a matcher that a value will be true against it.

◆ lessThan()

template<typename ValueType>
common_matchers::LessThanMatcher< ValueType > qt_mocks::lessThan ( const ValueType & expected)
nodiscard

Creates a matcher that will expect that a value is less-than the matcher's expected value.

Template Parameters
ValueTypeThis is the type the match object will compare against.
Parameters
expectedThe expected value of the test value.

◆ lessThanEqual()

template<typename ValueType>
common_matchers::LessThanEqualMatcher< ValueType > qt_mocks::lessThanEqual ( const ValueType & expected)
nodiscard

Creates a matcher that will expect that a value is less-than or equal to the matcher's expected value.

Template Parameters
ValueTypeThis is the type the match object will compare against.
Parameters
expectedThe expected value of the test value.

◆ licence()

QT_MOCKS_EXPORT::QString qt_mocks::licence ( )
nodiscardnoexcept

Provides the licence of the library.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ metadataVersion()

QT_MOCKS_EXPORT::QString qt_mocks::metadataVersion ( )
nodiscardnoexcept

Provides the semantic version with the metadata of the library.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ not_()

template<typename MatcherType>
common_matchers::NegationMatcher< typename MatcherType::MatcherValueType > qt_mocks::not_ ( MatcherType && matcher)
nodiscard

Creates a matcher that will negate the result of another matcher.

Template Parameters
MatcherTypeThe type of the matcher to be negated.
Parameters
matcherThe matcher whose comparison result should be negated.

◆ notEquals()

template<typename ValueType>
common_matchers::NotEqualMatcher< ValueType > qt_mocks::notEquals ( const ValueType & expected)
nodiscard

Creates a matcher that will expect that a value is not equal to the matcher's expected value.

Template Parameters
ValueTypeThis is the type the match object will compare against.
Parameters
expectedThe expected value of the test value.

◆ operator<<() [1/6]

::QTextStream & qt_mocks::operator<< ( ::QTextStream & stream,
const long double value )

◆ operator<<() [2/6]

template<typename KeyType, typename ElementType>
::QTextStream & qt_mocks::operator<< ( ::QTextStream & stream,
const std::map< KeyType, ElementType > & container )

◆ operator<<() [3/6]

template<typename FirstValueType, typename SecondValueType>
::QTextStream & qt_mocks::operator<< ( ::QTextStream & stream,
const std::pair< FirstValueType, SecondValueType > & p )

◆ operator<<() [4/6]

template<typename ElementType>
::QTextStream & qt_mocks::operator<< ( ::QTextStream & stream,
const std::set< ElementType > & container )

◆ operator<<() [5/6]

template<typename ElementType>
::QTextStream & qt_mocks::operator<< ( ::QTextStream & stream,
const std::vector< ElementType > & container )

◆ operator<<() [6/6]

template<typename MissingStreamInsertionType>
std::enable_if_t< ! internal::HasStreamInsertion< MissingStreamInsertionType >::value, ::QTextStream & > qt_mocks::operator<< ( const internal::OstreamRef output,
const MissingStreamInsertionType & object )

◆ raise()

template<typename ExceptionType, typename ... ExceptionArguments>
ErrorRaiser< ExceptionType > qt_mocks::raise ( ExceptionArguments &&... arguments)

Creates a means to specify exactly what error exception should a mocked function throw.

Template Parameters
ExceptionTypeThe type of the exception to raise.
ExceptionArgumentsThe types of the parameters for the exception being raised.
Parameters
argumentsAny arguments to supply to the exception being raised.
Returns
an object containing all the information on what the mocked function should throw.

◆ sizeIsEqualTo()

QT_MOCKS_EXPORT common_matchers::EqualMatcher< qsizetype > qt_mocks::sizeIsEqualTo ( const qsizetype expected)
nodiscard

Creates a matcher that checks if a size value equals the expected value.

Parameters
expectedThe expected size to compare against.
Returns
A matcher for comparing the value to an expected size.

◆ sizeIsGreaterThan()

QT_MOCKS_EXPORT common_matchers::GreaterThanMatcher< qsizetype > qt_mocks::sizeIsGreaterThan ( const qsizetype expected)
nodiscard

Creates a matcher that checks if a size value is greater than the expected value.

Parameters
expectedThe expected size to compare against.
Returns
A matcher for comparing the value to an expected size.

◆ sizeIsLessThan()

QT_MOCKS_EXPORT common_matchers::LessThanMatcher< qsizetype > qt_mocks::sizeIsLessThan ( const qsizetype expected)
nodiscard

Creates a matcher that checks if a size value is less than the expected value.

Parameters
expectedThe expected size to compare against.
Returns
A matcher for comparing the value to an expected size.

◆ url()

QT_MOCKS_EXPORT::QString qt_mocks::url ( )
nodiscardnoexcept

Provides the URL of the library.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ version()

QT_MOCKS_EXPORT::QString qt_mocks::version ( )
nodiscardnoexcept

Provides the semantic version without the metadata of the library.