Qt-Mocks 0.8.0-alpha.9
Mocking library using Qt Test inspired by Google Test
 
Loading...
Searching...
No Matches
qt_mocks::common_matchers::SizeIsMatcher< Container > Struct Template Referencefinal

A matcher that ensures that the container has the expected size. More...

#include <Matchers.hpp>

Inheritance diagram for qt_mocks::common_matchers::SizeIsMatcher< Container >:
Collaboration diagram for qt_mocks::common_matchers::SizeIsMatcher< Container >:

Public Member Functions

template<typename ValueType>
 SizeIsMatcher (const ValueType expected)
 Full initialisation constructor for creating a matcher based upon container size.
 
bool compare (const Container &actual) const override
 Compares the size of the given container with the expected size.
 
::QString description (const Container &actual) const override
 Provides a textual description of the current match result.
 
- Public Member Functions inherited from qt_mocks::common_matchers::Matcher< Container >
 Matcher (const ExpectedValue< Container > &value)
 Constructs the object with the given expected value.
 
 Matcher (const Matcher &other)
 Copy constructor that creates a new matcher by copying the state of another matcher.
 
 Matcher (Matcher &&other) noexcept
 Move constructor that initialises the object by transferring the state from another instance.
 
 Matcher (std::unique_ptr< ExpectedValue< Container > > expected)
 Constructs the object with the given the expected value object.
 
virtual ~Matcher ()=default
 
const ExpectedValue< Container > & expected () const noexcept
 Retrieves the expected value of the matcher.
 
bool hasExpected () const noexcept
 Checks if an expected value is set for the matcher.
 
Matcheroperator= (const Matcher &other)
 Move assignment that changes the object by transferring the state from another instance.
 
Matcheroperator= (Matcher &&other) noexcept
 Move assignment that changes the object by transferring the state from another instance.
 

Additional Inherited Members

- Public Types inherited from qt_mocks::common_matchers::Matcher< Container >
using MatcherValueType
 The type of value to match against.
 

Detailed Description

template<typename Container>
struct qt_mocks::common_matchers::SizeIsMatcher< Container >

A matcher that ensures that the container has the expected size.

Template Parameters
ContainerThe type of container to match against.

Constructor & Destructor Documentation

◆ SizeIsMatcher()

template<typename Container>
template<typename ValueType>
qt_mocks::common_matchers::SizeIsMatcher< Container >::SizeIsMatcher ( const ValueType expected)
explicit

Full initialisation constructor for creating a matcher based upon container size.

Template Parameters
ValueTypeThe type that contains the size information.
Parameters
expectedThe expected size of the container.
Here is the call graph for this function:

Member Function Documentation

◆ compare()

template<typename Container>
bool qt_mocks::common_matchers::SizeIsMatcher< Container >::compare ( const Container & actual) const
nodiscardoverridevirtual

Compares the size of the given container with the expected size.

Parameters
actualThe container whose size is to be compared to the expected size.
Returns
True if the container’s size matches the expected size; otherwise false.

Implements qt_mocks::common_matchers::Matcher< Container >.

◆ description()

template<typename Container>
::QString qt_mocks::common_matchers::SizeIsMatcher< Container >::description ( const Container & actual) const
nodiscardoverridevirtual

Provides a textual description of the current match result.

It generates a human-readable description of the comparison between the expected and actual values, including the expected and actual values themselves.

Parameters
actualThe actual value being matched against.
Returns
The detailed description of the match operation.

Implements qt_mocks::common_matchers::Matcher< Container >.