S3PTestRole.cpp
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:5k
源码类别:

模拟服务器

开发平台:

C/C++

  1. // S3PTestRole.cpp: implementation of the S3PTestRole class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #include "S3PTestRole.h"
  5. #include "S3PRole.h"
  6. //////////////////////////////////////////////////////////////////////
  7. // Construction/Destruction
  8. //////////////////////////////////////////////////////////////////////
  9. S3PTestRole::~S3PTestRole()
  10. {
  11. }
  12. Test *S3PTestRole::suite ()
  13. {
  14. TestSuite *testSuite = new TestSuite ("Test Role");
  15. testSuite->addTest (new TestCaller <S3PTestRole> ("testLoad", testLoad));
  16. testSuite->addTest (new TestCaller <S3PTestRole> ("testAdd", testAdd));
  17.     
  18. return testSuite;
  19. }
  20. void S3PTestRole::testAdd()
  21. {
  22. S3PRole role("lwsdd");
  23. S3PTableObjList<S3PTask>* pTaskList = role.GetTaskList();
  24. for(int i=0; i<pTaskList->Size(); i++)
  25. {
  26. ColumnAndValue cav = (*pTaskList)[i]->GetProperties();
  27. printf("task_list itaskcode: %srn", cav["itaskcode"].c_str());
  28. printf("task_list cUserCode: %srn", cav["cusercode"].c_str());
  29. }
  30. S3PTableObjList<S3PFriend>* pFriendList = role.GetFriendList();
  31. assert(pFriendList);
  32. //ColumnAndValue cav;
  33. //cav["cFriendCode"] = "lws123";
  34. //pFriendList->Add(cav);
  35. for(i=0; i<pFriendList->Size(); i++)
  36. {
  37. ColumnAndValue cav = (*pFriendList)[i]->GetProperties();
  38. printf("cusercode :  %srn", cav["cusercode"].c_str());
  39. printf("cfriendcode :  %srn", cav["cfriendcode"].c_str());
  40. }
  41. S3PTableObjList<S3PFightSkill>* pFightSkillList = role.GetFightSkillList();
  42. assert(pFightSkillList);
  43. //ColumnAndValue cav;
  44. //cav["iFightSkill"] = "12";
  45. //cav["iFightSkillLevel"] = "1111";
  46. //pFightSkillList->Add(cav);
  47. for(i=0; i<pFightSkillList->Size(); i++)
  48. {
  49. ColumnAndValue cav = (*pFightSkillList)[i]->GetProperties();
  50. printf("cusercode :  %srn", cav["cusercode"].c_str());
  51. printf("iFightSkill :  %srn", cav["ifightskill"].c_str());
  52. printf("iFightSkillLevel :  %srn", cav["ifightskilllevel"].c_str());
  53. }
  54. S3PTableObjList<S3PLifeSkill>* pLifeSkillList = role.GetLifeSkillList();
  55. assert(pLifeSkillList);
  56. //ColumnAndValue cav;
  57. //cav["iLifeSkill"] = "12";
  58. //cav["iLifeSkillLevel"] = "1111";
  59. //pLifeSkillList->Add(cav);
  60. for(i=0; i<pLifeSkillList->Size(); i++)
  61. {
  62. ColumnAndValue cav = (*pLifeSkillList)[i]->GetProperties();
  63. printf("cusercode :  %srn", cav["cusercode"].c_str());
  64. printf("iLifeSkill :  %srn", cav["ilifeskill"].c_str());
  65. printf("iLifeSkillLevel :  %srn", cav["ilifeskilllevel"].c_str());
  66. }
  67. S3PTableObjList<S3PEquipment> * pEquimentList = role.GetEquipmentList();
  68. assert(pEquimentList);
  69. ColumnAndValue cav;
  70. cav["iEquipCode"] = "111";
  71. pEquimentList->Add(cav);
  72. for(i=0; i<pEquimentList->Size(); i++)
  73. {
  74. ColumnAndValue cav = (*pEquimentList)[i]->GetProperties();
  75. printf("cusercode :  %srn", cav["cusercode"].c_str());
  76. printf("iEquipClassCode :  %srn", cav["iequipclasscode"].c_str());
  77. }
  78. S3PEquipment * pEquipment = (*pEquimentList)[0];
  79. assert(pEquipment);
  80. S3PTableObjList<S3PEquipRequireInfo> * pEquipRequireInfoList=pEquipment->GetEquipRequireInfoList();
  81. assert(pEquipRequireInfoList);
  82. ColumnAndValue cavERI;
  83. cavERI["iClass"]="123";
  84. cavERI["cInfoText"]="requireInfo";
  85. pEquipRequireInfoList->Add(cavERI);
  86. for(i=0; i<pEquipRequireInfoList->Size(); i++)
  87. {
  88. ColumnAndValue cav = (*pEquipRequireInfoList)[i]->GetProperties();
  89. printf("iMainID :  %srn", cav["imainid"].c_str());
  90. printf("iClass :  %srn", cav["iclass"].c_str());
  91. printf("cInfoText :  %srn", cav["cinfotext"].c_str());
  92. }
  93. S3PTableObjList<S3PEquipBaseInfo> * pEquipBaseInfoList=pEquipment->GetEquipBaseInfoList();
  94. assert(pEquipBaseInfoList);
  95. ColumnAndValue cavEBI;
  96. cavEBI["iClass"]="123";
  97. cavEBI["cInfoText"]="baseInfo";
  98. pEquipBaseInfoList->Add(cavEBI);
  99. for(i=0; i<pEquipBaseInfoList->Size(); i++)
  100. {
  101. ColumnAndValue cav = (*pEquipBaseInfoList)[i]->GetProperties();
  102. printf("iMainID :  %srn", cav["imainid"].c_str());
  103. printf("iClass :  %srn", cav["iclass"].c_str());
  104. printf("cInfoText :  %srn", cav["cinfotext"].c_str());
  105. }
  106. S3PTableObjList<S3PEquipEfficInfo> * pEquipEfficInfoList=pEquipment->GetEquipEfficInfoList();
  107. assert(pEquipEfficInfoList);
  108. ColumnAndValue cavEEI;
  109. cavEEI["iClass"]="123";
  110. cavEEI["cInfoText"]="EfficInfo";
  111. pEquipEfficInfoList->Add(cavEEI);
  112. for(i=0; i<pEquipEfficInfoList->Size(); i++)
  113. {
  114. ColumnAndValue cav = (*pEquipEfficInfoList)[i]->GetProperties();
  115. printf("iMainID :  %srn", cav["imainid"].c_str());
  116. printf("iClass :  %srn", cav["iclass"].c_str());
  117. printf("cInfoText :  %srn", cav["cinfotext"].c_str());
  118. }
  119. }
  120. void S3PTestRole::testLoad()
  121. {
  122. S3PRole role("lws123");
  123. ColumnAndValue cav = role.GetProperties();
  124. cout << "bSex:" << cav["bsex"].c_str() <<endl;
  125. }