Modified: openoffice/trunk/main/sal/qa/osl/socket/osl_Socket2.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sal/qa/osl/socket/osl_Socket2.cxx?rev=1701357&r1=1701356&r2=1701357&view=diff
==============================================================================
--- openoffice/trunk/main/sal/qa/osl/socket/osl_Socket2.cxx (original)
+++ openoffice/trunk/main/sal/qa/osl/socket/osl_Socket2.cxx Sat Sep  5 07:59:22 
2015
@@ -54,7 +54,7 @@
 // include files
 //------------------------------------------------------------------------
 
-#include <testshl/simpleheader.hxx>
+#include "gtest/gtest.h"
 
 //#include "osl_Socket_Const.h"
 #include "sockethelper.hxx"
@@ -96,13 +96,13 @@ protected:
                sal_Bool bOK1 = asAcceptorSocket.bind( saLocalSocketAddr );
                if  ( sal_True != bOK1 )
                {
-                       t_print("# AcceptorSocket bind address failed.\n" ) ;
+                       printf("# AcceptorSocket bind address failed.\n" ) ;
                        return;
                }
                sal_Bool bOK2 = asAcceptorSocket.listen( 1 );
                if  ( sal_True != bOK2 )
                {
-                       t_print("# AcceptorSocket listen address failed.\n" ) ;
+                       printf("# AcceptorSocket listen address failed.\n" ) ;
                        return;
                }
 
@@ -112,7 +112,7 @@ protected:
                if (eResult != osl_Socket_Ok )
                {
                        bOK = sal_True;
-                       t_print("AcceptorThread: acceptConnection failed! \n");
+                       printf("AcceptorThread: acceptConnection failed! \n");
                }
        }
 public:
@@ -129,7 +129,7 @@ public:
                if ( isRunning( ) )
                {
                        asAcceptorSocket.shutdown();
-                       t_print("# error: Acceptor thread not terminated.\n" );
+                       printf("# error: Acceptor thread not terminated.\n" );
                }
        }
 };
@@ -155,95 +155,76 @@ namespace osl_Socket
        */
 
 
-       class ctors : public CppUnit::TestFixture
+       class ctors : public ::testing::Test
        {
        public:
                oslSocket sHandle;
                // initialization
-               void setUp( )
+               void SetUp( )
                {
                        sHandle = osl_createSocket( osl_Socket_FamilyInet, 
osl_Socket_TypeStream, osl_Socket_ProtocolIp );
                }
 
-               void tearDown( )
+               void TearDown( )
                {
                        sHandle = NULL;
                }
+       }; // class ctors
 
+    TEST_F(ctors, ctors_none)
+    {
+        /// Socket constructor.
+        // ::osl::Socket sSocket();
+
+        ASSERT_TRUE(1 == 1) << "test for ctors_none constructor function: 
check if the socket was created successfully, if no exception occurred";
+    }
+
+    TEST_F(ctors, ctors_acquire)
+    {
+        /// Socket constructor.
+        ::osl::Socket sSocket( sHandle );
+
+        ASSERT_TRUE(osl_Socket_TypeStream == sSocket.getType( )) << "test for 
ctors_acquire constructor function: check if the socket was created 
successfully";
+    }
+
+    TEST_F(ctors, ctors_no_acquire)
+    {
+        /// Socket constructor.
+        ::osl::Socket sSocket( sHandle, SAL_NO_ACQUIRE );
+
+        ASSERT_TRUE(osl_Socket_TypeStream == sSocket.getType( )) << " test for 
ctors_no_acquire constructor function: check if the socket was created 
successfully";
+    }
+
+    TEST_F(ctors, ctors_copy_ctor)
+    {
+        ::osl::Socket sSocket( sHandle );
+        /// Socket copy constructor.
+        ::osl::Socket copySocket( sSocket );
 
-               void ctors_none()
-               {
-                       /// Socket constructor.
-                       // ::osl::Socket sSocket();
-
-                       CPPUNIT_ASSERT_MESSAGE( "test for ctors_none 
constructor function: check if the socket was created successfully, if no 
exception occurred",
-                                                                       1 == 1 
);
-               }
-
-               void ctors_acquire()
-               {
-                       /// Socket constructor.
-                       ::osl::Socket sSocket( sHandle );
-
-                       CPPUNIT_ASSERT_MESSAGE( "test for ctors_acquire 
constructor function: check if the socket was created successfully",
-                                                                       
osl_Socket_TypeStream == sSocket.getType( ) );
-               }
-
-               void ctors_no_acquire()
-               {
-                       /// Socket constructor.
-                       ::osl::Socket sSocket( sHandle, SAL_NO_ACQUIRE );
-
-                       CPPUNIT_ASSERT_MESSAGE(" test for ctors_no_acquire 
constructor function: check if the socket was created successfully",
-                                                                       
osl_Socket_TypeStream == sSocket.getType( ) );
-               }
-
-               void ctors_copy_ctor()
-               {
-                       ::osl::Socket sSocket( sHandle );
-                       /// Socket copy constructor.
-                       ::osl::Socket copySocket( sSocket );
-
-                       CPPUNIT_ASSERT_MESSAGE(" test for ctors_copy_ctor 
constructor function: create new Socket instance using copy constructor",
-                                                                       
osl_Socket_TypeStream == copySocket.getType( ) );
-               }
+        ASSERT_TRUE(osl_Socket_TypeStream == copySocket.getType( )) << " test 
for ctors_copy_ctor constructor function: create new Socket instance using copy 
constructor";
+    }
 
-               void ctors_TypeRaw()
-               {
+    TEST_F(ctors, ctors_TypeRaw)
+    {
 #ifdef WNT
-                       oslSocket sHandleRaw = osl_createSocket( 
osl_Socket_FamilyInet, osl_Socket_TypeRaw, osl_Socket_ProtocolIp );
-// LLA: ?                      ::osl::Socket sSocket( sHandleRaw );
-                       CPPUNIT_ASSERT_MESSAGE( " type osl_Socket_TypeRaw 
socket create failed on UNX ", sHandleRaw != NULL);
+        oslSocket sHandleRaw = osl_createSocket( osl_Socket_FamilyInet, 
osl_Socket_TypeRaw, osl_Socket_ProtocolIp );
+// LLA: ?           ::osl::Socket sSocket( sHandleRaw );
+        ASSERT_TRUE(sHandleRaw != NULL) << " type osl_Socket_TypeRaw socket 
create failed on UNX ";
 #else
-                       oslSocket sHandleRaw = osl_createSocket( 
osl_Socket_FamilyInet, osl_Socket_TypeRaw, osl_Socket_ProtocolIp );
-                       CPPUNIT_ASSERT_MESSAGE( " can't create socket with type 
osl_Socket_TypeRaw within UNX is ok.", sHandleRaw == NULL);
+        oslSocket sHandleRaw = osl_createSocket( osl_Socket_FamilyInet, 
osl_Socket_TypeRaw, osl_Socket_ProtocolIp );
+        ASSERT_TRUE(sHandleRaw == NULL) << " can't create socket with type 
osl_Socket_TypeRaw within UNX is ok.";
 #endif
-               }
-
-               void ctors_family_Ipx()
-               {
-                       oslSocket sHandleIpx = osl_createSocket( 
osl_Socket_FamilyIpx, osl_Socket_TypeStream, osl_Socket_ProtocolIp );
-                       CPPUNIT_ASSERT_MESSAGE( " family osl_Socket_FamilyIpx 
socket create failed! ", sHandleIpx != NULL);
-                       ::osl::Socket sSocket( sHandleIpx );            //, 
SAL_NO_ACQUIRE );
-                       t_print("#Type is %d \n", sSocket.getType( ) );
-
-                       CPPUNIT_ASSERT_MESSAGE(" test for create new Socket 
instance that family is osl_Socket_FamilyIpx",
-                                                                       
osl_Socket_TypeStream == sSocket.getType( ) );
-               }
+    }
 
+    TEST_F(ctors, ctors_family_Ipx)
+    {
+        oslSocket sHandleIpx = osl_createSocket( osl_Socket_FamilyIpx, 
osl_Socket_TypeStream, osl_Socket_ProtocolIp );
+        ASSERT_TRUE(sHandleIpx != NULL) << " family osl_Socket_FamilyIpx 
socket create failed! ";
+        ::osl::Socket sSocket( sHandleIpx );        //, SAL_NO_ACQUIRE );
+        printf("#Type is %d \n", sSocket.getType( ) );
 
-
-               CPPUNIT_TEST_SUITE( ctors );
-               CPPUNIT_TEST( ctors_none );
-               CPPUNIT_TEST( ctors_acquire );
-               CPPUNIT_TEST( ctors_no_acquire );
-               CPPUNIT_TEST( ctors_copy_ctor );
-               CPPUNIT_TEST( ctors_TypeRaw );
-               CPPUNIT_TEST( ctors_family_Ipx );
-               CPPUNIT_TEST_SUITE_END();
-
-       }; // class ctors
-
+        ASSERT_TRUE(osl_Socket_TypeStream == sSocket.getType( )) << " test for 
create new Socket instance that family is osl_Socket_FamilyIpx";
+    }
 
        /** testing the methods:
                inline Socket& SAL_CALL operator= ( oslSocket socketHandle);
@@ -252,308 +233,265 @@ namespace osl_Socket
                inline sal_Bool SAL_CALL operator==( const oslSocket 
socketHandle ) const;
        */
 
-       class operators : public CppUnit::TestFixture
+       class operators : public ::testing::Test
        {
        public:
                oslSocket sHandle;
                // initialization
-               void setUp( )
+               void SetUp( )
                {
                        sHandle = osl_createSocket( osl_Socket_FamilyInet, 
osl_Socket_TypeStream, osl_Socket_ProtocolIp );
                }
 
-               void tearDown( )
+               void TearDown( )
                {
                        sHandle = NULL;
                }
-
+       }; // class operators
 
        /**  test writer's comment:
 
-               the assignment operator does not support direct assinment like:
-               ::osl::Socket sSocket = sHandle.
+           the assignment operator does not support direct assinment like:
+           ::osl::Socket sSocket = sHandle.
        */
-               void operators_assignment_handle()
-               {
-                       ::osl::Socket sSocket(sHandle);
-                       ::osl::Socket assignSocket = sSocket.getHandle();
-
-                       CPPUNIT_ASSERT_MESSAGE( "test for 
operators_assignment_handle function: test the assignment operator.",
-                                                                       
osl_Socket_TypeStream == assignSocket.getType( )  );
-               }
-
-               void operators_assignment()
-               {
-                       ::osl::Socket sSocket( sHandle );
-                       ::osl::Socket assignSocket = sSocket;
-
-                       CPPUNIT_ASSERT_MESSAGE( "test for operators_assignment 
function: assignment operator",
-                                                                       
osl_Socket_TypeStream == assignSocket.getType( ) );
-               }
-
-               void operators_equal_handle_001()
-               {
-                       /// Socket constructor.
-                       ::osl::Socket sSocket( sHandle );
-                       ::osl::Socket equalSocket = sSocket;
-
-                       CPPUNIT_ASSERT_MESSAGE(" test for 
operators_equal_handle_001 function: check equal.",
-                                                                       
equalSocket == sHandle );
-               }
-
-               void operators_equal_handle_002()
-               {
-                       /// Socket constructor.
-                       ::osl::Socket equalSocket( osl_createSocket( 
osl_Socket_FamilyInet, osl_Socket_TypeDgram, osl_Socket_ProtocolIp ) );
-
-                       CPPUNIT_ASSERT_MESSAGE(" test for 
operators_equal_handle_001 function: check unequal.",
-                                                                       !( 
equalSocket == sHandle ) );
-               }
-
-               void operators_equal_001()
-               {
-                       ::osl::Socket sSocket( sHandle );
-                       /// Socket copy constructor.
-                       ::osl::Socket equalSocket( sSocket );
-
-                       CPPUNIT_ASSERT_MESSAGE(" test for operators_equal 
function: check equal.",
-                                                                       
equalSocket == sSocket );
-               }
-
-               void operators_equal_002()
-               {
-                       ::osl::Socket sSocket( sHandle );
-                       /// Socket copy constructor.
-                       ::osl::Socket equalSocket( osl_createSocket( 
osl_Socket_FamilyInet, osl_Socket_TypeDgram, osl_Socket_ProtocolIp ) );
-
-                       CPPUNIT_ASSERT_MESSAGE(" test for operators_equal_002 
function: check unequal.",
-                                                                       !( 
equalSocket == sSocket ) );
-               }
-
-               CPPUNIT_TEST_SUITE( operators );
-               CPPUNIT_TEST( operators_assignment_handle );
-               CPPUNIT_TEST( operators_assignment );
-               CPPUNIT_TEST( operators_equal_handle_001 );
-               CPPUNIT_TEST( operators_equal_handle_002 );
-               CPPUNIT_TEST( operators_equal_001 );
-               CPPUNIT_TEST( operators_equal_002 );
-               CPPUNIT_TEST_SUITE_END();
-
-       }; // class operators
+    TEST_F(operators, operators_assignment_handle)
+    {
+        ::osl::Socket sSocket(sHandle);
+        ::osl::Socket assignSocket = sSocket.getHandle();
+
+        ASSERT_TRUE(osl_Socket_TypeStream == assignSocket.getType( )) << "test 
for operators_assignment_handle function: test the assignment operator.";
+    }
+
+    TEST_F(operators, operators_assignment)
+    {
+        ::osl::Socket sSocket( sHandle );
+        ::osl::Socket assignSocket = sSocket;
+
+        ASSERT_TRUE(osl_Socket_TypeStream == assignSocket.getType( )) << "test 
for operators_assignment function: assignment operator";
+    }
+
+    TEST_F(operators, operators_equal_handle_001)
+    {
+        /// Socket constructor.
+        ::osl::Socket sSocket( sHandle );
+        ::osl::Socket equalSocket = sSocket;
+
+        ASSERT_TRUE(equalSocket == sHandle) << " test for 
operators_equal_handle_001 function: check equal.";
+    }
+
+    TEST_F(operators, operators_equal_handle_002)
+    {
+        /// Socket constructor.
+        ::osl::Socket equalSocket( osl_createSocket( osl_Socket_FamilyInet, 
osl_Socket_TypeDgram, osl_Socket_ProtocolIp ) );
+
+        ASSERT_TRUE(!( equalSocket == sHandle )) << " test for 
operators_equal_handle_001 function: check unequal.";
+    }
+
+    TEST_F(operators, operators_equal_001)
+    {
+        ::osl::Socket sSocket( sHandle );
+        /// Socket copy constructor.
+        ::osl::Socket equalSocket( sSocket );
+
+        ASSERT_TRUE(equalSocket == sSocket) << " test for operators_equal 
function: check equal.";
+    }
+
+    TEST_F(operators, operators_equal_002)
+    {
+        ::osl::Socket sSocket( sHandle );
+        /// Socket copy constructor.
+        ::osl::Socket equalSocket( osl_createSocket( osl_Socket_FamilyInet, 
osl_Socket_TypeDgram, osl_Socket_ProtocolIp ) );
 
+        ASSERT_TRUE(!( equalSocket == sSocket )) << " test for 
operators_equal_002 function: check unequal.";
+    }
 
        /** testing the methods:
                inline void SAL_CALL shutdown( oslSocketDirection Direction = 
osl_Socket_DirReadWrite );
                inline void SAL_CALL close();
        */
 
