aboutsummaryrefslogtreecommitdiff
path: root/tests/utils/gtest-print-helpers.h
blob: 60f42b421329bbca0cabc39b4596bb9b3e189a21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

#pragma once

#include <src/greeter.h>

inline void PrintTo(const Greeter::State& state, std::ostream* os) {
    switch(state) {
        case Greeter::State::ACTIVE:      *os << "Active"; break;
        case Greeter::State::INACTIVE:    *os << "Inactive"; break;
        case Greeter::State::UNAVAILABLE: *os << "Unavailable"; break;
    }
}

inline std::ostream& operator<<(std::ostream& os, const Greeter::State& state) {
    PrintTo(state, &os);
    return os;
}