lichao
2021-04-23 02ba913dc7bb5d711471b27f2ea23a897d0f2e28
utest/utest.cpp
@@ -10,7 +10,14 @@
#include <thread>
#include <vector>
using namespace bhome_shm;
using namespace bhome_msg;
SharedMemory &TestShm()
{
   static SharedMemory shm("utest_0", 1024 * 1024 * 512);
   return shm;
}
template <class A, class B>
struct IsSameType {
@@ -84,10 +91,9 @@
BOOST_AUTO_TEST_CASE(PubSubTest)
{
   const std::string shm_name("ShmPubSub");
   ShmRemover auto_remove(shm_name); //remove twice? in case of killed?
   SharedMemory shm(shm_name, 1024 * 1024 * 50);
   DEFER1(shm.Remove());
   SharedMemory &shm = TestShm();
   MsgI::BindShm(shm);
   auto Avail = [&]() { return shm.get_free_memory(); };
   auto init_avail = Avail();
   int *flag = shm.find_or_construct<int>("flag")(123);
@@ -196,9 +202,8 @@
BOOST_AUTO_TEST_CASE(ReqRepTest)
{
   const std::string shm_name("ShmReqRep");
   ShmRemover auto_remove(shm_name);
   SharedMemory shm(shm_name, 1024 * 1024 * 512);
   SharedMemory &shm = TestShm();
   MsgI::BindShm(shm);
   auto Avail = [&]() { return shm.get_free_memory(); };
   auto init_avail = Avail();