-       class close : public CppUnit::TestFixture
+       class close : public ::testing::Test
        {
        public:
                oslSocket sHandle;
                // initialization
-               void setUp( )
+               void SetUp( )
                {
                        sHandle = osl_createSocket( osl_Socket_FamilyInet, 
osl_Socket_TypeStream, osl_Socket_ProtocolIp );
                }
 
-               void tearDown( )
+               void TearDown( )
                {
                        sHandle = NULL;
                }
+       }; // class close
 
+    TEST_F(close, close_001)
+    {
+        ::osl::Socket sSocket(sHandle);
+        sSocket.close();
+
+        ASSERT_TRUE(sSocket.getHandle() == sHandle) << "test for close_001 
function: this function is reserved for test.";
+    }
+
+    TEST_F(close, close_002)
+    {
+        // This blocks forever on FreeBSD
+#if defined(LINUX)
+        ::osl::AcceptorSocket asSocket( osl_Socket_FamilyInet, 
osl_Socket_ProtocolIp, osl_Socket_TypeStream );
+        AcceptorThread myAcceptorThread( asSocket, 
rtl::OUString::createFromAscii("127.0.0.1") );
+        myAcceptorThread.create();
+
+        thread_sleep( 1 );
+        //when accepting, close the socket, the thread will not block for 
accepting
+        //man close:Any locks held on the file it was associated with, and 
owned by the process, are removed
+        asSocket.close();
+        //thread_sleep( 2 );
+        myAcceptorThread.join();
 
-               void close_001()
-               {
-                       ::osl::Socket sSocket(sHandle);
-                       sSocket.close();
-
-                       CPPUNIT_ASSERT_MESSAGE( "test for close_001 function: 
this function is reserved for test.",
-                                                                       
sSocket.getHandle() == sHandle );
-               }
-
-               void close_002()
-               {
-//#if defined(LINUX)
-                       ::osl::AcceptorSocket asSocket( osl_Socket_FamilyInet, 
osl_Socket_ProtocolIp, osl_Socket_TypeStream );
-                       AcceptorThread myAcceptorThread( asSocket, 
rtl::OUString::createFromAscii("127.0.0.1") );
-                       myAcceptorThread.create();
-
-                       thread_sleep( 1 );
-                       //when accepting, close the socket, the thread will not 
block for accepting
-                       //man close:Any locks held on the file it was 
associated with, and owned by the process, are removed
-                       asSocket.close();
-                       //thread_sleep( 2 );
-                       myAcceptorThread.join();
-
-                       CPPUNIT_ASSERT_MESSAGE( "test for close when is 
accepting: the socket will quit accepting status.",
-                                                               
myAcceptorThread.isOK() == sal_True );
-//#endif
-               }
-
-               // to cover "if ( pSockAddrIn->sin_addr.s_addr == 
htonl(INADDR_ANY) )" in osl_closeSocket( )
-               void close_003()
-               {
-                       ::osl::AcceptorSocket asSocket( osl_Socket_FamilyInet, 
osl_Socket_ProtocolIp, osl_Socket_TypeStream );
-                       AcceptorThread myAcceptorThread( asSocket, 
rtl::OUString::createFromAscii("0.0.0.0") );
-                       myAcceptorThread.create();
-
-                       thread_sleep( 1 );
-                       asSocket.close();
-                       myAcceptorThread.join();
-
-                       CPPUNIT_ASSERT_MESSAGE( "test for close when is 
accepting: the socket will quit accepting status.",
-                                                               
myAcceptorThread.isOK() == sal_True );
-               }
+        ASSERT_TRUE(myAcceptorThread.isOK() == sal_True) << "test for close 
when is accepting: the socket will quit accepting status.";
+#endif
+    }
 
-               CPPUNIT_TEST_SUITE( close );
-               CPPUNIT_TEST( close_001 );
-               CPPUNIT_TEST( close_002 );
-               CPPUNIT_TEST( close_003 );
-               CPPUNIT_TEST_SUITE_END();
+    // to cover "if ( pSockAddrIn->sin_addr.s_addr == htonl(INADDR_ANY) )" in 
osl_closeSocket( )
+    TEST_F(close, close_003)
+    {
+        // This blocks forever on FreeBSD
+#if defined(LINUX)
+        ::osl::AcceptorSocket asSocket( osl_Socket_FamilyInet, 
osl_Socket_ProtocolIp, osl_Socket_TypeStream );
+        AcceptorThread myAcceptorThread( asSocket, 
rtl::OUString::createFromAscii("0.0.0.0") );
+        myAcceptorThread.create();
+
+        thread_sleep( 1 );
+        asSocket.close();
+        myAcceptorThread.join();
 
-       }; // class close
+        ASSERT_TRUE(myAcceptorThread.isOK() == sal_True) << "test for close 
when is accepting: the socket will quit accepting status.";
+#endif
+    }
 
        /** testing the method:
                inline void SAL_CALL getLocalAddr( SocketAddr &Addr ) const;
        */
 
-       class getLocalAddr : public CppUnit::TestFixture
+       class getLocalAddr : public ::testing::Test
        {
        public:
                oslSocket sHandle;
                // initialization
-               void setUp( )
+               void SetUp( )
                {
                        sHandle = osl_createSocket( osl_Socket_FamilyInet, 
osl_Socket_TypeStream, osl_Socket_ProtocolIp );
                }
 
-               void tearDown( )
+               void TearDown( )
                {
                        sHandle = NULL;
                }
+       }; // class getLocalAddr
 
-               // get the Address of the local end of the socket
-               void getLocalAddr_001()
-               {
-                       ::osl::Socket sSocket(sHandle);
-                       ::osl::SocketAddr saBindSocketAddr( 
rtl::OUString::createFromAscii("127.0.0.1"), IP_PORT_MYPORT8 );
-                       ::osl::SocketAddr saLocalSocketAddr;
-
-                       sSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); 
//sal_True);
-
-                       sal_Bool bOK1 = sSocket.bind( saBindSocketAddr );
-                       ::rtl::OUString suError1 = 
::rtl::OUString::createFromAscii("Socket bind fail:") + 
sSocket.getErrorAsString();
-                       CPPUNIT_ASSERT_MESSAGE( suError1, sal_True == bOK1 );
+    // get the Address of the local end of the socket
+    TEST_F(getLocalAddr, getLocalAddr_001)
+    {
+        ::osl::Socket sSocket(sHandle);
+        ::osl::SocketAddr saBindSocketAddr( 
rtl::OUString::createFromAscii("127.0.0.1"), IP_PORT_MYPORT8 );
+        ::osl::SocketAddr saLocalSocketAddr;
 
-                       sSocket.getLocalAddr( saLocalSocketAddr );
+        sSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); //sal_True);
 
-                       sal_Bool bOK = compareUString( 
saLocalSocketAddr.getHostname( 0 ), sSocket.getLocalHost() ) ;
+        sal_Bool bOK1 = sSocket.bind( saBindSocketAddr );
+        ::rtl::OUString suError1 = ::rtl::OUString::createFromAscii("Socket 
bind fail:") + sSocket.getErrorAsString();
+        ASSERT_TRUE(sal_True == bOK1) << suError1.pData;
 
-                       CPPUNIT_ASSERT_MESSAGE( "test for getLocalAddr 
function: first create a new socket, then a socket address, bind them, and 
check the address.",
-                                                                       
sal_True == bOK );
-               }
+        sSocket.getLocalAddr( saLocalSocketAddr );
 
+        sal_Bool bOK = compareUString( saLocalSocketAddr.getHostname( 0 ), 
sSocket.getLocalHost() ) ;
 
-               CPPUNIT_TEST_SUITE( getLocalAddr );
-               CPPUNIT_TEST( getLocalAddr_001 );
-               CPPUNIT_TEST_SUITE_END();
-
-       }; // class getLocalAddr
-
+        ASSERT_TRUE(sal_True == bOK) << "test for getLocalAddr function: first 
create a new socket, then a socket address, bind them, and check the address.";
+    }
 
        /** testing the method:
                inline sal_Int32        SAL_CALL getLocalPort() const;
        */
 
-       class getLocalPort : public CppUnit::TestFixture
+       class getLocalPort : public ::testing::Test
        {
        public:
                oslSocket sHandle;
                // initialization
-               void setUp( )
+               void SetUp( )
                {
                        sHandle = osl_createSocket( osl_Socket_FamilyInet, 
osl_Socket_TypeStream, osl_Socket_ProtocolIp );
                }
 
-               void tearDown( )
+               void TearDown( )
                {
                        sHandle = NULL;
                }
+       }; // class getLocalPort
 
