feat update
All checks were successful
rpcrypto-build / build (Debug, hisiv510.toolchain.cmake) (push) Successful in 1m10s
rpcrypto-build / build (Release, himix200.toolchain.cmake) (push) Successful in 1m12s
rpcrypto-build / build (Debug, himix200.toolchain.cmake) (push) Successful in 1m19s
rpcrypto-build / build (Release, hisiv510.toolchain.cmake) (push) Successful in 1m23s
linux-hisiv500-gcc / linux-gcc-hisiv500 (push) Successful in 1m34s
linux-mips64-gcc / linux-gcc-mips64el (push) Successful in 1m35s
linux-x64-gcc / linux-gcc (push) Successful in 1m51s

This commit is contained in:
tqcq 2024-01-21 16:11:35 +08:00
parent c3b5a29da2
commit 45419dab46

View File

@ -24,17 +24,29 @@ TEST(rpc_core, base)
});
rpc_s->set_ready(true);
rpc_s->subscribe(
"test", [](const std::string &msg) -> std::string { return "ok"; });
auto rpc_c = rpc_core::rpc::create(loopback);
rpc_c->set_timer([](uint32_t ms, const rpc_core::rpc::timeout_cb &cb) {
RPC_CORE_UNUSED(ms);
RPC_CORE_UNUSED(cb);
});
rpc_c->set_ready(true);
rpc_c->cmd("test")
->msg(std::string("hello"))
->rsp([](const std::string &rsp) { EXPECT_EQ(rsp, "ok"); })
->call();
{
rpc_s->subscribe(
"test", [](const std::string &msg) -> std::string { return "ok"; });
rpc_c->cmd("test")
->msg(std::string("hello"))
->rsp([](const std::string &rsp) { EXPECT_EQ(rsp, "ok"); })
->call();
}
{
TestType test_type;
rpc_s->subscribe("call1",
[](const TestType &val) -> TestType { return val; });
rpc_c->cmd("call1")
->msg(test_type)
->rsp([](const TestType &val) {})
->call();
}
}