From 34cd75f77d0ca94dbdba4e6cc9451fe4d33e78b3 Mon Sep 17 00:00:00 2001
From: lichao <lichao@aiotlink.com>
Date: 星期三, 19 五月 2021 19:14:13 +0800
Subject: [PATCH] add api BHQueryProcs.

---
 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