-
-               void getLocalPort_001()
-               {
-                       ::osl::Socket sSocket(sHandle);
-                       ::osl::SocketAddr saBindSocketAddr( 
rtl::OUString::createFromAscii("127.0.0.1"), IP_PORT_MYPORT7 );  // aHostIp1 
localhost
-                       ::osl::SocketAddr saLocalSocketAddr;
-
-                       sSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); 
//sal_True);
-
-                       sal_Bool bOK1 = sSocket.bind( saBindSocketAddr );
-                       ::rtl::OUString suError1 = 
::rtl::OUString::createFromAscii("Socket bind fail:") + 
sSocket.getErrorAsString();
-                       CPPUNIT_ASSERT_MESSAGE( suError1, sal_True == bOK1 );
-                       sal_Bool bOK = ( IP_PORT_MYPORT7 == 
sSocket.getLocalPort( )  );
-
-                       CPPUNIT_ASSERT_MESSAGE( "test for getLocalPort 
function: first create a new socket, then a socket address, bind them, and 
check the port.",
-                                                                       
sal_True == bOK );
-               }
-
-       /**  test writer's comment:
-
-               the invalid port number can not be set by giving invalid port 
number
-               such as 99999 or -1, it will convert to ( x mod 65535 ), so it 
will always be
-               valid,  the only instance that the getLocalPort returns 
OSL_INVALID_PORT
-               is when saSocketAddr itself is an invalid one, that is , the IP 
or host name
-               can not be found, then the created socket address is not valid.
-       */
-               void getLocalPort_002()
-               {
-                       ::osl::SocketAddr saBindSocketAddr( 
rtl::OUString::createFromAscii("123.45.67.89"), IP_PORT_TELNET);
+    TEST_F(getLocalPort, getLocalPort_001)
+    {
+        ::osl::Socket sSocket(sHandle);
+        ::osl::SocketAddr saBindSocketAddr( 
rtl::OUString::createFromAscii("127.0.0.1"), IP_PORT_MYPORT7 );  // aHostIp1 
localhost
+        ::osl::SocketAddr saLocalSocketAddr;
+
+        sSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); //sal_True);
+
+        sal_Bool bOK1 = sSocket.bind( saBindSocketAddr );
+        ::rtl::OUString suError1 = ::rtl::OUString::createFromAscii("Socket 
bind fail:") + sSocket.getErrorAsString();
+        ASSERT_TRUE(sal_True == bOK1) << suError1.pData;
+        sal_Bool bOK = ( IP_PORT_MYPORT7 == sSocket.getLocalPort( )  );
+
+        ASSERT_TRUE(sal_True == bOK) << "test for getLocalPort function: first 
create a new socket, then a socket address, bind them, and check the port.";
+    }
+
+/**  test writer's comment:
+
+    the invalid port number can not be set by giving invalid port number
+    such as 99999 or -1, it will convert to ( x mod 65535 ), so it will always 
be
+    valid,  the only instance that the getLocalPort returns OSL_INVALID_PORT
+    is when saSocketAddr itself is an invalid one, that is , the IP or host 
name
+    can not be found, then the created socket address is not valid.
+*/
+    TEST_F(getLocalPort, getLocalPort_002)
+    {
+        ::osl::SocketAddr saBindSocketAddr( 
rtl::OUString::createFromAscii("123.45.67.89"), IP_PORT_TELNET);
 #ifdef WNT
-                       ::osl::Socket sSocket(sHandle);
-                       sSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); // 
sal_True);
-                       sSocket.bind( saBindSocketAddr );
-                       //Invalid IP, so bind should fail
-                       ::rtl::OUString suError = 
outputError(::rtl::OUString::valueOf(sSocket.getLocalPort( )),
-                               
::rtl::OUString::valueOf((sal_Int32)OSL_INVALID_PORT),
-                               "test for getLocalPort function: first create a 
new socket, then an invalid socket address, bind them, and check the port 
assigned.");
-                       sal_Bool bOK = ( OSL_INVALID_PORT == 
sSocket.getLocalPort( ) );
-            (void)bOK;
+        ::osl::Socket sSocket(sHandle);
+        sSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); // sal_True);
+        sSocket.bind( saBindSocketAddr );
+        //Invalid IP, so bind should fail
+        ::rtl::OUString suError = 
outputError(::rtl::OUString::valueOf(sSocket.getLocalPort( )),
+            ::rtl::OUString::valueOf((sal_Int32)OSL_INVALID_PORT),
+            "test for getLocalPort function: first create a new socket, then 
an invalid socket address, bind them, and check the port assigned.");
+        sal_Bool bOK = ( OSL_INVALID_PORT == sSocket.getLocalPort( ) );
+        (void)bOK;
 #else
-                       //on Unix, if Addr is not an address of type 
osl_Socket_FamilyInet, it returns OSL_INVALID_PORT
-                       ::rtl::OUString suError = 
::rtl::OUString::createFromAscii( "on Unix, if Addr is not an address of type 
osl_Socket_FamilyInet, it returns OSL_INVALID_PORT, but can not create Addr of 
that case");
+        //on Unix, if Addr is not an address of type osl_Socket_FamilyInet, it 
returns OSL_INVALID_PORT
+        ::rtl::OUString suError = ::rtl::OUString::createFromAscii( "on Unix, 
if Addr is not an address of type osl_Socket_FamilyInet, it returns 
OSL_INVALID_PORT, but can not create Addr of that case");
 #endif
-                       CPPUNIT_ASSERT_MESSAGE( suError, sal_False );
-
-               }
+        ASSERT_TRUE(sal_False) << suError.pData;
 
-               void getLocalPort_003()
-               {
-                       ::osl::Socket sSocket(sHandle);
-                       ::osl::SocketAddr saBindSocketAddr( getLocalIP(), 
IP_PORT_INVAL);
+    }
 
-                       sSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); 
//sal_True);
-
-                       sal_Bool bOK1 = sSocket.bind( saBindSocketAddr );
-                       ::rtl::OUString suError1 = 
::rtl::OUString::createFromAscii("Socket bind fail:") + 
sSocket.getErrorAsString();
-                       CPPUNIT_ASSERT_MESSAGE( suError1, sal_True == bOK1 );
-                       ::rtl::OUString suError = 
outputError(::rtl::OUString::valueOf(sSocket.getLocalPort( )),
-                               ::rtl::OUString::createFromAscii("34463"),
-                               "test for getLocalPort function: first create a 
new socket, then an invalid socket address, bind them, and check the port 
assigned");
-                       sal_Bool bOK = ( sSocket.getLocalPort( ) >= 1 &&  
sSocket.getLocalPort( ) <= 65535);
-
-                       CPPUNIT_ASSERT_MESSAGE( suError, sal_True == bOK );
-               }
-
-               CPPUNIT_TEST_SUITE( getLocalPort );
-               CPPUNIT_TEST( getLocalPort_001 );
-// LLA:                CPPUNIT_TEST( getLocalPort_002 );
-               CPPUNIT_TEST( getLocalPort_003 );
-               CPPUNIT_TEST_SUITE_END();
-
-       }; // class getLocalPort
+    TEST_F(getLocalPort, getLocalPort_003)
+    {
+        ::osl::Socket sSocket(sHandle);
+        ::osl::SocketAddr saBindSocketAddr( getLocalIP(), IP_PORT_INVAL);
+
+        sSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); //sal_True);
+
+        sal_Bool bOK1 = sSocket.bind( saBindSocketAddr );
+        ::rtl::OUString suError1 = ::rtl::OUString::createFromAscii("Socket 
bind fail:") + sSocket.getErrorAsString();
+        ASSERT_TRUE(sal_True == bOK1) << suError1.pData;
+        ::rtl::OUString suError = 
outputError(::rtl::OUString::valueOf(sSocket.getLocalPort( )),
+            ::rtl::OUString::createFromAscii("34463"),
+            "test for getLocalPort function: first create a new socket, then 
an invalid socket address, bind them, and check the port assigned");
+        sal_Bool bOK = ( sSocket.getLocalPort( ) >= 1 &&  
sSocket.getLocalPort( ) <= 65535);
 
+        ASSERT_TRUE(sal_True == bOK) << suError.pData;
+    }
 
        /** testing the method:
                inline ::rtl::OUString SAL_CALL getLocalHost() const;
@@ -563,79 +501,71 @@ namespace osl_Socket
            will return hostname of current processor such as 
"aegean.PRC.Sun.COM"
        */
 
-       class getLocalHost : public CppUnit::TestFixture
+       class getLocalHost : public ::testing::Test
        {
        public:
                oslSocket sHandle;
                // initialization
-               void setUp( )
+               void SetUp( )
                {
                        sHandle = osl_createSocket( osl_Socket_FamilyInet, 
osl_Socket_TypeStream, osl_Socket_ProtocolIp );
                }
 
-               void tearDown( )
+               void TearDown( )
                {
                        sHandle = NULL;
                }
+       }; // class getLocalHost
 
-
-               void getLocalHost_001()
-               {
-                       ::osl::Socket sSocket(sHandle);
-                       //port number from IP_PORT_HTTP1 to IP_PORT_MYPORT6, 
mindyliu
-                       ::osl::SocketAddr saBindSocketAddr( 
rtl::OUString::createFromAscii("127.0.0.1"), IP_PORT_MYPORT6 );
-
-                       sSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); 
//sal_True);
-
-                       sal_Bool bOK1 = sSocket.bind( saBindSocketAddr );
-                       ::rtl::OUString suError1 = 
::rtl::OUString::createFromAscii("Socket bind fail:") + 
sSocket.getErrorAsString();
-                       CPPUNIT_ASSERT_MESSAGE( suError1, sal_True == bOK1 );
-                       sal_Bool bOK;
-                       ::rtl::OUString suError;
+    TEST_F(getLocalHost, getLocalHost_001)
+    {
+        ::osl::Socket sSocket(sHandle);
+        //port number from IP_PORT_HTTP1 to IP_PORT_MYPORT6, mindyliu
+        ::osl::SocketAddr saBindSocketAddr( 
rtl::OUString::createFromAscii("127.0.0.1"), IP_PORT_MYPORT6 );
+
+        sSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); //sal_True);
+
+        sal_Bool bOK1 = sSocket.bind( saBindSocketAddr );
+        ::rtl::OUString suError1 = ::rtl::OUString::createFromAscii("Socket 
bind fail:") + sSocket.getErrorAsString();
+        ASSERT_TRUE(sal_True == bOK1) << suError1.pData;
+        sal_Bool bOK;
+        ::rtl::OUString suError;
 #ifdef WNT
-                       bOK = compareUString( sSocket.getLocalHost( ), 
getThisHostname( ) ) ;
-                       suError = outputError(sSocket.getLocalHost( ), 
getThisHostname( ),
+        bOK = compareUString( sSocket.getLocalHost( ), getThisHostname( ) ) ;
+        suError = outputError(sSocket.getLocalHost( ), getThisHostname( ),
 "test for getLocalHost function: create localhost socket and check name");
 #else
-                       ::rtl::OUString aUString = 
::rtl::OUString::createFromAscii( (const sal_Char *) "localhost" );
-                       sal_Bool bRes1, bRes2;
-                       bRes1 = compareUString( sSocket.getLocalHost( ), 
aUString ) ;
-                       bRes2 = compareUString( sSocket.getLocalHost( ), 
saBindSocketAddr.getHostname(0) ) ;
-                       bOK = bRes1 || bRes2;
-                       suError = outputError(sSocket.getLocalHost( ), 
aUString, "test for getLocalHost function: create localhost socket and check 
name");
+        ::rtl::OUString aUString = ::rtl::OUString::createFromAscii( (const 
sal_Char *) "localhost" );
+        sal_Bool bRes1, bRes2;
+        bRes1 = compareUString( sSocket.getLocalHost( ), aUString ) ;
+        bRes2 = compareUString( sSocket.getLocalHost( ), 
saBindSocketAddr.getHostname(0) ) ;
+        bOK = bRes1 || bRes2;
+        suError = outputError(sSocket.getLocalHost( ), aUString, "test for 
getLocalHost function: create localhost socket and check name");
 #endif
-                       CPPUNIT_ASSERT_MESSAGE( suError, sal_True == bOK );
-               }
-
-               void getLocalHost_002()
-               {
-                       ::osl::Socket sSocket(sHandle);
-                       ::osl::SocketAddr saBindSocketAddr( 
rtl::OUString::createFromAscii("123.45.67.89"), IP_PORT_POP3);
-                       ::osl::SocketAddr saLocalSocketAddr;
-
-                       sSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); 
//sal_True);
-                       sSocket.bind( saBindSocketAddr );
-                       //Invalid IP, so bind should fail
-                       sal_Bool bOK = compareUString( sSocket.getLocalHost( ), 
rtl::OUString::createFromAscii("") ) ;
-                       ::rtl::OUString suError = 
outputError(sSocket.getLocalHost( ), rtl::OUString::createFromAscii(""), "test 
for getLocalHost function: getLocalHost with invalid SocketAddr");
+        ASSERT_TRUE(sal_True == bOK) << suError.pData;
+    }
 
-                       CPPUNIT_ASSERT_MESSAGE( suError, sal_True == bOK );
-               }
-
-               CPPUNIT_TEST_SUITE( getLocalHost );
-               CPPUNIT_TEST( getLocalHost_001 );
-               CPPUNIT_TEST( getLocalHost_002 );
-               CPPUNIT_TEST_SUITE_END();
-
-       }; // class getLocalHost
+    TEST_F(getLocalHost, getLocalHost_002)
+    {
+        ::osl::Socket sSocket(sHandle);
+        ::osl::SocketAddr saBindSocketAddr( 
rtl::OUString::createFromAscii("123.45.67.89"), IP_PORT_POP3);
+        ::osl::SocketAddr saLocalSocketAddr;
+
+        sSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); //sal_True);
+        sSocket.bind( saBindSocketAddr );
+        //Invalid IP, so bind should fail
+        sal_Bool bOK = compareUString( sSocket.getLocalHost( ), 
rtl::OUString::createFromAscii("") ) ;
+        ::rtl::OUString suError = outputError(sSocket.getLocalHost( ), 
rtl::OUString::createFromAscii(""), "test for getLocalHost function: 
getLocalHost with invalid SocketAddr");
 
+        ASSERT_TRUE(sal_True == bOK) << suError.pData;
+    }
 
        /** testing the methods:
                inline void SAL_CALL getPeerAddr( SocketAddr & Addr) const;
                inline sal_Int32        SAL_CALL getPeerPort() const;
                inline ::rtl::OUString SAL_CALL getPeerHost() const;
        */
-       class getPeer : public CppUnit::TestFixture
+       class getPeer : public ::testing::Test
        {
        public:
                oslSocket sHandle;
@@ -645,7 +575,7 @@ namespace osl_Socket
 
 
                // initialization
-               void setUp( )
+               void SetUp( )
                {
                        pTimeout  = ( TimeValue* )malloc( sizeof( TimeValue ) );
                        pTimeout->Seconds = 3;
@@ -653,117 +583,99 @@ namespace osl_Socket
                        sHandle = osl_createSocket( osl_Socket_FamilyInet, 
osl_Socket_TypeStream, osl_Socket_ProtocolIp );
                }
 
-               void tearDown( )
+               void TearDown( )
                {
                        free( pTimeout );
                        sHandle = NULL;
                        asAcceptorSocket.close( );
                        csConnectorSocket.close( );
                }
-
-
-               void getPeer_001()
-               {
-                       ::osl::SocketAddr saLocalSocketAddr( 
rtl::OUString::createFromAscii("127.0.0.1"), IP_PORT_MYPORT );
-                       ::osl::SocketAddr saTargetSocketAddr( 
rtl::OUString::createFromAscii("127.0.0.1"), IP_PORT_MYPORT );
-                       ::osl::SocketAddr saPeerSocketAddr( 
rtl::OUString::createFromAscii("129.158.217.202"), IP_PORT_FTP );
-                       ::osl::StreamSocket ssConnection;
-                       asAcceptorSocket.setOption( osl_Socket_OptionReuseAddr, 
1 ); //sal_True);
-                       /// launch server socket
-                       sal_Bool bOK1 = asAcceptorSocket.bind( 
saLocalSocketAddr );
-                       CPPUNIT_ASSERT_MESSAGE( "AcceptorSocket bind 
'127.0.0.1' address failed.", sal_True == bOK1 );
-                       sal_Bool bOK2 = asAcceptorSocket.listen( 1 );
-                       CPPUNIT_ASSERT_MESSAGE( "AcceptorSocket listen 
failed.",  sal_True == bOK2 );
-
-                       asAcceptorSocket.enableNonBlockingMode( sal_True );
-                       asAcceptorSocket.acceptConnection(ssConnection); /// 
waiting for incoming connection...
-
-                       /// launch client socket
-                       csConnectorSocket.connect( saTargetSocketAddr, pTimeout 
);   /// connecting to server...
-
-                       /// get peer information
-                       csConnectorSocket.getPeerAddr( saPeerSocketAddr );/// 
connected.
-                       sal_Int32 peerPort = csConnectorSocket.getPeerPort( );
-                       ::rtl::OUString peerHost = 
csConnectorSocket.getPeerHost( );
-
-                       CPPUNIT_ASSERT_MESSAGE( "test for getPeer function: 
setup a connection and then get the peer address, port and host from client 
side.",
-                                                                       ( 
sal_True == compareSocketAddr( saPeerSocketAddr, saLocalSocketAddr ) )&&
-                                                                       ( 
sal_True == compareUString( peerHost, saLocalSocketAddr.getHostname( 0 ) ) ) &&
-                                                                       ( 
peerPort == saLocalSocketAddr.getPort( ) ));
-               }
-
-
-               CPPUNIT_TEST_SUITE( getPeer );
-               CPPUNIT_TEST( getPeer_001 );
-               CPPUNIT_TEST_SUITE_END();
-
        }; // class getPeer
 
+    TEST_F(getPeer, getPeer_001)
+    {
+        ::osl::SocketAddr saLocalSocketAddr( 
rtl::OUString::createFromAscii("127.0.0.1"), IP_PORT_MYPORT );
+        ::osl::SocketAddr saTargetSocketAddr( 
rtl::OUString::createFromAscii("127.0.0.1"), IP_PORT_MYPORT );
+        ::osl::SocketAddr saPeerSocketAddr( 
rtl::OUString::createFromAscii("129.158.217.202"), IP_PORT_FTP );
+        ::osl::StreamSocket ssConnection;
+        asAcceptorSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); 
//sal_True);
+        /// launch server socket
+        sal_Bool bOK1 = asAcceptorSocket.bind( saLocalSocketAddr );
+        ASSERT_TRUE(sal_True == bOK1) << "AcceptorSocket bind '127.0.0.1' 
address failed.";
+        sal_Bool bOK2 = asAcceptorSocket.listen( 1 );
+        ASSERT_TRUE(sal_True == bOK2) << "AcceptorSocket listen failed.";
+
+        asAcceptorSocket.enableNonBlockingMode( sal_True );
+        asAcceptorSocket.acceptConnection(ssConnection); /// waiting for 
incoming connection...
+
+        /// launch client socket
+        csConnectorSocket.connect( saTargetSocketAddr, pTimeout );   /// 
connecting to server...
+
+        /// get peer information
+        csConnectorSocket.getPeerAddr( saPeerSocketAddr );/// connected.
+        sal_Int32 peerPort = csConnectorSocket.getPeerPort( );
+        ::rtl::OUString peerHost = csConnectorSocket.getPeerHost( );
+
+        ASSERT_TRUE(( sal_True == compareSocketAddr( saPeerSocketAddr, 
saLocalSocketAddr ) )&&
+                                ( sal_True == compareUString( peerHost, 
saLocalSocketAddr.getHostname( 0 ) ) ) &&
+                                ( peerPort == saLocalSocketAddr.getPort( ) )) 
<< "test for getPeer function: setup a connection and then get the peer 
address, port and host from client side.";
+    }
 
        /** testing the methods:
                inline sal_Bool SAL_CALL bind(const SocketAddr& LocalInterface);
        */
 
 
-       class bind : public CppUnit::TestFixture
+       class bind : public ::testing::Test
        {
        public:
                oslSocket sHandle;
                // initialization
-               void setUp( )
+               void SetUp( )
                {
                        sHandle = osl_createSocket( osl_Socket_FamilyInet, 
osl_Socket_TypeStream, osl_Socket_ProtocolIp );
                }
 
-               void tearDown( )
+               void TearDown( )
                {
                        sHandle = NULL;
                }
-
-
-               void bind_001()
-               {
-                       ::osl::Socket sSocket(sHandle);
-                       //bind must use local IP address ---mindyliu
-                       ::osl::SocketAddr saBindSocketAddr( getLocalIP(), 
IP_PORT_MYPORT5 );
-
-                       sSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); 
//sal_True);
-                       sal_Bool bOK1 = sSocket.bind( saBindSocketAddr );
-                       CPPUNIT_ASSERT_MESSAGE( "Socket bind fail.", sal_True 
== bOK1 );
-
-                       sal_Bool bOK2 = compareUString( sSocket.getLocalHost( 
), saBindSocketAddr.getHostname( ) ) ;
-
-                       sSocket.close();
-                       CPPUNIT_ASSERT_MESSAGE( "test for bind function: bind a 
valid address.", sal_True == bOK2 );
-               }
-
-               void bind_002()
-               {
-                       ::osl::Socket sSocket(sHandle);
-                       ::osl::SocketAddr saBindSocketAddr( 
rtl::OUString::createFromAscii("123.45.67.89"), IP_PORT_NETBIOS );
-                       ::osl::SocketAddr saLocalSocketAddr;
-
-                       sSocket.setOption( osl_Socket_OptionReuseAddr, 1); // 
sal_True);
-                       sal_Bool bOK1 = sSocket.bind( saBindSocketAddr );
-                       sal_Bool bOK2 = compareUString( sSocket.getLocalHost( 
), getThisHostname( ) ) ;
-
-                       CPPUNIT_ASSERT_MESSAGE( "test for bind function: bind a 
valid address.",
-                                                                       ( 
sal_False == bOK1 ) && ( sal_False == bOK2 ) );
-               }
-
-               CPPUNIT_TEST_SUITE( bind );
-               CPPUNIT_TEST( bind_001 );
-               CPPUNIT_TEST( bind_002 );
-               CPPUNIT_TEST_SUITE_END();
-
        }; // class bind
 
+    TEST_F(bind, bind_001)
+    {
+        ::osl::Socket sSocket(sHandle);
+        //bind must use local IP address ---mindyliu
+        ::osl::SocketAddr saBindSocketAddr( getLocalIP(), IP_PORT_MYPORT5 );
+
+        sSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); //sal_True);
+        sal_Bool bOK1 = sSocket.bind( saBindSocketAddr );
+        ASSERT_TRUE(sal_True == bOK1) << "Socket bind fail.";
+
+        sal_Bool bOK2 = compareUString( sSocket.getLocalHost( ), 
saBindSocketAddr.getHostname( ) ) ;
+
+        sSocket.close();
+        ASSERT_TRUE(sal_True == bOK2) << "test for bind function: bind a valid 
address.";
+    }
+
+    TEST_F(bind, bind_002)
+    {
+        ::osl::Socket sSocket(sHandle);
+        ::osl::SocketAddr saBindSocketAddr( 
rtl::OUString::createFromAscii("123.45.67.89"), IP_PORT_NETBIOS );
+        ::osl::SocketAddr saLocalSocketAddr;
+
+        sSocket.setOption( osl_Socket_OptionReuseAddr, 1); // sal_True);
+        sal_Bool bOK1 = sSocket.bind( saBindSocketAddr );
+        sal_Bool bOK2 = compareUString( sSocket.getLocalHost( ), 
getThisHostname( ) ) ;
+
+        ASSERT_TRUE(( sal_False == bOK1 ) && ( sal_False == bOK2 )) << "test 
for bind function: bind a valid address.";
+    }
 
        /** testing the methods:
                inline sal_Bool SAL_CALL isRecvReady(const TimeValue *pTimeout 
= 0) const;
 
        */
-       class isRecvReady : public CppUnit::TestFixture
+       class isRecvReady : public ::testing::Test
        {
        public:
                oslSocket sHandle;
@@ -773,7 +685,7 @@ namespace osl_Socket
 
 
                // initialization
-               void setUp( )
+               void SetUp( )
                {
                        pTimeout  = ( TimeValue* )malloc( sizeof( TimeValue ) );
                        pTimeout->Seconds = 3;
@@ -781,52 +693,43 @@ namespace osl_Socket
                        sHandle = osl_createSocket( osl_Socket_FamilyInet, 
osl_Socket_TypeStream, osl_Socket_ProtocolIp );
                }
 
-               void tearDown( )
+               void TearDown( )
                {
                        free( pTimeout );
                        sHandle = NULL;
                        asAcceptorSocket.close( );
                        csConnectorSocket.close( );
                }
+       }; // class isRecvReady
 
+    TEST_F(isRecvReady, isRecvReady_001)
+    {
+        ::osl::SocketAddr saLocalSocketAddr( 
rtl::OUString::createFromAscii("127.0.0.1"), IP_PORT_MYPORT1 );
+        ::osl::SocketAddr saTargetSocketAddr( 
rtl::OUString::createFromAscii("127.0.0.1"), IP_PORT_MYPORT1 );
+        ::osl::SocketAddr saPeerSocketAddr( 
rtl::OUString::createFromAscii("129.158.217.202"), IP_PORT_FTP );
+        ::osl::StreamSocket ssConnection;
+        /// launch server socket
+        asAcceptorSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); // 
sal_True);
+        sal_Bool bOK1 = asAcceptorSocket.bind( saLocalSocketAddr );
+        ASSERT_TRUE(sal_True == bOK1) << "AcceptorSocket bind address failed.";
+        sal_Bool bOK2 = asAcceptorSocket.listen( 1 );
+        ASSERT_TRUE(sal_True == bOK2) << "AcceptorSocket listen failed.";
+        asAcceptorSocket.enableNonBlockingMode( sal_True );
+        asAcceptorSocket.acceptConnection(ssConnection); /// waiting for 
incoming connection...
 
