summaryrefslogtreecommitdiff
path: root/vendor/bandit/bandit/assertion_frameworks/matchers/must.h
blob: 54eedb7f929b6cd4509e6758c35f7ff17c610bba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef BANDIT_MUST_H
#define BANDIT_MUST_H

#include "ValueProxy.h"

namespace bandit { namespace Matchers
{
    struct ValueMarker
    {
        const char* filename;
        int lineNumber;
    };

    template<typename T>
    const ValueProxy<T> operator,(const T& value, const ValueMarker& marker)
    {
        return ValueProxy<T>(marker.filename, marker.lineNumber, value);
    }

    template<typename T>
    const MatchProxy<T> operator,(const ValueProxy<T>& value, bool negate)
    {
        return negate ? value.to_not : value.to;
    }

    template<typename T, typename MatcherType>
    void operator,(const MatchProxy<T>& matchProxy, const MatcherType& matcher)
    {
        matchProxy(matcher);
    }
}}

#define must	    ,(bandit::Matchers::ValueMarker){__FILE__, __LINE__},false,
#define must_not    ,(bandit::Matchers::ValueMarker){__FILE__, __LINE__},true,

#endif	//BANDIT_MUST_H