123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- #ifndef TEST_H
- #define TEST_H
-
- #include <QObject>
- #include <QCoreApplication>
- #include <QPair>
- #include "ptserver.h"
- #include "ptsocket.h"
- #include <QDebug>
-
- #define ASSERT_LISTEN Q_ASSERT(m_serv->isListening())
-
- typedef QPair<int, PTSocket::State> 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();
- void test6Error1();
- void test7Error2();
-
- 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<PTSocket*, int> m_socketsIds;
- QList<QList<TestState> > 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
|