1 #ifndef HAMCRESTQT_IS_H
2 #define HAMCRESTQT_IS_H
4 #include <QSharedPointer>
6 #include "basematcher.h"
22 explicit Is(
const QSharedPointer<
Matcher<T> > &m) : matcher(m) {}
26 return matcher->matches(item);
36 matcher->describeMismatch(item, description);
40 QSharedPointer<Matcher<T> > matcher;
54 QSharedPointer<Matcher<T> >
is(
const QSharedPointer<
Matcher<T> > &matcher)
56 return QSharedPointer<Matcher<T> >(
new Is<T>(matcher));
60 QSharedPointer<Matcher<T> >
is(
const T &operand)
62 return is(equalTo(operand));
66 inline QSharedPointer<Matcher<const char*> >
is(
const char *operand)
68 return QSharedPointer<Matcher<const char*> >(
new Is<const char*>(equalTo(operand)));
73 #endif // HAMCRESTQT_IS_H
virtual void describeTo(Description &description) const
Generates a description of the object.
Definition: is.h:29
A description of a Matcher.
Definition: description.h:17
A matcher over acceptable values.
Definition: matcher.h:21
virtual bool matches(const T &item) const
Evaluates the matcher for argument item.
Definition: is.h:24
Decorates another Matcher, retaining the behaviour but allowing tests to be slightly more expressive...
Definition: is.h:19
QSharedPointer< Matcher< T > > is(const QSharedPointer< Matcher< T > > &matcher)
Decorates another Matcher, retaining its behaviour, but allowing tests to be slightly more expressive...
Definition: is.h:54
BaseClass for all Matcher implementations.
Definition: basematcher.h:17
virtual void describeMismatch(const T &item, Description &description) const
Generate a description of why the matcher has not accepted the item.
Definition: is.h:34
virtual Description & appendText(const QString &text)=0
Appends some plain text to the description.
virtual Description & appendDescriptionOf(const SelfDescribing &value)=0
Appends the description of a SelfDescribing value to this description.