summaryrefslogtreecommitdiff
path: root/vendor/bandit/bandit/assertion_frameworks/matchers/BeTruthy.h
blob: c86525382b303afac5bcc99168afe69b4983f910 (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
#ifndef BANDIT_BETRUTHY_H
#define BANDIT_BETRUTHY_H

#include "Matcher.h"

namespace bandit { namespace Matchers {

    class BeTruthy : public Matcher
    {
    public:
        BeTruthy() : Matcher() {}

        template<typename U>
        bool matches(const U& actualValue) const
	{
	    return !!actualValue;
	}

        bool matches(const std::nullptr_t&) const
	{
	    return false;
	}


    protected:
        virtual std::string failure_message_end() const
	{
	    return std::string("evaluate to true");
	}
    };

    static const BeTruthy be_truthy = BeTruthy();
}}

#endif	// BANDIT_BETRUTHY_H