aboutsummaryrefslogtreecommitdiff
path: root/tests/utils
diff options
context:
space:
mode:
Diffstat (limited to 'tests/utils')
-rw-r--r--tests/utils/gtest-print-helpers.h18
-rw-r--r--tests/utils/mock-greeter.h4
2 files changed, 20 insertions, 2 deletions
diff --git a/tests/utils/gtest-print-helpers.h b/tests/utils/gtest-print-helpers.h
new file mode 100644
index 0000000..75ee13b
--- /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;
+ default: *os << "Unavailable"; break;
+ }
+}
+
+std::ostream& operator<<(std::ostream& os, const Greeter::State& state) {
+ PrintTo(state, &os);
+ return os;
+}
+
diff --git a/tests/utils/mock-greeter.h b/tests/utils/mock-greeter.h
index 5ac85a0..5015087 100644
--- a/tests/utils/mock-greeter.h
+++ b/tests/utils/mock-greeter.h
@@ -26,7 +26,7 @@ class MockGreeter: public Greeter
public:
MockGreeter() =default;
virtual ~MockGreeter() =default;
- core::Property<bool>& is_active() override {return m_is_active;}
- core::Property<bool> m_is_active {false};
+ core::Property<Greeter::State>& state() override {return m_state;}
+ core::Property<Greeter::State> m_state {State::INACTIVE};
};