Add CallQueue unit test

This commit is contained in:
Vinnie Falco
2013-09-19 06:13:12 -07:00
parent 327d7a6524
commit 4e59ab2261
2 changed files with 165 additions and 0 deletions

View File

@@ -165,10 +165,13 @@ public:
{
explicit TestThread (int id)
: ThreadWithCallQueue ("#" + String::fromNumber (id))
, interruptedOnce (false)
{
start (this);
}
bool interruptedOnce;
void threadInit ()
{
}
@@ -187,7 +190,10 @@ public:
{
interrupted = interruptionPoint ();
if (interrupted)
{
interruptedOnce = true;
break;
}
s = s + String::fromNumber (m_random.nextInt ());
@@ -195,6 +201,8 @@ public:
s = String::empty;
}
bassert (interrupted);
return interrupted;
}
@@ -243,6 +251,11 @@ public:
};
}
for (int i = 0; i < threads.size(); ++i)
{
expect (threads[i]->interruptedOnce);
}
for (int i = 0; i < threads.size(); ++i)
threads[i]->stop (false);
for (int i = 0; i < threads.size(); ++i)