diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2026-04-02 09:51:44 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2026-04-02 09:52:13 +0200 |
| commit | f7ff847498d629c05bb206b41a172f6735e2afe6 (patch) | |
| tree | 874d35673d59d0f1e4ebcf01d61d9160ba655f9c /kernel/src/test_support/log_buffer.cpp | |
| parent | 0c01a95325b26151ff3c9a70142f5dc83ff7d53f (diff) | |
| download | teachos-f7ff847498d629c05bb206b41a172f6735e2afe6.tar.xz teachos-f7ff847498d629c05bb206b41a172f6735e2afe6.zip | |
kernel/tests: clean up implementation structure
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 |
