Boost logo

Boost Testing :

Subject: Re: [Boost-testing] How to test callbacks / non-blocking calls?
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2009-06-18 13:20:33


 <ariasgore <at> gmx.de> writes:

> void mmyFunc(const char * text)
> {
> // compare
> }
> BOOST_AUTO_TEST_CASE(foo)
> {
> mocksocket m;
> MySocket my(1000); // listen on port 1000
> my.callback(myFunc); // register callback
> m.send("foo");
>
> BOOST_CHECK_??
> // test case ended

What exactly you want to check here?

> }
>
> So my test cannot be executed at once in the case
> since the callback most probably fires too late. What are

What do you mean by too late? after you exit from the case?

> workarounds for such scenarios?

Why don't you perform checks inside the callback?

Gennadiy


Boost-testing list run by mbergal at meta-comm.com