diff options
Diffstat (limited to 'kernel/src/test_support/log_buffer.cpp')
| -rw-r--r-- | kernel/src/test_support/log_buffer.cpp | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/kernel/src/test_support/log_buffer.cpp b/kernel/src/test_support/log_buffer.cpp index 36ed15e..9cff596 100644 --- a/kernel/src/test_support/log_buffer.cpp +++ b/kernel/src/test_support/log_buffer.cpp @@ -4,36 +4,30 @@ #include <string> #include <vector> -namespace kernel::tests::log_buffer +namespace kernel::tests { - namespace + auto log_buffer::append(std::string const & message) -> void { - std::vector<std::string> recorded_messages{}; + m_messages.push_back(message); } - auto append(std::string const & message) -> void + auto log_buffer::clear() -> void { - recorded_messages.push_back(message); + m_messages.clear(); } - auto clear() -> void + auto log_buffer::flat_messages() -> std::string { - recorded_messages.clear(); + return std::ranges::fold_left(m_messages, std::string{}, [](std::string accumulator, std::string const & message) { + accumulator += message; + return accumulator; + }); } - auto flat_messages() -> std::string + auto log_buffer::messages() -> std::vector<std::string> const & { - return std::ranges::fold_left(recorded_messages, std::string{}, - [](std::string accumulator, std::string const & message) { - accumulator += message; - return accumulator; - }); + return m_messages; } - auto messages() -> std::vector<std::string> const & - { - return recorded_messages; - } - -} // namespace kernel::tests::log_buffer +} // namespace kernel::tests |
