Files
Library/tests/package/IPCOnly/main.cpp
T

30 lines
807 B
C++

#include <Void/Async/Executor.hpp>
#include <Void/Binary/ByteBuffer.hpp>
#include <Void/IO/Driver.hpp>
#include <Void/IPC/IPC.hpp>
int main()
{
Void::Binary::ByteBuffer buf{16};
(void)buf.writeString("hi");
auto encoded = Void::IPC::encode_frame(
Void::IPC::FrameHeader{.type = Void::IPC::FrameType::one_way,
.request_id = 0},
buf.view());
if (!encoded.has_value()) {
return 1;
}
Void::IPC::FrameDecoder dec;
auto decoded = dec.feed(encoded->view());
if (!decoded.has_value() || decoded->size() != 1) {
return 2;
}
Void::Async::ManualExecutor exec;
auto drv = Void::IO::Driver::create(exec);
if (!drv.has_value()) {
return 3;
}
(void)(*drv)->shutdown_and_join();
return 0;
}