-               void isRecvReady_001()
-               {
-                       ::osl::SocketAddr saLocalSocketAddr( 
rtl::OUString::createFromAscii("127.0.0.1"), IP_PORT_MYPORT1 );
-                       ::osl::SocketAddr saTargetSocketAddr( 
rtl::OUString::createFromAscii("127.0.0.1"), IP_PORT_MYPORT1 );
-                       ::osl::SocketAddr saPeerSocketAddr( 
rtl::OUString::createFromAscii("129.158.217.202"), IP_PORT_FTP );
-                       ::osl::StreamSocket ssConnection;
-                       /// launch server socket
-                       asAcceptorSocket.setOption( osl_Socket_OptionReuseAddr, 
1 ); // sal_True);
-                       sal_Bool bOK1 = asAcceptorSocket.bind( 
saLocalSocketAddr );
-                       CPPUNIT_ASSERT_MESSAGE( "AcceptorSocket bind address 
failed.", sal_True == bOK1 );
-                       sal_Bool bOK2 = asAcceptorSocket.listen( 1 );
-                       CPPUNIT_ASSERT_MESSAGE( "AcceptorSocket listen 
failed.",  sal_True == bOK2 );
-                       asAcceptorSocket.enableNonBlockingMode( sal_True );
-                       asAcceptorSocket.acceptConnection(ssConnection); /// 
waiting for incoming connection...
-
-                       /// launch client socket
-                       csConnectorSocket.connect( saTargetSocketAddr, pTimeout 
);   /// connecting to server...
-
-                       /// is receive ready?
-                       sal_Bool bOK3 = asAcceptorSocket.isRecvReady( pTimeout 
);
-
-                       CPPUNIT_ASSERT_MESSAGE( "test for isRecvReady function: 
setup a connection and then check if it can transmit data.",
-                                                                       ( 
sal_True == bOK3 ) );
-               }
-
-
-               CPPUNIT_TEST_SUITE( isRecvReady );
-               CPPUNIT_TEST( isRecvReady_001 );
-               CPPUNIT_TEST_SUITE_END();
+        /// launch client socket
+        csConnectorSocket.connect( saTargetSocketAddr, pTimeout );   /// 
connecting to server...
 
-       }; // class isRecvReady
+        /// is receive ready?
+        sal_Bool bOK3 = asAcceptorSocket.isRecvReady( pTimeout );
 
+        ASSERT_TRUE(( sal_True == bOK3 )) << "test for isRecvReady function: 
setup a connection and then check if it can transmit data.";
+    }
 
        /** testing the methods:
                inline sal_Bool SAL_CALL isSendReady(const TimeValue *pTimeout 
= 0) const;
        */
