test.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /* Copyright (C) 2014 Mamadou DIOP.
  2. *
  3. * This file is part of Open Source Doubango Framework.
  4. *
  5. * DOUBANGO is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * DOUBANGO is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with DOUBANGO.
  17. *
  18. */
  19. #include "stdafx.h"
  20. #define BAIL_IF_ERR(expr) { int _ret_; if ((_ret_) = (expr)) { TSK_DEBUG_ERROR("Error %d", (_ret_)); goto bail; } }
  21. #include "tsk.h"
  22. #include "tinynet.h"
  23. #include "test_sockets.h"
  24. #include "test_transport.h"
  25. #include "test_auth.h"
  26. #include "test_stun.h"
  27. #include "test_nat.h"
  28. #include "test_ifaces.h"
  29. #include "test_dns.h"
  30. #include "test_ice.h"
  31. #include "test_dhcp.h"
  32. #include "test_dhcp6.h"
  33. #include "test_tls.h"
  34. #define RUN_TEST_LOOP 0
  35. #define RUN_TEST_ALL 0
  36. #define RUN_TEST_SOCKETS 0 /* FIXME: Android */
  37. #define RUN_TEST_TRANSPORT 0
  38. #define RUN_TEST_AUTH 0
  39. #define RUN_TEST_STUN 0
  40. #define RUN_TEST_ICE 1
  41. #define RUN_TEST_NAT 0
  42. #define RUN_TEST_IFACES 0
  43. #define RUN_TEST_DNS 0
  44. #define RUN_TEST_DHCP 0
  45. #define RUN_TEST_DHCP6 0
  46. #define RUN_TEST_TLS 0
  47. #ifdef _WIN32_WCE
  48. int _tmain(int argc, _TCHAR* argv[])
  49. #else
  50. int main()
  51. #endif
  52. {
  53. /* Startup the network stack. */
  54. if(tnet_startup()) {
  55. return -1;
  56. }
  57. #if RUN_TEST_LOOP
  58. for(;;)
  59. #endif
  60. {
  61. #if RUN_TEST_ALL || RUN_TEST_SOCKETS
  62. test_sockets();
  63. #endif
  64. #if RUN_TEST_ALL || RUN_TEST_TRANSPORT
  65. test_transport();
  66. #endif
  67. #if RUN_TEST_ALL || RUN_TEST_AUTH
  68. test_auth();
  69. #endif
  70. #if RUN_TEST_ALL || RUN_TEST_STUN
  71. test_stun();
  72. #endif
  73. #if RUN_TEST_ALL || RUN_TEST_ICE
  74. test_ice();
  75. #endif
  76. #if RUN_TEST_ALL || RUN_TEST_NAT
  77. test_nat();
  78. #endif
  79. #if RUN_TEST_ALL || RUN_TEST_IFACES
  80. test_ifaces();
  81. #endif
  82. #if RUN_TEST_ALL || RUN_TEST_DNS
  83. test_dns();
  84. #endif
  85. #if RUN_TEST_ALL || RUN_TEST_DHCP
  86. test_dhcp();
  87. #endif
  88. #if RUN_TEST_ALL || RUN_TEST_DHCP6
  89. test_dhcp6();
  90. #endif
  91. #if RUN_TEST_ALL || RUN_TEST_TLS
  92. test_tls();
  93. #endif
  94. }
  95. /* Cleanup the network stack */
  96. tnet_cleanup();
  97. return 0;
  98. }