run tests several times with different socket flags
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54593 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -106,19 +106,29 @@ public:
|
|||||||
virtual void setUp();
|
virtual void setUp();
|
||||||
virtual void tearDown();
|
virtual void tearDown();
|
||||||
|
|
||||||
CPPUNIT_TEST_SUITE(socketStream);
|
// repeat all socket tests several times with different socket flags, so we
|
||||||
// Base class stream tests the socketStream supports.
|
// define this macro which is used several times in the test suite
|
||||||
CPPUNIT_TEST(Input_GetC);
|
//
|
||||||
CPPUNIT_TEST(Input_Eof);
|
// there must be some more elegant way to do this but I didn't find it...
|
||||||
CPPUNIT_TEST(Input_Read);
|
#define ALL_SOCKET_TESTS() \
|
||||||
CPPUNIT_TEST(Input_LastRead);
|
CPPUNIT_TEST(Input_GetC); \
|
||||||
CPPUNIT_TEST(Input_CanRead);
|
CPPUNIT_TEST(Input_Eof); \
|
||||||
CPPUNIT_TEST(Input_Peek);
|
CPPUNIT_TEST(Input_Read); \
|
||||||
CPPUNIT_TEST(Input_Ungetch);
|
CPPUNIT_TEST(Input_LastRead); \
|
||||||
|
CPPUNIT_TEST(Input_CanRead); \
|
||||||
|
CPPUNIT_TEST(Input_Peek); \
|
||||||
|
CPPUNIT_TEST(Input_Ungetch); \
|
||||||
|
\
|
||||||
|
CPPUNIT_TEST(Output_PutC); \
|
||||||
|
CPPUNIT_TEST(Output_Write); \
|
||||||
|
CPPUNIT_TEST(Output_LastWrite)
|
||||||
|
|
||||||
CPPUNIT_TEST(Output_PutC);
|
CPPUNIT_TEST_SUITE(socketStream);
|
||||||
CPPUNIT_TEST(Output_Write);
|
ALL_SOCKET_TESTS();
|
||||||
CPPUNIT_TEST(Output_LastWrite);
|
CPPUNIT_TEST( PseudoTest_SetNoWait );
|
||||||
|
ALL_SOCKET_TESTS();
|
||||||
|
CPPUNIT_TEST( PseudoTest_SetWaitAll );
|
||||||
|
ALL_SOCKET_TESTS();
|
||||||
CPPUNIT_TEST_SUITE_END();
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -139,10 +149,15 @@ private:
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PseudoTest_SetNoWait() { m_flags = wxSOCKET_NOWAIT; }
|
||||||
|
void PseudoTest_SetWaitAll() { m_flags = wxSOCKET_WAITALL; }
|
||||||
|
|
||||||
wxSocketClient *m_readSocket,
|
wxSocketClient *m_readSocket,
|
||||||
*m_writeSocket;
|
*m_writeSocket;
|
||||||
wxThread *m_writeThread,
|
wxThread *m_writeThread,
|
||||||
*m_readThread;
|
*m_readThread;
|
||||||
|
|
||||||
|
wxSocketFlags m_flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
socketStream::socketStream()
|
socketStream::socketStream()
|
||||||
@@ -153,6 +168,8 @@ socketStream::socketStream()
|
|||||||
m_writeThread =
|
m_writeThread =
|
||||||
m_readThread = NULL;
|
m_readThread = NULL;
|
||||||
|
|
||||||
|
m_flags = wxSOCKET_NONE;
|
||||||
|
|
||||||
wxSocketBase::Initialize();
|
wxSocketBase::Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,12 +194,10 @@ void socketStream::setUp()
|
|||||||
CPPUNIT_ASSERT_EQUAL( wxCOND_NO_ERROR, gs_cond.Wait() );
|
CPPUNIT_ASSERT_EQUAL( wxCOND_NO_ERROR, gs_cond.Wait() );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_readSocket = new wxSocketClient;
|
m_readSocket = new wxSocketClient(m_flags);
|
||||||
m_readSocket->SetTimeout(3);
|
|
||||||
CPPUNIT_ASSERT( m_readSocket->Connect(LocalAddress(TEST_PORT_READ)) );
|
CPPUNIT_ASSERT( m_readSocket->Connect(LocalAddress(TEST_PORT_READ)) );
|
||||||
|
|
||||||
m_writeSocket = new wxSocketClient;
|
m_writeSocket = new wxSocketClient(m_flags);
|
||||||
m_writeSocket->SetTimeout(3);
|
|
||||||
CPPUNIT_ASSERT( m_writeSocket->Connect(LocalAddress(TEST_PORT_WRITE)) );
|
CPPUNIT_ASSERT( m_writeSocket->Connect(LocalAddress(TEST_PORT_WRITE)) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user