-       class isSendReady : public CppUnit::TestFixture
+       class isSendReady : public ::testing::Test
        {
        public:
                oslSocket sHandle;
@@ -836,7 +739,7 @@ namespace osl_Socket
 
 
                // initialization
-               void setUp( )
+               void SetUp( )
                {
                        pTimeout  = ( TimeValue* )malloc( sizeof( TimeValue ) );
                        pTimeout->Seconds = 3;
@@ -844,116 +747,94 @@ namespace osl_Socket
                        sHandle = osl_createSocket( osl_Socket_FamilyInet, 
osl_Socket_TypeStream, osl_Socket_ProtocolIp );
                }
 
-               void tearDown( )
+               void TearDown( )
                {
                        free( pTimeout );
                        sHandle = NULL;
                        asAcceptorSocket.close( );
                        csConnectorSocket.close( );
                }
+       }; // class isSendReady
 
+    TEST_F(isSendReady, isSendReady_001)
+    {
+        ::osl::SocketAddr saLocalSocketAddr( 
rtl::OUString::createFromAscii("127.0.0.1"), IP_PORT_MYPORT );
+        ::osl::SocketAddr saTargetSocketAddr( 
rtl::OUString::createFromAscii("127.0.0.1"), IP_PORT_MYPORT );
+        ::osl::SocketAddr saPeerSocketAddr( 
rtl::OUString::createFromAscii("129.158.217.202"), IP_PORT_FTP );
+        ::osl::StreamSocket ssConnection;
+
+        /// launch server socket
+        asAcceptorSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); 
//sal_True);
+        sal_Bool bOK1 = asAcceptorSocket.bind( saLocalSocketAddr );
+        ASSERT_TRUE(sal_True == bOK1) << "AcceptorSocket bind address failed.";
+        sal_Bool bOK2 = asAcceptorSocket.listen( 1 );
+        ASSERT_TRUE(sal_True == bOK2) << "AcceptorSocket listen failed.";
+        asAcceptorSocket.enableNonBlockingMode( sal_True );
+        asAcceptorSocket.acceptConnection(ssConnection); /// waiting for 
incoming connection...
 
-               void isSendReady_001()
-               {
-                       ::osl::SocketAddr saLocalSocketAddr( 
rtl::OUString::createFromAscii("127.0.0.1"), IP_PORT_MYPORT );
-                       ::osl::SocketAddr saTargetSocketAddr( 
rtl::OUString::createFromAscii("127.0.0.1"), IP_PORT_MYPORT );
-                       ::osl::SocketAddr saPeerSocketAddr( 
rtl::OUString::createFromAscii("129.158.217.202"), IP_PORT_FTP );
-                       ::osl::StreamSocket ssConnection;
-
-                       /// launch server socket
-                       asAcceptorSocket.setOption( osl_Socket_OptionReuseAddr, 
1 ); //sal_True);
-                       sal_Bool bOK1 = asAcceptorSocket.bind( 
saLocalSocketAddr );
-                       CPPUNIT_ASSERT_MESSAGE( "AcceptorSocket bind address 
failed.", sal_True == bOK1 );
-                       sal_Bool bOK2 = asAcceptorSocket.listen( 1 );
-                       CPPUNIT_ASSERT_MESSAGE( "AcceptorSocket listen 
failed.",  sal_True == bOK2 );
-                       asAcceptorSocket.enableNonBlockingMode( sal_True );
-                       asAcceptorSocket.acceptConnection(ssConnection); /// 
waiting for incoming connection...
-
-                       /// launch client socket
-                       csConnectorSocket.connect( saTargetSocketAddr, pTimeout 
);   /// connecting to server...
-
-                       /// is send ready?
-                       sal_Bool bOK3 = csConnectorSocket.isSendReady( pTimeout 
);
-
-                       CPPUNIT_ASSERT_MESSAGE( "test for isSendReady function: 
setup a connection and then check if it can transmit data.",
-                                                                       ( 
sal_True == bOK3 ) );
-               }
-
-
-               CPPUNIT_TEST_SUITE( isSendReady );
-               CPPUNIT_TEST( isSendReady_001 );
-               CPPUNIT_TEST_SUITE_END();
+        /// launch client socket
+        csConnectorSocket.connect( saTargetSocketAddr, pTimeout );   /// 
connecting to server...
 
-       }; // class isSendReady
+        /// is send ready?
+        sal_Bool bOK3 = csConnectorSocket.isSendReady( pTimeout );
 
+        ASSERT_TRUE(( sal_True == bOK3 )) << "test for isSendReady function: 
setup a connection and then check if it can transmit data.";
+    }
 
        /** testing the methods:
                inline oslSocketType    SAL_CALL getType() const;
 
        */
 
-       class getType : public CppUnit::TestFixture
+       class getType : public ::testing::Test
        {
        public:
                oslSocket sHandle;
                // initialization
-               void setUp( )
+               void SetUp( )
                {
 
                }
 
-               void tearDown( )
+               void TearDown( )
                {
                        sHandle = NULL;
                }
+       }; // class getType
 
+    TEST_F(getType, getType_001)
+    {
+        sHandle = osl_createSocket( osl_Socket_FamilyInet, 
osl_Socket_TypeStream, osl_Socket_ProtocolIp );
+        ::osl::Socket sSocket(sHandle);
+
+        ASSERT_TRUE(osl_Socket_TypeStream ==  sSocket.getType( )) << "test for 
getType function: get type of socket.";
+    }
+
+    TEST_F(getType, getType_002)
+    {
+        sHandle = osl_createSocket( osl_Socket_FamilyInet, 
osl_Socket_TypeDgram, osl_Socket_ProtocolIp );
+        ::osl::Socket sSocket(sHandle);
 
-               void getType_001()
-               {
-                       sHandle = osl_createSocket( osl_Socket_FamilyInet, 
osl_Socket_TypeStream, osl_Socket_ProtocolIp );
-                       ::osl::Socket sSocket(sHandle);
-
-                       CPPUNIT_ASSERT_MESSAGE( "test for getType function: get 
type of socket.",
-                                                                       
osl_Socket_TypeStream ==  sSocket.getType( ) );
-               }
-
-               void getType_002()
-               {
-                       sHandle = osl_createSocket( osl_Socket_FamilyInet, 
osl_Socket_TypeDgram, osl_Socket_ProtocolIp );
-                       ::osl::Socket sSocket(sHandle);
-
-                       CPPUNIT_ASSERT_MESSAGE( "test for getType function: get 
type of socket.",
-                                                                       
osl_Socket_TypeDgram ==  sSocket.getType( ) );
-               }
+        ASSERT_TRUE(osl_Socket_TypeDgram ==  sSocket.getType( )) << "test for 
getType function: get type of socket.";
+    }
 
 #ifdef UNX
-               // mindy: since on LINUX and SOLARIS, Raw type socket can not 
be created, so do not test getType() here
-               // mindy: and add one test case to test creating Raw type 
socket--> ctors_TypeRaw()
-               void getType_003()
-               {
-                       CPPUNIT_ASSERT_MESSAGE( "test for getType function: get 
type of socket.this is not passed in (LINUX, SOLARIS), the osl_Socket_TypeRaw, 
type socket can not be created.",
-                                                                       
sal_True);
-               }
+    // mindy: since on LINUX and SOLARIS, Raw type socket can not be created, 
so do not test getType() here
+    // mindy: and add one test case to test creating Raw type socket--> 
ctors_TypeRaw()
+    TEST_F(getType, getType_003)
+    {
+        ASSERT_TRUE(sal_True) << "test for getType function: get type of 
socket.this is not passed in (LINUX, SOLARIS), the osl_Socket_TypeRaw, type 
socket can not be created.";
+    }
 #else
-               void getType_003()
-               {
-                       sHandle = osl_createSocket( osl_Socket_FamilyInet, 
osl_Socket_TypeRaw, osl_Socket_ProtocolIp );
-                       ::osl::Socket sSocket(sHandle);
+    TEST_F(getType, getType_003)
+    {
+        sHandle = osl_createSocket( osl_Socket_FamilyInet, osl_Socket_TypeRaw, 
osl_Socket_ProtocolIp );
+        ::osl::Socket sSocket(sHandle);
 
-                       CPPUNIT_ASSERT_MESSAGE( "test for getType function: get 
type of socket.",
-                                                                       
osl_Socket_TypeRaw ==  sSocket.getType( ) );
-               }
+        ASSERT_TRUE(osl_Socket_TypeRaw ==  sSocket.getType( )) << "test for 
getType function: get type of socket.";
+    }
 #endif
 
-               CPPUNIT_TEST_SUITE( getType );
-               CPPUNIT_TEST( getType_001 );
-               CPPUNIT_TEST( getType_002 );
-               CPPUNIT_TEST( getType_003 );
-               CPPUNIT_TEST_SUITE_END();
-
-       }; // class getType
-
-
 
        /** testing the methods:
                inline sal_Int32 SAL_CALL getOption(
@@ -966,89 +847,77 @@ namespace osl_Socket
 
        */
 
-       class getOption : public CppUnit::TestFixture
+       class getOption : public ::testing::Test
        {
        public:
                oslSocket sHandle;
                // initialization
-               void setUp( )
+               void SetUp( )
                {
 
                }
 
-               void tearDown( )
+               void TearDown( )
                {
                        sHandle = NULL;
                }
+       }; // class getOption
 
