test_rpc.cpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. 
  2. #include "hello_test.h"
  3. TEST_F(HelloTest, rpcSyncGlobalCommunicator)
  4. {
  5. {
  6. shared_ptr<Communicator> c = getCommunicator();
  7. transGlobalCommunicator([&](Communicator *comm){
  8. checkSync(comm);
  9. }, c.get());
  10. }
  11. TC_Common::sleep(10);
  12. }
  13. TEST_F(HelloTest, rpcSyncGlobalCommunicatorInCoroutine)
  14. {
  15. shared_ptr<Communicator> c = getCommunicator();
  16. transInCoroutineGlobalCommunicator([&](Communicator *comm){
  17. checkSync(comm);
  18. }, c.get());
  19. }
  20. TEST_F(HelloTest, rpcSyncServerCommunicator)
  21. {
  22. transServerCommunicator([&](Communicator *comm){
  23. checkSync(comm);
  24. });
  25. }
  26. TEST_F(HelloTest, rpcSyncServerCommunicatorInCoroutine)
  27. {
  28. transInCoroutineServerCommunicator([&](Communicator *comm){
  29. checkSync(comm);
  30. });
  31. }
  32. TEST_F(HelloTest, rpcSyncAllocCommunicator)
  33. {
  34. transAllocCommunicator([&](Communicator *comm){
  35. checkSync(comm);
  36. });
  37. }
  38. TEST_F(HelloTest, rpcSyncAllocCommunicatorInCoroutine)
  39. {
  40. transInCoroutineAllocCommunicator([&](Communicator *comm){
  41. checkSync(comm);
  42. });
  43. }
  44. TEST_F(HelloTest, rpcSyncComplexCommunicator)
  45. {
  46. shared_ptr<Communicator> c = getCommunicator();
  47. transComplexCommunicator([&](Communicator *comm){
  48. checkSync(comm);
  49. }, c.get());
  50. transComplexCommunicator([&](Communicator *comm){
  51. checkSync(comm);
  52. }, c.get());
  53. transComplexCommunicator([&](Communicator *comm){
  54. checkSync(comm);
  55. }, c.get());
  56. transComplexCommunicator([&](Communicator *comm){
  57. checkSync(comm);
  58. }, c.get());
  59. }
  60. TEST_F(HelloTest, rpcSyncComplexCommunicatorInCoroutine)
  61. {
  62. shared_ptr<Communicator> c = getCommunicator();
  63. transInCoroutineComplexCommunicator([&](Communicator *comm){
  64. checkSync(comm);
  65. }, c.get());
  66. transInCoroutineComplexCommunicator([&](Communicator *comm){
  67. checkSync(comm);
  68. }, c.get());
  69. transInCoroutineComplexCommunicator([&](Communicator *comm){
  70. checkSync(comm);
  71. }, c.get());
  72. transInCoroutineComplexCommunicator([&](Communicator *comm){
  73. checkSync(comm);
  74. }, c.get());
  75. }
  76. TEST_F(HelloTest, rpcSyncIpV6GlobalCommunicator)
  77. {
  78. shared_ptr<Communicator> c = getCommunicator();
  79. transGlobalCommunicator([&](Communicator *comm){
  80. checkSync(comm, "Ipv6Adapter");
  81. }, c.get());
  82. }
  83. TEST_F(HelloTest, rpcSyncIpV6GlobalCommunicatorInCoroutine)
  84. {
  85. shared_ptr<Communicator> c = getCommunicator();
  86. transInCoroutineGlobalCommunicator([&](Communicator *comm){
  87. checkSync(comm, "Ipv6Adapter");
  88. }, c.get());
  89. }