00001
00002
00003
00004 #if !defined(TestTreePopulation_H)
00005 #define TestTreePopulation_H
00006
00007
00008 #include <cppunit/TestFixture.h>
00009 #include <cppunit/TestCaller.h>
00010 #include <cppunit/TestSuite.h>
00011
00012 class clSimManager;
00013 class clTreePopulation;
00014 class clTree;
00015 class clTreeSearch;
00016
00021 class clTestTreePopulation : public CppUnit::TestFixture
00022 {
00023 public:
00024
00028 void TestTreePopulation();
00029
00030 protected:
00031
00036 class clFakeLinkedList {
00037 public:
00038 clTree *prev,
00039 *thisTree,
00040 *next;
00041 clFakeLinkedList *prevLink,
00042 *nextLink;
00047 clFakeLinkedList(clTree *p_tree) {prev = NULL; thisTree = p_tree;
00048 next = NULL; prevLink = NULL; nextLink = NULL;};
00049 };
00050
00054 struct treeResults {
00055 clTree* p_oTree;
00056 short int iFoundFlag;
00058 bool bShouldBe;
00059 };
00060
00070 void TestKillTree(clSimManager *p_oSimManager);
00071
00077 void TestGetters(clSimManager *p_oSimManager);
00078
00087 void TestSnagAges(clSimManager *p_oSimManager);
00088
00100 void TestHashTable(clSimManager *p_oSimManager);
00101
00110 void TestHashTableNoAllomUpdate(clSimManager *p_oSimManager);
00111
00123 void TestTreeSearching(clSimManager *p_oSimManager);
00124
00135 void CheckHashTable(clTreePopulation *p_oPop, clTree ****p_oShortestHD,
00136 clTree ****p_oTallestHD, clFakeLinkedList ***p_oShort,
00137 clFakeLinkedList ***p_oTall, int iNumXCells, int iNumYCells);
00138
00154 void LoadTrees1(clTreePopulation *p_oPop, clTree ****p_oShortestHD,
00155 clTree ****p_oTallestHD, clFakeLinkedList ***p_oShort,
00156 clFakeLinkedList ***p_oTall, clTree **p_oTreeSet, int iNumXCells, int iNumYCells, bool bFullCheck,
00157 bool bUpdateHashTable);
00158
00167 void LoadTrees2(clTreePopulation *p_oPop, clTree **p_oTreeSet, bool bFullCheck);
00168
00169
00179 void EmptyFakeHashTable(clTree ****p_oShortestHD, clTree ****p_oTallestHD,
00180 clFakeLinkedList ***p_oShort, clFakeLinkedList ***p_oTall, int iNumXCells,
00181 int iNumYCells);
00182
00186 void DoSet1Searches(clTreePopulation *p_oPop, clTree **p_oTreeSet);
00190 void DoSet2Searches(clTreePopulation *p_oPop, clTree **p_oTreeSet);
00194 void DoSet3Searches(clTreePopulation *p_oPop);
00195
00209 void CheckTreeSearch(struct treeResults *p_expected,
00210 short int iNumResults, clTreeSearch *p_oActual, clTree *p_oFirstTree);
00211
00227 void UpdateHashTableTrees(clTreePopulation * p_oPop, clTree * * * * p_oShortestHD, clTree * * * * p_oTallestHD,
00228 clFakeLinkedList * * * p_oShort, clFakeLinkedList * * * p_oTall, clTree * * p_oTreeSet, int iNumXCells, int iNumYCells, bool bFullCheck,
00229 bool bUpdateNow, bool bUpdateAllometry);
00230
00243 void DeleteHashTableTrees(clTreePopulation * p_oPop, clTree * * * * p_oShortestHD,
00244 clTree * * * * p_oTallestHD, clFakeLinkedList * * * p_oShort, clFakeLinkedList * * * p_oTall, clTree * * p_oTreeSet,
00245 int iNumXCells, int iNumYCells);
00246
00257 char * WriteXMLFile1();
00258
00268 char * WriteXMLFile2();
00269
00280 char * WriteXMLFile3();
00281
00292 char * WriteXMLFile4();
00293
00305 char * WriteXMLFile5();
00306
00307 };
00308
00309 #endif // TestTreePopulation_H