diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2026-04-01 09:36:31 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2026-04-01 09:37:52 +0200 |
| commit | fa1ea53e6f3dd6b9b5f5f8160776b230184a30bf (patch) | |
| tree | 483d7a4b48a879d535b80d20ae43dcebaec99079 /kernel/tests/kapi/cio.cpp | |
| parent | 5ae03c52fe33882416aa6044993d8422ccb33ab4 (diff) | |
| download | teachos-fa1ea53e6f3dd6b9b5f5f8160776b230184a30bf.tar.xz teachos-fa1ea53e6f3dd6b9b5f5f8160776b230184a30bf.zip | |
kernel/tests: implement platform CIO kapi
Diffstat (limited to 'kernel/tests/kapi/cio.cpp')
| -rw-r--r-- | kernel/tests/kapi/cio.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/kernel/tests/kapi/cio.cpp b/kernel/tests/kapi/cio.cpp new file mode 100644 index 0000000..6359fa8 --- /dev/null +++ b/kernel/tests/kapi/cio.cpp @@ -0,0 +1,38 @@ +#include <kapi/cio.hpp> + +#include "kernel/tests/log_buffer.hpp" + +#include <iostream> +#include <string> +#include <string_view> + +namespace kapi::cio +{ + + namespace + { + + class test_output_device : public output_device + { + public: + test_output_device() = default; + + auto write(output_stream stream, std::string_view text) -> void override + { + auto & standard_stream = stream == output_stream::stdout ? std::cout : std::cerr; + standard_stream << text; + if (text != "\n") + { + kernel::tests::log_buffer::append(std::string{text}); + } + } + } device{}; + + } // namespace + + auto init() -> void + { + set_output_device(device); + } + +} // namespace kapi::cio
\ No newline at end of file |
