0

How i can to test with Catch2 an endless loop called from a thread. e.g:

static vector<some_type> v; //vector with results
class foo
{
   public:
   foo(<many arguments>){}

   void endless_loop()
   {
      while(true)
      {
        //long process
        //....
        v.push_back(result_process);
      }
   }

   void bar()
   {
     thread(foo);
   }
};

In this case how test foo class, bar and endless_loop method? Exist any test pattern for this case?

Thanks!

0 Answers0