Update of /cvsroot/boost/boost/libs/asio/test
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5259

Modified Files:
        Jamfile Jamfile.v2 socket_base_test.cpp 
Log Message:
Extend socket_base unit test to catch socket option compile errors.


Index: Jamfile
===================================================================
RCS file: /cvsroot/boost/boost/libs/asio/test/Jamfile,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Jamfile     18 Jun 2006 08:05:06 -0000      1.2
+++ Jamfile     5 Jul 2006 05:45:48 -0000       1.3
@@ -61,7 +61,7 @@
   [ run read_test.cpp <template>asio_unit_test ]
   [ link resolver_service_test.cpp <template>asio_unit_test ]
   [ link socket_acceptor_service_test.cpp <template>asio_unit_test ]
-  [ link socket_base_test.cpp <template>asio_unit_test ]
+  [ run socket_base_test.cpp <template>asio_unit_test ]
   [ link strand_service_test.cpp <template>asio_unit_test ]
   [ run strand_test.cpp <template>asio_unit_test ]
   [ link stream_socket_service_test.cpp <template>asio_unit_test ]

Index: Jamfile.v2
===================================================================
RCS file: /cvsroot/boost/boost/libs/asio/test/Jamfile.v2,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Jamfile.v2  18 Jun 2006 08:05:06 -0000      1.2
+++ Jamfile.v2  5 Jul 2006 05:45:48 -0000       1.3
@@ -101,8 +101,8 @@
   [ link resolver_service_test.cpp : $(USE_SELECT) : 
resolver_service_test_select ]
   [ link socket_acceptor_service_test.cpp ]
   [ link socket_acceptor_service_test.cpp : $(USE_SELECT) : 
socket_acceptor_service_test_select ]
-  [ link socket_base_test.cpp ]
-  [ link socket_base_test.cpp : $(USE_SELECT) : socket_base_test_select ]
+  [ run socket_base_test.cpp ]
+  [ run socket_base_test.cpp : $(USE_SELECT) : socket_base_test_select ]
   [ link strand_service_test.cpp ]
   [ link strand_service_test.cpp : $(USE_SELECT) : strand_service_test_select ]
   [ run strand_test.cpp ]

Index: socket_base_test.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/asio/test/socket_base_test.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- socket_base_test.cpp        14 Jun 2006 22:26:35 -0000      1.1
+++ socket_base_test.cpp        5 Jul 2006 05:45:48 -0000       1.2
@@ -16,10 +16,132 @@
 // Test that header file is self-contained.
 #include <boost/asio/socket_base.hpp>
 
+#include <boost/asio.hpp>
 #include "unit_test.hpp"
 
+//------------------------------------------------------------------------------
+
+// socket_base_compile test
+// ~~~~~~~~~~~~~~~~~~~~~~~~
+// The following test checks that all nested classes, enums and constants in
+// socket_base compile and link correctly. Runtime failures are ignored.
+
+namespace socket_base_compile {
+
+using namespace boost::asio;
+
+void test()
+{
+  try
+  {
+    io_service ios;
+    ip::tcp::socket sock(ios);
+    char buf[1024];
+
+    // shutdown_type enumeration.
+
+    sock.shutdown(socket_base::shutdown_receive);
+    sock.shutdown(socket_base::shutdown_send);
+    sock.shutdown(socket_base::shutdown_both);
+
+    // message_flags constants.
+
+    sock.receive(buffer(buf), socket_base::message_peek);
+    sock.receive(buffer(buf), socket_base::message_out_of_band);
+    sock.send(buffer(buf), socket_base::message_do_not_route);
+
+    // broadcast class.
+
+    socket_base::broadcast broadcast1(true);
+    sock.set_option(broadcast1);
+    socket_base::broadcast broadcast2;
+    sock.get_option(broadcast2);
+
+    // do_not_route class.
+
+    socket_base::do_not_route do_not_route1(true);
+    sock.set_option(do_not_route1);
+    socket_base::do_not_route do_not_route2;
+    sock.get_option(do_not_route2);
+
+    // keep_alive class.
+
+    socket_base::keep_alive keep_alive1(true);
+    sock.set_option(keep_alive1);
+    socket_base::keep_alive keep_alive2;
+    sock.get_option(keep_alive2);
+
+    // send_buffer_size class.
+
+    socket_base::send_buffer_size send_buffer_size1(1024);
+    sock.set_option(send_buffer_size1);
+    socket_base::send_buffer_size send_buffer_size2;
+    sock.get_option(send_buffer_size2);
+
+    // send_low_watermark class.
+
+    socket_base::send_low_watermark send_low_watermark1(128);
+    sock.set_option(send_low_watermark1);
+    socket_base::send_low_watermark send_low_watermark2;
+    sock.get_option(send_low_watermark2);
+
+    // receive_buffer_size class.
+
+    socket_base::receive_buffer_size receive_buffer_size1(1024);
+    sock.set_option(receive_buffer_size1);
+    socket_base::receive_buffer_size receive_buffer_size2;
+    sock.get_option(receive_buffer_size2);
+
+    // receive_low_watermark class.
+
+    socket_base::receive_low_watermark receive_low_watermark1(128);
+    sock.set_option(receive_low_watermark1);
+    socket_base::receive_low_watermark receive_low_watermark2;
+    sock.get_option(receive_low_watermark2);
+
+    // reuse_address class.
+
+    socket_base::reuse_address reuse_address1(true);
+    sock.set_option(reuse_address1);
+    socket_base::reuse_address reuse_address2;
+    sock.get_option(reuse_address2);
+
+    // linger class.
+
+    socket_base::linger linger1(true, 30);
+    sock.set_option(linger1);
+    socket_base::linger linger2;
+    sock.get_option(linger2);
+
+    // enable_connection_aborted class.
+
+    socket_base::enable_connection_aborted enable_connection_aborted1(true);
+    sock.set_option(enable_connection_aborted1);
+    socket_base::enable_connection_aborted enable_connection_aborted2;
+    sock.get_option(enable_connection_aborted2);
+
+    // non_blocking_io class.
+
+    socket_base::non_blocking_io non_blocking_io(true);
+    sock.io_control(non_blocking_io);
+
+    // bytes_readable class.
+
+    socket_base::bytes_readable bytes_readable;
+    sock.io_control(bytes_readable);
+    std::size_t bytes = bytes_readable.get();
+    (void)bytes;
+  }
+  catch (std::exception&)
+  {
+  }
+}
+
+} // namespace socket_base_compile
+
 test_suite* init_unit_test_suite(int argc, char* argv[])
 {
   test_suite* test = BOOST_TEST_SUITE("socket_base");
+  test->add(BOOST_TEST_CASE(&socket_base_compile::test));
   return test;
 }


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to