aboutsummaryrefslogtreecommitdiff
path: root/tests/utils/gtest-print-helpers.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/utils/gtest-print-helpers.h')
-rw-r--r--tests/utils/gtest-print-helpers.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/utils/gtest-print-helpers.h b/tests/utils/gtest-print-helpers.h
new file mode 100644
index 0000000..60f42b4
--- /dev/null
+++ b/tests/utils/gtest-print-helpers.h
@@ -0,0 +1,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;
+}
+