forked from pool/boost
Accepting request 37247 from devel:libraries:c_c++
checked in (request 37247) OBS-URL: https://build.opensuse.org/request/show/37247 OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/boost?expand=0&rev=19
This commit is contained in:
committed by
Git OBS Bridge
parent
503e2106d4
commit
cf48fbafb2
38
boost-add_timer_canceling_test.patch
Normal file
38
boost-add_timer_canceling_test.patch
Normal file
@@ -0,0 +1,38 @@
|
||||
Add a test for timer canceling.
|
||||
|
||||
--- libs/asio/test/deadline_timer.cpp
|
||||
+++ libs/asio/test/deadline_timer.cpp
|
||||
@@ -180,8 +180,33 @@
|
||||
}
|
||||
|
||||
+void timer_handler(const boost::system::error_code&)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+void deadline_timer_cancel_test()
|
||||
+{
|
||||
+ static boost::asio::io_service io_service;
|
||||
+ struct timer
|
||||
+ {
|
||||
+ boost::asio::deadline_timer t;
|
||||
+ timer() : t(io_service) { t.expires_at(boost::posix_time::pos_infin); }
|
||||
+ } timers[50];
|
||||
+
|
||||
+ timers[2].t.async_wait(timer_handler);
|
||||
+ timers[41].t.async_wait(timer_handler);
|
||||
+ for (int i = 10; i < 20; ++i)
|
||||
+ timers[i].t.async_wait(timer_handler);
|
||||
+
|
||||
+ BOOST_CHECK(timers[2].t.cancel() == 1);
|
||||
+ BOOST_CHECK(timers[41].t.cancel() == 1);
|
||||
+ for (int i = 10; i < 20; ++i)
|
||||
+ BOOST_CHECK(timers[i].t.cancel() == 1);
|
||||
+}
|
||||
+
|
||||
test_suite* init_unit_test_suite(int, char*[])
|
||||
{
|
||||
test_suite* test = BOOST_TEST_SUITE("deadline_timer");
|
||||
test->add(BOOST_TEST_CASE(&deadline_timer_test));
|
||||
+ test->add(BOOST_TEST_CASE(&deadline_timer_cancel_test));
|
||||
return test;
|
||||
}
|
||||
Reference in New Issue
Block a user