aboutsummaryrefslogtreecommitdiff
path: root/tests/utils/gtest-print-helpers.h
blob: 75ee13b8053a4c7da5f132d65cabe879f27c13e2 (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;
        default:                       *os << "Unavailable"; break;
    }
}

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