message: reactor: clean up test
diff: @@ -12,19 +12,12 @@ using elle::reactor::backend::Thread;
  elle::reactor::backend::Backend* m = nullptr;
  -static
  +namespace
  +{
  void
  empty()
  {}
  -static
  -void
  -one_yield()
  -{
  - m->current()->yield();
  -}
  -
  -static
  void
  inc(int* i)
  {
  @@ -32,74 +25,72 @@ inc(int* i)
  }
  template <typename Backend>
  -static
  void
  test_die()
  {
  - m = new Backend;
  + auto&& m = Backend{};
  int i = 0;
  {
  - auto t = m->make_thread("test_die", [&i] { inc(&i); });
  + auto t = m.make_thread("test_die", [&i] { inc(&i); });
  t->step();
  - BOOST_CHECK_EQUAL(i, 1);
  + BOOST_TEST(i == 1);
  BOOST_CHECK(t->status() == Thread::Status::done);
  }
  {
  - auto t = m->make_thread("test_die", [&i] { inc(&i); });
  + auto t = m.make_thread("test_die", [&i] { inc(&i); });
  t->step();
  - BOOST_CHECK_EQUAL(i, 2);
  + BOOST_TEST(i == 2);
  BOOST_CHECK(t->status() == Thread::Status::done);
  }
  - delete m;
  }
  template <typename Backend>
  -static
  void
  test_deadlock_creation()
  {
  - m = new Backend;
  - auto t = m->make_thread("test_deadlock_creation", empty);
  + auto&& m = Backend{};
  + auto t = m.make_thread("test_deadlock_creation", empty);
  t->step();
  BOOST_CHECK(t->status() == Thread::Status::done);
  - delete m;
  }
  template <typename Backend>
  -static
  void
  test_deadlock_switch()
  {
  - m = new Backend;
  - auto t = m->make_thread("test_deadlock_switch", one_yield);
  + auto&& m = Backend{};
  +
  + auto one_yield = [&m]
  + {
  + m.current()->yield();
  + };
  +
  + auto t = m.make_thread("test_deadlock_switch", one_yield);
  t->step();
  t->step();
  BOOST_CHECK(t->status() == Thread::Status::done);
  - delete m;
  -}
  -
  -static
  -void
  -status_coro()
  -{
  - BOOST_CHECK(m->current()->status() == Thread::Status::running);
  - m->current()->yield();
  - BOOST_CHECK(m->current()->status() == Thread::Status::running);
  }
  template <typename Backend>
  -static
  void
  test_status()
  {
  - m = new Backend;
  - auto t = m->make_thread("status", &status_coro);
  + auto&& m = Backend{};
  +
  + auto status_coro = [&m]
  + {
  + BOOST_CHECK(m.current()->status() == Thread::Status::running);
  + m.current()->yield();
  + BOOST_CHECK(m.current()->status() == Thread::Status::running);
  + };
  +
  + auto t = m.make_thread("status", status_coro);
  BOOST_CHECK(t->status() == Thread::Status::starting);
  t->step();
  BOOST_CHECK(t->status() == Thread::Status::waiting);
  t->step();
  BOOST_CHECK(t->status() == Thread::Status::done);
  - delete m;
  + }
  }
  ELLE_TEST_SUITE()
  