From 822b1b345c598976530c541d0b890b6d645aa1fc Mon Sep 17 00:00:00 2001 From: "HuYingzhuo(hugo/hyzboy)" Date: Tue, 19 Sep 2023 18:16:58 +0800 Subject: [PATCH] added ActiveDataManagerTest.cpp --- CMakeLists.txt | 17 ++-- datatype/ActiveDataManagerTest.cpp | 118 ++++++++++++++++++++++ datatype/ActiveMemoryBlockManagerTest.cpp | 4 +- 3 files changed, 131 insertions(+), 8 deletions(-) create mode 100644 datatype/ActiveDataManagerTest.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index d785feb..be32316 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,17 +67,22 @@ set_example_project_folder("DataType/DataArray" QueueTest) add_executable(PoolTest datatype/PoolTest.cpp) set_example_project_folder("DataType/DataArray" PoolTest) -add_executable(ActiveIDManagerTest datatype/ActiveIDManagerTest.cpp) -cm_example_project("DataType/DataArray" ActiveIDManagerTest) - -add_executable(ActiveDataManagerTest datatype/ActiveDataManagerTest.cpp) -cm_example_project("DataType/DataArray" ActiveDataManagerTest) - add_executable(MapTest datatype/MapTest.cpp) set_example_project_folder("DataType/DataArray" MapTest) #################################################################################################### +add_executable(1_ActiveIDManagerTest datatype/ActiveIDManagerTest.cpp) +cm_example_project("DataType/ActiveManager" 1_ActiveIDManagerTest) + +add_executable(2_ActiveMemoryBlockManagerTest datatype/ActiveMemoryBlockManagerTest.cpp) +cm_example_project("DataType/ActiveManager" 2_ActiveMemoryBlockManagerTest) + +add_executable(3_ActiveDataManagerTest datatype/ActiveDataManagerTest.cpp) +cm_example_project("DataType/ActiveManager" 3_ActiveDataManagerTest) + +#################################################################################################### + add_executable(FixFilenameTest filesystem/FixFilenameTest.cpp) cm_example_project("File System" FixFilenameTest) diff --git a/datatype/ActiveDataManagerTest.cpp b/datatype/ActiveDataManagerTest.cpp new file mode 100644 index 0000000..1a0793e --- /dev/null +++ b/datatype/ActiveDataManagerTest.cpp @@ -0,0 +1,118 @@ +#include +#include +#include"UserInfo.h" + +using namespace hgl; + +void DebugOutputArray(const char *hint,const int *id,const int count) +{ + cout<<"("<name; + ++p; + } + + cout<<']'; +} + +void DebugOutputArray(const char *hint,ActiveDataManager &adm,const int *idp,const int count) +{ + if(!idp||count<=0)return; + + UserInfo **ui=new UserInfo *[count]; + + adm.GetData(ui,idp,count); + + DebugOutputArray(hint,ui,count); + + delete[] ui; +} + +void DebugOutputArray(const char *hint,ActiveDataManager &adm,const DataArray &da) +{ + DebugOutputArray(hint,adm,da.GetData(),da.GetCount()); +} + +void DebugADMOutput(const char *hint,ActiveDataManager &adm) +{ + cout< &adm,const int *idp,const int count,const int start) +{ + for(int i=0;i adm; + + adm.Alloc(10); + + int start=0; + + int id0[5]; + adm.CreateIdle(id0,5); + WriteUserinfoToADM(adm,id0,5,start);start+=5; + DebugADMOutput("CreateIdle(5)",adm); + std::cout<