#ifndef TEST_H #define TEST_H #include #include #include #include "ptserver.h" #include "ptsocket.h" #include #define ASSERT_LISTEN Q_ASSERT(m_serv->isListening()) typedef QPair TestState; class Test : public QObject { Q_OBJECT public: explicit Test(QObject *parent = 0); public slots: void testListen(quint16 p); void test0IntConvert(); void test1Basic(); void test2Ping(); void test3Handshake(); void test4HandshakeFake1(); void test5HandshakeFake2(); private slots: void timeout(int i = 15000); void stopTimeout(); void timedout(); void m_clientStateChangedTest(PTSocket::State s); void m_newClientTest(PTSocket* s); void preTest(); void m_newClient1(PTSocket* s); void m_clientStateChanged1(PTSocket::State s); void m_newClient2(PTSocket* s); void m_clientStateChanged2(PTSocket::State s); void m_newClient3(PTSocket* s); void m_clientStateChanged3(PTSocket::State s); void m_newClient4(PTSocket* s); void m_clientStateChanged4(PTSocket::State s); void m_newClient5(PTSocket* s); void m_clientStateChanged5(PTSocket::State s); private: PTSocket* newSocket(); QTimer m_timeoutTimer; PTServer* m_serv; QMap m_socketsIds; QList > m_testsStates; int m_currentTest; int m_currentState; }; bool operator ==(TestState t1, TestState t2); bool operator !=(TestState t1, TestState t2); QDebug operator <<(QDebug dbg, TestState t); #endif // TEST_H