Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #ifndef TEST_H
  2. #define TEST_H
  3. #include <QObject>
  4. #include <QCoreApplication>
  5. #include <QPair>
  6. #include "ptserver.h"
  7. #include "ptsocket.h"
  8. #include <QDebug>
  9. #define ASSERT_LISTEN Q_ASSERT(m_serv->isListening())
  10. typedef QPair<int, PTSocket::State> TestState;
  11. class Test : public QObject
  12. {
  13. Q_OBJECT
  14. public:
  15. explicit Test(QObject *parent = 0);
  16. public slots:
  17. void testListen(quint16 p);
  18. void test0IntConvert();
  19. void test1Basic();
  20. void test2Ping();
  21. void test3Handshake();
  22. void test4HandshakeFake1();
  23. void test5HandshakeFake2();
  24. void test6Error1();
  25. void test7Error2();
  26. private slots:
  27. void timeout(int i = 15000);
  28. void stopTimeout();
  29. void timedout();
  30. void m_clientStateChangedTest(PTSocket::State s);
  31. void m_newClientTest(PTSocket* s);
  32. void preTest();
  33. void m_newClient1(PTSocket* s);
  34. void m_clientStateChanged1(PTSocket::State s);
  35. void m_newClient2(PTSocket* s);
  36. void m_clientStateChanged2(PTSocket::State s);
  37. void m_newClient3(PTSocket* s);
  38. void m_clientStateChanged3(PTSocket::State s);
  39. void m_newClient4(PTSocket* s);
  40. void m_clientStateChanged4(PTSocket::State s);
  41. void m_newClient5(PTSocket* s);
  42. void m_clientStateChanged5(PTSocket::State s);
  43. private:
  44. PTSocket* newSocket();
  45. QTimer m_timeoutTimer;
  46. PTServer* m_serv;
  47. QMap<PTSocket*, int> m_socketsIds;
  48. QList<QList<TestState> > m_testsStates;
  49. int m_currentTest;
  50. int m_currentState;
  51. };
  52. bool operator ==(TestState t1, TestState t2);
  53. bool operator !=(TestState t1, TestState t2);
  54. QDebug operator <<(QDebug dbg, TestState t);
  55. #endif // TEST_H