From 68c7bef33e74f23aa0136ccd6f7faa654d671ebc Mon Sep 17 00:00:00 2001 From: lichao <lichao@aiotlink.com> Date: 星期五, 21 五月 2021 09:23:01 +0800 Subject: [PATCH] center publish notify; fix topic partial match. --- utest/robust_test.cpp | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+), 0 deletions(-) diff --git a/utest/robust_test.cpp b/utest/robust_test.cpp index e7b8894..ea6144c 100644 --- a/utest/robust_test.cpp +++ b/utest/robust_test.cpp @@ -16,6 +16,35 @@ ///////////////////////////////////////////////////////////////////////////////////////// +BOOST_AUTO_TEST_CASE(InitTest) +{ + AtomicReqRep rr; + auto client = [&]() { + for (int i = 0; i < 20; ++i) { + int64_t reply = 0; + bool r = rr.ClientRequest(i, reply); + printf("init request %d, %s, reply %d\n", i, (r ? "ok" : "failed"), reply); + } + }; + + bool run = true; + auto server = [&]() { + auto onReq = [](int64_t req) { return req + 100; }; + while (run) { + rr.ServerProcess(onReq); + } + }; + + ThreadManager clients, servers; + servers.Launch(server); + for (int i = 0; i < 2; ++i) { + clients.Launch(client); + } + clients.WaitAll(); + run = false; + servers.WaitAll(); +} + BOOST_AUTO_TEST_CASE(QueueTest) { const int nthread = 100; -- Gitblit v1.8.0