-               /**  test writer's comment:
-
-                       in oslSocketOption, the osl_Socket_OptionType denote 1 
as osl_Socket_TypeStream.
-                       2 as osl_Socket_TypeDgram, etc which is not mapping the 
oslSocketType enum. differ
-                       in 1.
-               */
-
-               void getOption_001()
-               {
-                       sHandle = osl_createSocket( osl_Socket_FamilyInet, 
osl_Socket_TypeStream, osl_Socket_ProtocolIp );
-                       ::osl::Socket sSocket(sHandle);
-                       sal_Int32 * pType = ( sal_Int32 * )malloc( sizeof ( 
sal_Int32 ) );
-                       *pType = 0;
-                       sSocket.getOption( osl_Socket_OptionType,  pType, 
sizeof ( sal_Int32 ) );
-                       sal_Bool bOK = ( SOCK_STREAM ==  *pType );
-                       // there is a TypeMap(socket.c) which map 
osl_Socket_TypeStream to SOCK_STREAM on UNX, and SOCK_STREAM != 
osl_Socket_TypeStream
-                       //sal_Bool bOK = ( 
TYPE_TO_NATIVE(osl_Socket_TypeStream) ==  *pType );
-                       free( pType );
-
-                       CPPUNIT_ASSERT_MESSAGE( "test for getOption function: 
get type option of socket.",
-                                                                       
sal_True == bOK );
-               }
-
-               // getsockopt error
-               void getOption_004()
-               {
-                       sHandle = osl_createSocket( osl_Socket_FamilyInet, 
osl_Socket_TypeDgram, osl_Socket_ProtocolIp );
-                       ::osl::Socket sSocket(sHandle);
-
-                       sal_Bool * pbDontRoute = ( sal_Bool * )malloc( sizeof ( 
sal_Bool ) );
-                       sal_Int32 nRes = sSocket.getOption( 
osl_Socket_OptionInvalid,  pbDontRoute, sizeof ( sal_Bool ) );
-                       free( pbDontRoute );
-
-                       CPPUNIT_ASSERT_MESSAGE( "test for getOption function: 
get invalid option of socket, should return -1.",
-                                                                        nRes  
==  -1 );
-               }
-
-               void getOption_simple_001()
-               {
-                       sHandle = osl_createSocket( osl_Socket_FamilyInet, 
osl_Socket_TypeDgram, osl_Socket_ProtocolIp );
-                       ::osl::Socket sSocket(sHandle);
-
-                       sal_Bool bOK = ( sal_False  ==  sSocket.getOption( 
osl_Socket_OptionDontRoute ) );
-
-                       CPPUNIT_ASSERT_MESSAGE( "test for getOption function: 
get debug option of socket.",
-                                                                       
sal_True == bOK );
-               }
-
-               void getOption_simple_002()
-               {
-                       sHandle = osl_createSocket( osl_Socket_FamilyInet, 
osl_Socket_TypeDgram, osl_Socket_ProtocolIp );
-                       ::osl::Socket sSocket(sHandle);
-
-                       sal_Bool bOK = ( sal_False  ==  sSocket.getOption( 
osl_Socket_OptionDebug ) );
 
-                       CPPUNIT_ASSERT_MESSAGE( "test for getOption function: 
get debug option of socket.",
-                                                                       
sal_True == bOK );
-               }
+    /**  test writer's comment:
 
-               CPPUNIT_TEST_SUITE( getOption );
-               CPPUNIT_TEST( getOption_001 );
-               CPPUNIT_TEST( getOption_004 );
-               CPPUNIT_TEST( getOption_simple_001 );
-               CPPUNIT_TEST( getOption_simple_002 );
-               CPPUNIT_TEST_SUITE_END();
+        in oslSocketOption, the osl_Socket_OptionType denote 1 as 
osl_Socket_TypeStream.
+        2 as osl_Socket_TypeDgram, etc which is not mapping the oslSocketType 
enum. differ
+        in 1.
+    */
+
+    TEST_F(getOption, getOption_001)
+    {
+        sHandle = osl_createSocket( osl_Socket_FamilyInet, 
osl_Socket_TypeStream, osl_Socket_ProtocolIp );
+        ::osl::Socket sSocket(sHandle);
+        sal_Int32 * pType = ( sal_Int32 * )malloc( sizeof ( sal_Int32 ) );
+        *pType = 0;
+        sSocket.getOption( osl_Socket_OptionType,  pType, sizeof ( sal_Int32 ) 
);
+        sal_Bool bOK = ( SOCK_STREAM ==  *pType );
+        // there is a TypeMap(socket.c) which map osl_Socket_TypeStream to 
SOCK_STREAM on UNX, and SOCK_STREAM != osl_Socket_TypeStream
+        //sal_Bool bOK = ( TYPE_TO_NATIVE(osl_Socket_TypeStream) ==  *pType );
+        free( pType );
+
+        ASSERT_TRUE(sal_True == bOK) << "test for getOption function: get type 
option of socket.";
+    }
+
+    // getsockopt error
+    TEST_F(getOption, getOption_004)
+    {
+        sHandle = osl_createSocket( osl_Socket_FamilyInet, 
osl_Socket_TypeDgram, osl_Socket_ProtocolIp );
+        ::osl::Socket sSocket(sHandle);
+
+        sal_Bool * pbDontRoute = ( sal_Bool * )malloc( sizeof ( sal_Bool ) );
+        sal_Int32 nRes = sSocket.getOption( osl_Socket_OptionInvalid,  
pbDontRoute, sizeof ( sal_Bool ) );
+        free( pbDontRoute );
+
+        ASSERT_TRUE(nRes  ==  -1) << "test for getOption function: get invalid 
option of socket, should return -1.";
+    }
+
+    TEST_F(getOption, getOption_simple_001)
+    {
+        sHandle = osl_createSocket( osl_Socket_FamilyInet, 
osl_Socket_TypeDgram, osl_Socket_ProtocolIp );
+        ::osl::Socket sSocket(sHandle);
+
+        sal_Bool bOK = ( sal_False  ==  sSocket.getOption( 
osl_Socket_OptionDontRoute ) );
+
+        ASSERT_TRUE(sal_True == bOK) << "test for getOption function: get 
debug option of socket.";
+    }
+
+    TEST_F(getOption, getOption_simple_002)
+    {
+        sHandle = osl_createSocket( osl_Socket_FamilyInet, 
osl_Socket_TypeDgram, osl_Socket_ProtocolIp );
+        ::osl::Socket sSocket(sHandle);
 
-       }; // class getOption
+        sal_Bool bOK = ( sal_False  ==  sSocket.getOption( 
osl_Socket_OptionDebug ) );
 
+        ASSERT_TRUE(sal_True == bOK) << "test for getOption function: get 
debug option of socket.";
+    }
 
        /** testing the methods:
                inline sal_Bool SAL_CALL setOption( oslSocketOption Option,
@@ -1057,7 +926,7 @@ namespace osl_Socket
                                                                                
        oslSocketOptionLevel Level= osl_Socket_LevelSocket ) const;
        */
 
-       class setOption : public CppUnit::TestFixture
+       class setOption : public ::testing::Test
        {
        public:
                TimeValue *pTimeout;
@@ -1066,399 +935,319 @@ namespace osl_Socket
 
                ::osl::AcceptorSocket asAcceptorSocket;
 
-               void setUp( )
+               void SetUp( )
                {
 
                }
 
-               void tearDown( )
+               void TearDown( )
                {
                        asAcceptorSocket.close( );
                }
+       }; // class setOption
 
+    // LLA:
+    // getSocketOption returns BufferLen, or -1 if something failed
 
-        // LLA:
-        // getSocketOption returns BufferLen, or -1 if something failed
-
-        // setSocketOption returns sal_True, if option could stored
-        // else sal_False
+    // setSocketOption returns sal_True, if option could stored
+    // else sal_False
 
