@@ -35,23 +35,41 @@ struct dummy_async_handler {
35
35
};
36
36
37
37
BOOST_AUTO_TEST_CASE (minimal_constructor) {
38
- dummy_sync_handler sync_handler;
39
- dummy_async_handler async_handler;
40
-
41
- sync_server::options sync_options (sync_handler);
42
- async_server::options async_options (async_handler);
43
- BOOST_CHECK_NO_THROW (sync_server sync_instance (sync_options.address (" 127.0.0.1" ).port (" 80" )) );
44
- BOOST_CHECK_NO_THROW (async_server async_instance (async_options.address (" 127.0.0.1" ).port (" 80" )) );
38
+ dummy_sync_handler sync_handler;
39
+ dummy_async_handler async_handler;
40
+ sync_server::options sync_options (sync_handler);
41
+ async_server::options async_options (async_handler);
42
+ BOOST_CHECK_NO_THROW (
43
+ sync_server sync_instance (sync_options.address (" 127.0.0.1" ).port (" 80" )));
44
+ BOOST_CHECK_NO_THROW (async_server async_instance (
45
+ async_options.address (" 127.0.0.1" ).port (" 80" )));
45
46
}
46
47
47
48
BOOST_AUTO_TEST_CASE (with_io_service_parameter) {
48
- dummy_sync_handler sync_handler;
49
- dummy_async_handler async_handler;
50
- boost::shared_ptr<util::thread_pool> thread_pool;
51
- boost::shared_ptr<boost::asio::io_service> io_service;
52
- sync_server::options sync_options (sync_handler);
53
- async_server::options async_options (async_handler);
54
-
55
- BOOST_CHECK_NO_THROW (sync_server sync_instance (sync_options.address (" 127.0.0.1" ).port (" 80" ).io_service (io_service).thread_pool (thread_pool)));
56
- BOOST_CHECK_NO_THROW (async_server async_instance (async_options.address (" 127.0.0.1" ).port (" 80" ).io_service (io_service).thread_pool (thread_pool)));
49
+ dummy_sync_handler sync_handler;
50
+ dummy_async_handler async_handler;
51
+ boost::shared_ptr<util::thread_pool> thread_pool;
52
+ boost::shared_ptr<boost::asio::io_service> io_service;
53
+ sync_server::options sync_options (sync_handler);
54
+ async_server::options async_options (async_handler);
55
+
56
+ BOOST_CHECK_NO_THROW (sync_server sync_instance (sync_options.address (
57
+ " 127.0.0.1" ).port (" 80" ).io_service (io_service).thread_pool (thread_pool)));
58
+ BOOST_CHECK_NO_THROW (async_server async_instance (async_options.address (
59
+ " 127.0.0.1" ).port (" 80" ).io_service (io_service).thread_pool (thread_pool)));
60
+ }
61
+
62
+ BOOST_AUTO_TEST_CASE (throws_on_failure) {
63
+ dummy_sync_handler sync_handler;
64
+ dummy_async_handler async_handler;
65
+ boost::shared_ptr<util::thread_pool> thread_pool;
66
+ boost::shared_ptr<boost::asio::io_service> io_service;
67
+ sync_server::options sync_options (sync_handler);
68
+ async_server::options async_options (async_handler);
69
+ sync_server sync_instance (sync_options.address (" 127.0.0.1" ).port (
70
+ " 80" ).io_service (io_service).thread_pool (thread_pool));
71
+ async_server async_instance (async_options.address (" 127.0.0.1" ).port (
72
+ " 80" ).io_service (io_service).thread_pool (thread_pool));
73
+ BOOST_CHECK_THROW (sync_instance.run (), std::runtime_error);
74
+ BOOST_CHECK_THROW (async_instance.run (), std::runtime_error);
57
75
}
0 commit comments