aboutsummaryrefslogtreecommitdiff
path: root/tests/utils/gtest-print-helpers.h
blob: 6dc1217ebdc19f2ad816a1a6eada193d34db1a3d (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;
    }
}

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