-               void setOption_001()
-               {
-                       /// set and get option.
-            int nBufferLen = sizeof ( sal_Int32);
-            // LLA: SO_DONTROUTE expect an integer boolean, what ever it is, 
it's not sal_Bool!
-
-                       sal_Int32 * pbDontRouteSet = ( sal_Int32 * )malloc( 
sizeof ( sal_Int32 ) );
-                       *pbDontRouteSet = 1; // sal_True;
-
-            sal_Int32 * pGetBuffer = ( sal_Int32 * )malloc( sizeof ( sal_Int32 
) );
-            *pGetBuffer = 0;
-
-            // maybe asAcceptorSocket is not right initialized
-                       sal_Bool  b1 = asAcceptorSocket.setOption( 
osl_Socket_OptionDontRoute,  pbDontRouteSet, nBufferLen );
-            CPPUNIT_ASSERT_MESSAGE( "setOption function failed.", ( sal_True 
== b1 ) );
-                       sal_Int32 n2 = asAcceptorSocket.getOption( 
osl_Socket_OptionDontRoute,  pGetBuffer, nBufferLen );
-            CPPUNIT_ASSERT_MESSAGE( "getOption function failed.", ( n2 == 
nBufferLen ) );
-
-                       // on Linux, the value of option is 1, on Solaris, it's 
16, but it's not important the exact value,
-                       // just judge it is zero or not!
-                       sal_Bool bOK = ( 0  !=  *pGetBuffer );
-                       t_print("#setOption_001: getOption is %d \n", 
*pGetBuffer);
-
-            // toggle check, set to 0
-            *pbDontRouteSet = 0;
-
-                       sal_Bool  b3 = asAcceptorSocket.setOption( 
osl_Socket_OptionDontRoute,  pbDontRouteSet, sizeof ( sal_Int32 ) );
-            CPPUNIT_ASSERT_MESSAGE( "setOption function failed.", ( sal_True 
== b3 ) );
-                       sal_Int32 n4 = asAcceptorSocket.getOption( 
osl_Socket_OptionDontRoute,  pGetBuffer, nBufferLen );
-            CPPUNIT_ASSERT_MESSAGE( "getOption (DONTROUTE) function failed.", 
( n4 == nBufferLen ) );
-
-            sal_Bool bOK2 = ( 0  ==  *pGetBuffer );
-
-                       t_print("#setOption_001: getOption is %d \n", 
*pGetBuffer);
-
-// LLA:                        sal_Bool * pbDontTouteSet = ( sal_Bool * 
)malloc( sizeof ( sal_Bool ) );
-// LLA:                        *pbDontTouteSet = sal_True;
-// LLA:                        sal_Bool * pbDontTouteGet = ( sal_Bool * 
)malloc( sizeof ( sal_Bool ) );
-// LLA:                        *pbDontTouteGet = sal_False;
-// LLA:                        asAcceptorSocket.setOption( 
osl_Socket_OptionDontRoute,  pbDontTouteSet, sizeof ( sal_Bool ) );
-// LLA:                        asAcceptorSocket.getOption( 
osl_Socket_OptionDontRoute,  pbDontTouteGet, sizeof ( sal_Bool ) );
-// LLA:                        ::rtl::OUString suError = 
outputError(::rtl::OUString::valueOf((sal_Int32)*pbDontTouteGet),
-// LLA:                                
::rtl::OUString::valueOf((sal_Int32)*pbDontTouteSet),
-// LLA:                                "test for setOption function: set 
osl_Socket_OptionDontRoute and then check");
+    TEST_F(setOption, setOption_001)
+    {
+        /// set and get option.
+        int nBufferLen = sizeof ( sal_Int32);
+        // LLA: SO_DONTROUTE expect an integer boolean, what ever it is, it's 
not sal_Bool!
+
+        sal_Int32 * pbDontRouteSet = ( sal_Int32 * )malloc( sizeof ( sal_Int32 
) );
+        *pbDontRouteSet = 1; // sal_True;
+
+        sal_Int32 * pGetBuffer = ( sal_Int32 * )malloc( sizeof ( sal_Int32 ) );
+        *pGetBuffer = 0;
+
+        // maybe asAcceptorSocket is not right initialized
+        sal_Bool  b1 = asAcceptorSocket.setOption( osl_Socket_OptionDontRoute, 
 pbDontRouteSet, nBufferLen );
+        ASSERT_TRUE(( sal_True == b1 )) << "setOption function failed.";
+        sal_Int32 n2 = asAcceptorSocket.getOption( osl_Socket_OptionDontRoute, 
 pGetBuffer, nBufferLen );
+        ASSERT_TRUE(( n2 == nBufferLen )) << "getOption function failed.";
+
+        // on Linux, the value of option is 1, on Solaris, it's 16, but it's 
not important the exact value,
+        // just judge it is zero or not!
+        sal_Bool bOK = ( 0  !=  *pGetBuffer );
+        printf("#setOption_001: getOption is %d \n", *pGetBuffer);
+
+        // toggle check, set to 0
+        *pbDontRouteSet = 0;
+
+        sal_Bool  b3 = asAcceptorSocket.setOption( osl_Socket_OptionDontRoute, 
 pbDontRouteSet, sizeof ( sal_Int32 ) );
+        ASSERT_TRUE(( sal_True == b3 )) << "setOption function failed.";
+        sal_Int32 n4 = asAcceptorSocket.getOption( osl_Socket_OptionDontRoute, 
 pGetBuffer, nBufferLen );
+        ASSERT_TRUE(( n4 == nBufferLen )) << "getOption (DONTROUTE) function 
failed.";
+
+        sal_Bool bOK2 = ( 0  ==  *pGetBuffer );
+
+        printf("#setOption_001: getOption is %d \n", *pGetBuffer);
+
+// LLA:             sal_Bool * pbDontTouteSet = ( sal_Bool * )malloc( sizeof ( 
sal_Bool ) );
+// LLA:             *pbDontTouteSet = sal_True;
+// LLA:             sal_Bool * pbDontTouteGet = ( sal_Bool * )malloc( sizeof ( 
sal_Bool ) );
+// LLA:             *pbDontTouteGet = sal_False;
+// LLA:             asAcceptorSocket.setOption( osl_Socket_OptionDontRoute,  
pbDontTouteSet, sizeof ( sal_Bool ) );
+// LLA:             asAcceptorSocket.getOption( osl_Socket_OptionDontRoute,  
pbDontTouteGet, sizeof ( sal_Bool ) );
+// LLA:             ::rtl::OUString suError = 
outputError(::rtl::OUString::valueOf((sal_Int32)*pbDontTouteGet),
+// LLA:                 ::rtl::OUString::valueOf((sal_Int32)*pbDontTouteSet),
+// LLA:                 "test for setOption function: set 
osl_Socket_OptionDontRoute and then check");
 // LLA:
-// LLA:                        sal_Bool bOK = ( sal_True  ==  *pbDontTouteGet 
);
-// LLA:                        free( pbDontTouteSet );
-// LLA:                        free( pbDontTouteGet );
-
-                       CPPUNIT_ASSERT_MESSAGE( "test for setOption function: 
set option of a socket and then check.",
-                                                                       ( 
sal_True == bOK ) && (sal_True == bOK2) );
-
-                       free( pbDontRouteSet );
-            free( pGetBuffer );
-// LLA:                        CPPUNIT_ASSERT_MESSAGE( suError, sal_True == 
bOK );
-               }
-
-               void setOption_002()
-               {
-                       /// set and get option.
-
-                       // sal_Int32 * pbLingerSet = ( sal_Int32 * )malloc( 
nBufferLen );
-                       // *pbLingerSet = 7;
-                       // sal_Int32 * pbLingerGet = ( sal_Int32 * )malloc( 
nBufferLen );
-                       /* struct */linger aLingerSet;
-                       sal_Int32 nBufferLen = sizeof( struct linger );
-                       aLingerSet.l_onoff = 1;
-                       aLingerSet.l_linger = 7;
-
-                       linger aLingerGet;
-
-                       asAcceptorSocket.setOption( osl_Socket_OptionLinger,  
&aLingerSet, nBufferLen );
-
-                       sal_Int32 n1 = asAcceptorSocket.getOption( 
osl_Socket_OptionLinger,  &aLingerGet, nBufferLen );
-                       CPPUNIT_ASSERT_MESSAGE( "getOption (SO_LINGER) function 
failed.", ( n1 == nBufferLen ) );
-
-                       //t_print("#setOption_002: getOption is %d \n", 
aLingerGet.l_linger);
-                       sal_Bool bOK = ( 7  ==  aLingerGet.l_linger );
-                       CPPUNIT_ASSERT_MESSAGE( "test for setOption function: 
set option of a socket and then check. ",
-                               sal_True == bOK );
-
-               }
-
-               void setOption_003()
-               {
-                       linger aLingerSet;
-                       aLingerSet.l_onoff = 1;
-                       aLingerSet.l_linger = 7;
-
-                       sal_Bool b1 = asAcceptorSocket.setOption( 
osl_Socket_OptionLinger,  &aLingerSet, 0 );
-                       printUString( asAcceptorSocket.getErrorAsString( ) );
-                       CPPUNIT_ASSERT_MESSAGE( "setOption (SO_LINGER) function 
failed for optlen is 0.",
-                               ( b1 == sal_False ) );
-               }
-
-               void setOption_simple_001()
-               {
-                       /// set and get option.
-                       asAcceptorSocket.setOption( osl_Socket_OptionDontRoute, 
1 ); //sal_True );
-                       sal_Bool bOK = ( 0  !=  asAcceptorSocket.getOption( 
osl_Socket_OptionDontRoute ) );
-
-                       t_print("setOption_simple_001(): getoption is %d \n", 
asAcceptorSocket.getOption( osl_Socket_OptionDontRoute ) );
-                       CPPUNIT_ASSERT_MESSAGE( "test for setOption function: 
set option of a socket and then check.",
-                                                                       ( 
sal_True == bOK ) );
-               }
-
-               void setOption_simple_002()
-               {
-                       /// set and get option.
-            // LLA: this does not work, due to the fact that SO_LINGER is a 
structure
-// LLA:                        asAcceptorSocket.setOption( 
osl_Socket_OptionLinger,  7 );
-// LLA:                        sal_Bool bOK = ( 7  ==  
asAcceptorSocket.getOption( osl_Socket_OptionLinger ) );
-
-// LLA:                        CPPUNIT_ASSERT_MESSAGE( "test for setOption 
function: set option of a socket and then check.",
-// LLA:                                                                        
( sal_True == bOK ) );
-               }
-
-               CPPUNIT_TEST_SUITE( setOption );
-               CPPUNIT_TEST( setOption_001 );
-               CPPUNIT_TEST( setOption_002 );
-               CPPUNIT_TEST( setOption_003 );
-               CPPUNIT_TEST( setOption_simple_001 );
-// LLA:                CPPUNIT_TEST( setOption_simple_002 );
-               CPPUNIT_TEST_SUITE_END();
-
-       }; // class setOption
+// LLA:             sal_Bool bOK = ( sal_True  ==  *pbDontTouteGet );
+// LLA:             free( pbDontTouteSet );
+// LLA:             free( pbDontTouteGet );
+
+        ASSERT_TRUE(( sal_True == bOK ) && (sal_True == bOK2)) << "test for 
setOption function: set option of a socket and then check.";
+
+        free( pbDontRouteSet );
+        free( pGetBuffer );
+// LLA:             ASSERT_TRUE(sal_True == bOK) << suError;
+    }
+
+    TEST_F(setOption, setOption_002)
+    {
+        /// set and get option.
+
+        // sal_Int32 * pbLingerSet = ( sal_Int32 * )malloc( nBufferLen );
+        // *pbLingerSet = 7;
+        // sal_Int32 * pbLingerGet = ( sal_Int32 * )malloc( nBufferLen );
+                /* struct */linger aLingerSet;
+                sal_Int32 nBufferLen = sizeof( struct linger );
+                aLingerSet.l_onoff = 1;
+                aLingerSet.l_linger = 7;
+
+            linger aLingerGet;
+
+        asAcceptorSocket.setOption( osl_Socket_OptionLinger,  &aLingerSet, 
nBufferLen );
+
+        sal_Int32 n1 = asAcceptorSocket.getOption( osl_Socket_OptionLinger,  
&aLingerGet, nBufferLen );
+                ASSERT_TRUE(( n1 == nBufferLen )) << "getOption (SO_LINGER) 
function failed.";
+
+        //printf("#setOption_002: getOption is %d \n", aLingerGet.l_linger);
+        sal_Bool bOK = ( 7  ==  aLingerGet.l_linger );
+        ASSERT_TRUE(sal_True == bOK) << "test for setOption function: set 
option of a socket and then check. ";
+
+    }
+
+    TEST_F(setOption, setOption_003)
+    {
+        linger aLingerSet;
+            aLingerSet.l_onoff = 1;
+                aLingerSet.l_linger = 7;
+
+        sal_Bool b1 = asAcceptorSocket.setOption( osl_Socket_OptionLinger,  
&aLingerSet, 0 );
+                printUString( asAcceptorSocket.getErrorAsString( ) );
+        ASSERT_TRUE(( b1 == sal_False )) << "setOption (SO_LINGER) function 
failed for optlen is 0.";
+    }
+
+    TEST_F(setOption, setOption_simple_001)
+    {
+        /// set and get option.
+        asAcceptorSocket.setOption( osl_Socket_OptionDontRoute, 1 ); 
//sal_True );
+        sal_Bool bOK = ( 0  !=  asAcceptorSocket.getOption( 
osl_Socket_OptionDontRoute ) );
+
+        printf("setOption_simple_001(): getoption is %d \n", 
asAcceptorSocket.getOption( osl_Socket_OptionDontRoute ) );
+        ASSERT_TRUE(( sal_True == bOK )) << "test for setOption function: set 
option of a socket and then check.";
+    }
+
+    TEST_F(setOption, setOption_simple_002)
+    {
+        /// set and get option.
+        // LLA: this does not work, due to the fact that SO_LINGER is a 
structure
+// LLA:         asAcceptorSocket.setOption( osl_Socket_OptionLinger,  7 );
+// LLA:         sal_Bool bOK = ( 7  ==  asAcceptorSocket.getOption( 
osl_Socket_OptionLinger ) );
 
+// LLA:         ASSERT_TRUE(// LLA:                                     ( 
sal_True == bOK )) << "test for setOption function: set option of a socket and 
then check.";
+    }
 
 
        /** testing the method:
                inline sal_Bool SAL_CALL enableNonBlockingMode( sal_Bool 
bNonBlockingMode);
        */
-       class enableNonBlockingMode : public CppUnit::TestFixture
+       class enableNonBlockingMode : public ::testing::Test
        {
        public:
                ::osl::AcceptorSocket asAcceptorSocket;
+       }; // class enableNonBlockingMode
 
-               void enableNonBlockingMode_001()
-               {
-                       ::osl::SocketAddr saLocalSocketAddr( 
rtl::OUString::createFromAscii("127.0.0.1"), IP_PORT_MYPORT );
-                       ::osl::StreamSocket ssConnection;
-
-                       /// launch server socket
-                       asAcceptorSocket.setOption( osl_Socket_OptionReuseAddr, 
1 ); //sal_True);
-                       sal_Bool bOK1 = asAcceptorSocket.bind( 
saLocalSocketAddr );
-                       CPPUNIT_ASSERT_MESSAGE( "AcceptorSocket bind address 
failed.", sal_True == bOK1 );
-                       sal_Bool bOK2 = asAcceptorSocket.listen( 1 );
-                       CPPUNIT_ASSERT_MESSAGE( "AcceptorSocket listen 
failed.",  sal_True == bOK2 );
-                       asAcceptorSocket.enableNonBlockingMode( sal_True );
-                       asAcceptorSocket.acceptConnection(ssConnection); /// 
waiting for incoming connection...
-
-                       /// if reach this statement, it is non-blocking mode, 
since acceptConnection will blocked by default.
-                       sal_Bool bOK  = sal_True;
-                       asAcceptorSocket.close( );
-
-                       CPPUNIT_ASSERT_MESSAGE( "test for enableNonBlockingMode 
function: launch a server socket and make it non blocking. if it can pass the 
acceptConnection statement, it is non-blocking",
-                                                                       ( 
sal_True == bOK  ) );
-               }
-
-
-               CPPUNIT_TEST_SUITE( enableNonBlockingMode );
-               CPPUNIT_TEST( enableNonBlockingMode_001 );
-               CPPUNIT_TEST_SUITE_END();
+    TEST_F(enableNonBlockingMode, enableNonBlockingMode_001)
+    {
+        ::osl::SocketAddr saLocalSocketAddr( 
rtl::OUString::createFromAscii("127.0.0.1"), IP_PORT_MYPORT );
+        ::osl::StreamSocket ssConnection;
+
+        /// launch server socket
+        asAcceptorSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); 
//sal_True);
+        sal_Bool bOK1 = asAcceptorSocket.bind( saLocalSocketAddr );
+        ASSERT_TRUE(sal_True == bOK1) << "AcceptorSocket bind address failed.";
+        sal_Bool bOK2 = asAcceptorSocket.listen( 1 );
+        ASSERT_TRUE(sal_True == bOK2) << "AcceptorSocket listen failed.";
+        asAcceptorSocket.enableNonBlockingMode( sal_True );
+        asAcceptorSocket.acceptConnection(ssConnection); /// waiting for 
incoming connection...
+
+        /// if reach this statement, it is non-blocking mode, since 
acceptConnection will blocked by default.
+        sal_Bool bOK  = sal_True;
+        asAcceptorSocket.close( );
 
-       }; // class enableNonBlockingMode
+        ASSERT_TRUE(( sal_True == bOK  )) << "test for enableNonBlockingMode 
function: launch a server socket and make it non blocking. if it can pass the 
acceptConnection statement, it is non-blocking";
+    }
 
 
        /** testing the method:
                inline sal_Bool SAL_CALL isNonBlockingMode() const;
        */
-       class isNonBlockingMode : public CppUnit::TestFixture
+       class isNonBlockingMode : public ::testing::Test
        {
        public:
                ::osl::AcceptorSocket asAcceptorSocket;
+       }; // class isNonBlockingMode
 
