Class NamedValueComparator

Inheritance Relationships

Derived Types

Class Documentation

class NamedValueComparator
[source]

Abstract interface for comparing values of a custom mock parameter type.

Implement both pure virtual methods and pass an instance to mu::tiny::mock::Support::install_comparator(). The comparator’s lifetime must extend at least as long as the test (or SupportPlugin scope).

Subclassed by mu::tiny::mock::FunctionComparator, mu::tiny::mock::TypedMockComparator< T >

Public Functions

NamedValueComparator() = default
[source]
virtual ~NamedValueComparator() = default
[source]
virtual bool is_equal(const void *object1, const void *object2) = 0

Return true if object1 and object2 are equal.

Both pointers point to objects of the type associated with this comparator.

Parameters:
  • object1 – Pointer to the first object (typically the expected value).

  • object2 – Pointer to the second object (typically the actual value).

Returns:

true if the two objects are considered equal.

virtual String value_to_string(const void *object) = 0

Return a human-readable string representation of object.

Used by the failure reporter to generate “expected X but got Y” output.

Parameters:

object – Pointer to an object of the associated type.

Returns:

Display string.