-               void isNonBlockingMode_001()
-               {
-                       ::osl::SocketAddr saLocalSocketAddr( 
rtl::OUString::createFromAscii("127.0.0.1"), IP_PORT_MYPORT );
-                       ::osl::StreamSocket ssConnection;
-
-                       /// launch server socket
-                       asAcceptorSocket.setOption( osl_Socket_OptionReuseAddr, 
1 ); // sal_True);
-                       sal_Bool bOK1 = asAcceptorSocket.bind( 
saLocalSocketAddr );
-                       CPPUNIT_ASSERT_MESSAGE( "AcceptorSocket bind address 
failed.", sal_True == bOK1 );
-                       sal_Bool bOK2 = asAcceptorSocket.listen( 1 );
-                       CPPUNIT_ASSERT_MESSAGE( "AcceptorSocket listen 
failed.",  sal_True == bOK2 );
-
-                       sal_Bool bOK3 = asAcceptorSocket.isNonBlockingMode( );
-                       asAcceptorSocket.enableNonBlockingMode( sal_True );
-                       asAcceptorSocket.acceptConnection(ssConnection); /// 
waiting for incoming connection...
-
-                       /// if reach this statement, it is non-blocking mode, 
since acceptConnection will blocked by default.
-                       sal_Bool bOK4 = asAcceptorSocket.isNonBlockingMode( );
-                       asAcceptorSocket.close( );
-
-                       CPPUNIT_ASSERT_MESSAGE( "test for isNonBlockingMode 
function: launch a server socket and make it non blocking. it is expected to 
change from blocking mode to non-blocking mode.",
-                                                                       ( 
sal_False == bOK3 ) && ( sal_True == bOK4 ) );
-               }
-
-
-               CPPUNIT_TEST_SUITE( isNonBlockingMode );
-               CPPUNIT_TEST( isNonBlockingMode_001 );
-               CPPUNIT_TEST_SUITE_END();
+    TEST_F(isNonBlockingMode, isNonBlockingMode_001)
+    {
+        ::osl::SocketAddr saLocalSocketAddr( 
rtl::OUString::createFromAscii("127.0.0.1"), IP_PORT_MYPORT );
+        ::osl::StreamSocket ssConnection;
+
+        /// launch server socket
+        asAcceptorSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); // 
sal_True);
+        sal_Bool bOK1 = asAcceptorSocket.bind( saLocalSocketAddr );
+        ASSERT_TRUE(sal_True == bOK1) << "AcceptorSocket bind address failed.";
+        sal_Bool bOK2 = asAcceptorSocket.listen( 1 );
+        ASSERT_TRUE(sal_True == bOK2) << "AcceptorSocket listen failed.";
+
+        sal_Bool bOK3 = asAcceptorSocket.isNonBlockingMode( );
+        asAcceptorSocket.enableNonBlockingMode( sal_True );
+            asAcceptorSocket.acceptConnection(ssConnection); /// waiting for 
incoming connection...
+
+        /// if reach this statement, it is non-blocking mode, since 
acceptConnection will blocked by default.
+        sal_Bool bOK4 = asAcceptorSocket.isNonBlockingMode( );
+        asAcceptorSocket.close( );
 
-       }; // class isNonBlockingMode
+        ASSERT_TRUE(( sal_False == bOK3 ) && ( sal_True == bOK4 )) << "test 
for isNonBlockingMode function: launch a server socket and make it non 
blocking. it is expected to change from blocking mode to non-blocking mode.";
+    }
 
        /** testing the method:
                inline void     SAL_CALL clearError() const;
        */
-       class clearError : public CppUnit::TestFixture
+       class clearError : public ::testing::Test
        {
        public:
                oslSocket sHandle;
                // initialization
-               void setUp( )
+               void SetUp( )
                {
                        sHandle = osl_createSocket( osl_Socket_FamilyInet, 
osl_Socket_TypeStream, osl_Socket_ProtocolIp );
                }
 
-               void tearDown( )
+               void TearDown( )
                {
                        sHandle = NULL;
                }
-
-
-               void clearError_001()
-               {
-                       ::osl::Socket sSocket(sHandle);
-                       ::osl::SocketAddr saBindSocketAddr( 
rtl::OUString::createFromAscii("123.45.67.89"), IP_PORT_HTTP2 );
-                       ::osl::SocketAddr saLocalSocketAddr;
-                       sSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); 
//sal_True);
-                       sSocket.bind( saBindSocketAddr );//build an error 
"osl_Socket_E_AddrNotAvail"
-                       oslSocketError seBind = sSocket.getError( );
-                       sSocket.clearError( );
-
-                       CPPUNIT_ASSERT_MESSAGE( "test for clearError function: 
trick an error called sSocket.getError( ), and then clear the error states, 
check the result.",
-                                                                       
osl_Socket_E_None == sSocket.getError( ) && seBind != osl_Socket_E_None  );
-               }
-
-
-               CPPUNIT_TEST_SUITE( clearError );
-               CPPUNIT_TEST( clearError_001 );
-               CPPUNIT_TEST_SUITE_END();
-
        }; // class clearError
 
+    TEST_F(clearError, clearError_001)
+    {
+        ::osl::Socket sSocket(sHandle);
+        ::osl::SocketAddr saBindSocketAddr( 
rtl::OUString::createFromAscii("123.45.67.89"), IP_PORT_HTTP2 );
+        ::osl::SocketAddr saLocalSocketAddr;
+        sSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); //sal_True);
+        sSocket.bind( saBindSocketAddr );//build an error 
"osl_Socket_E_AddrNotAvail"
+        oslSocketError seBind = sSocket.getError( );
+        sSocket.clearError( );
+
+        ASSERT_TRUE(osl_Socket_E_None == sSocket.getError( ) && seBind != 
osl_Socket_E_None) << "test for clearError function: trick an error called 
sSocket.getError( ), and then clear the error states, check the result.";
+    }
 
        /** testing the methods:
                inline oslSocketError getError() const;
                inline ::rtl::OUString getErrorAsString( ) const;
        */
-       class getError : public CppUnit::TestFixture
+       class getError : public ::testing::Test
        {
        public:
                oslSocket sHandle;
                // initialization
-               void setUp( )
+               void SetUp( )
                {
                        sHandle = osl_createSocket( osl_Socket_FamilyInet, 
osl_Socket_TypeStream, osl_Socket_ProtocolIp );
                }
 
-               void tearDown( )
+               void TearDown( )
                {
                        sHandle = NULL;
                }
+       }; // class getError
 
-
-               void getError_001()
-               {
-                       ::osl::Socket sSocket(sHandle);
-                       ::osl::SocketAddr saBindSocketAddr( 
rtl::OUString::createFromAscii("127.0.0.1"), IP_PORT_FTP );
-                       ::osl::SocketAddr saLocalSocketAddr;
-
-                       CPPUNIT_ASSERT_MESSAGE( "test for getError function: 
should get no error.",
-                                                                       
osl_Socket_E_None == sSocket.getError( )  );
-               }
-
-               void getError_002()
-               {
-                       ::osl::Socket sSocket(sHandle);
-                       ::osl::SocketAddr saBindSocketAddr( 
rtl::OUString::createFromAscii("123.45.67.89"), IP_PORT_FTP );
-                       ::osl::SocketAddr saLocalSocketAddr;
-                       sSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); 
//sal_True);
-                       sSocket.bind( saBindSocketAddr );//build an error 
"osl_Socket_E_AddrNotAvail"
-                       //on Solaris, the error no is EACCES, but it has no 
mapped value, so getError() returned osl_Socket_E_InvalidError.
+    TEST_F(getError, getError_001)
+    {
+        ::osl::Socket sSocket(sHandle);
+        ::osl::SocketAddr saBindSocketAddr( 
rtl::OUString::createFromAscii("127.0.0.1"), IP_PORT_FTP );
+        ::osl::SocketAddr saLocalSocketAddr;
+
+        ASSERT_TRUE(osl_Socket_E_None == sSocket.getError( )) << "test for 
getError function: should get no error.";
+    }
+
+    TEST_F(getError, getError_002)
+    {
+        ::osl::Socket sSocket(sHandle);
+        ::osl::SocketAddr saBindSocketAddr( 
rtl::OUString::createFromAscii("123.45.67.89"), IP_PORT_FTP );
+        ::osl::SocketAddr saLocalSocketAddr;
+        sSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); //sal_True);
+        sSocket.bind( saBindSocketAddr );//build an error 
"osl_Socket_E_AddrNotAvail"
+        //on Solaris, the error no is EACCES, but it has no mapped value, so 
getError() returned osl_Socket_E_InvalidError.
 #if defined(SOLARIS)
-                       CPPUNIT_ASSERT_MESSAGE( "trick an error called 
sSocket.getError( ), check the getError result.Failed on Solaris, returned 
osl_Socket_E_InvalidError because no entry to map the errno EACCES. ",
-                                                                       
osl_Socket_E_InvalidError == sSocket.getError( )  );
+        ASSERT_TRUE(osl_Socket_E_InvalidError == sSocket.getError( )) << 
"trick an error called sSocket.getError( ), check the getError result.Failed on 
Solaris, returned osl_Socket_E_InvalidError because no entry to map the errno 
EACCES. ";
 #else
-                       //while on Linux & Win32, the errno is EADDRNOTAVAIL, 
getError returned osl_Socket_E_AddrNotAvail.
+        //while on Linux & Win32, the errno is EADDRNOTAVAIL, getError 
returned osl_Socket_E_AddrNotAvail.
 
-                       CPPUNIT_ASSERT_MESSAGE( "trick an error called 
sSocket.getError( ), check the getError result.Failed on Solaris, returned 
osl_Socket_E_InvalidError because no entry to map the errno EACCES. Passed on 
Linux & Win32",
-                                                                       
osl_Socket_E_AddrNotAvail == sSocket.getError( )  );
+        ASSERT_TRUE(osl_Socket_E_AddrNotAvail == sSocket.getError( )) << 
"trick an error called sSocket.getError( ), check the getError result.Failed on 
Solaris, returned osl_Socket_E_InvalidError because no entry to map the errno 
EACCES. Passed on Linux & Win32";
 #endif
-               }
-
-               CPPUNIT_TEST_SUITE( getError );
-               CPPUNIT_TEST( getError_001 );
-               CPPUNIT_TEST( getError_002 );
-               CPPUNIT_TEST_SUITE_END();
-
-       }; // class getError
-
+    }
 
 
        /** testing the methods:
                inline oslSocket getHandle() const;
        */
 
-       class getHandle : public CppUnit::TestFixture
+       class getHandle : public ::testing::Test
        {
        public:
                oslSocket sHandle;
                // initialization
-               void setUp( )
+               void SetUp( )
                {
                        sHandle = osl_createSocket( osl_Socket_FamilyInet, 
osl_Socket_TypeStream, osl_Socket_ProtocolIp );
                }
 
-               void tearDown( )
+               void TearDown( )
                {
                        sHandle = NULL;
                }
-
-               void getHandle_001()
-               {
-                       ::osl::Socket sSocket(sHandle);
-                       ::osl::Socket assignSocket = sSocket.getHandle();
-
-                       CPPUNIT_ASSERT_MESSAGE( "test for 
operators_assignment_handle function: test the assignment operator.",
-                                                                       
osl_Socket_TypeStream == assignSocket.getType( )  );
-               }
-
-               void getHandle_002()
-               {
-                       ::osl::Socket sSocket( sHandle );
-                       ::osl::Socket assignSocket ( sSocket.getHandle( ) );
-
-                       CPPUNIT_ASSERT_MESSAGE( "test for operators_assignment 
function: assignment operator",
-                                                                       
osl_Socket_TypeStream == assignSocket.getType( ) );
-               }
-
-               CPPUNIT_TEST_SUITE( getHandle );
-               CPPUNIT_TEST( getHandle_001 );
-               CPPUNIT_TEST( getHandle_002 );
-               CPPUNIT_TEST_SUITE_END();
-
        }; // class getHandle
 
+    TEST_F(getHandle, getHandle_001)
+    {
+        ::osl::Socket sSocket(sHandle);
+        ::osl::Socket assignSocket = sSocket.getHandle();
+
+        ASSERT_TRUE(osl_Socket_TypeStream == assignSocket.getType( )) << "test 
for operators_assignment_handle function: test the assignment operator.";
+    }
+
+    TEST_F(getHandle, getHandle_002)
+    {
+        ::osl::Socket sSocket( sHandle );
+        ::osl::Socket assignSocket ( sSocket.getHandle( ) );
 
-// 
-----------------------------------------------------------------------------
-
+        ASSERT_TRUE(osl_Socket_TypeStream == assignSocket.getType( )) << "test 
for operators_assignment function: assignment operator";
+    }
 
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::ctors, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::operators, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::close, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::getLocalAddr, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::getLocalPort, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::getLocalHost, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::getPeer, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::bind, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::isRecvReady, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::isSendReady, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::getType, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::getOption, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::setOption, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::enableNonBlockingMode, 
"osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::isNonBlockingMode, 
"osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::clearError, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::getError, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::getHandle, "osl_Socket");
 
 } // namespace osl_Socket
 
-// 
-----------------------------------------------------------------------------
-
-// this macro creates an empty function, which will called by the 
RegisterAllFunctions()
-// to let the user the possibility to also register some functions by hand.
-NOADDITIONAL;
+int main(int argc, char **argv)
+{
+    ::testing::InitGoogleTest(&argc, argv);
+    return RUN_ALL_TESTS();
+}


Reply via email to