#include <TestTreePopulation.h>
Public Member Functions | |
void | TestTreePopulation () |
Combines all the tests for testing the tree population. | |
Protected Member Functions | |
void | TestKillTree (clSimManager *p_oSimManager) |
Tests tree killing. | |
void | TestGetters (clSimManager *p_oSimManager) |
Tests tree population getter functions. | |
void | TestSnagAges (clSimManager *p_oSimManager) |
This tests the snag age updating. | |
void | TestHashTable (clSimManager *p_oSimManager) |
Tests hash table loading and organization. | |
void | TestHashTableNoAllomUpdate (clSimManager *p_oSimManager) |
Does the same tests as TestHashTable, but does it with no updates and no automatic allometry updating. | |
void | TestTreeSearching (clSimManager *p_oSimManager) |
Tests tree searching. | |
void | CheckHashTable (clTreePopulation *p_oPop, clTree ****p_oShortestHD, clTree ****p_oTallestHD, clFakeLinkedList ***p_oShort, clFakeLinkedList ***p_oTall, int iNumXCells, int iNumYCells) |
Checks the real hash table against the predicted results. | |
void | LoadTrees1 (clTreePopulation *p_oPop, clTree ****p_oShortestHD, clTree ****p_oTallestHD, clFakeLinkedList ***p_oShort, clFakeLinkedList ***p_oTall, clTree **p_oTreeSet, int iNumXCells, int iNumYCells, bool bFullCheck, bool bUpdateHashTable) |
Loads the first set of trees for hash table checking. | |
void | LoadTrees2 (clTreePopulation *p_oPop, clTree **p_oTreeSet, bool bFullCheck) |
Loads the first set of trees for hash table checking. | |
void | EmptyFakeHashTable (clTree ****p_oShortestHD, clTree ****p_oTallestHD, clFakeLinkedList ***p_oShort, clFakeLinkedList ***p_oTall, int iNumXCells, int iNumYCells) |
Cleans up memory for CheckHashTable. | |
void | DoSet1Searches (clTreePopulation *p_oPop, clTree **p_oTreeSet) |
Performs the first set of tree search tests. | |
void | DoSet2Searches (clTreePopulation *p_oPop, clTree **p_oTreeSet) |
Performs the second set of tree search tests. | |
void | DoSet3Searches (clTreePopulation *p_oPop) |
Performs the third set of tree search tests. | |
void | CheckTreeSearch (struct treeResults *p_expected, short int iNumResults, clTreeSearch *p_oActual, clTree *p_oFirstTree) |
Checks the tree results against a list of expected results. | |
void | UpdateHashTableTrees (clTreePopulation *p_oPop, clTree ****p_oShortestHD, clTree ****p_oTallestHD, clFakeLinkedList ***p_oShort, clFakeLinkedList ***p_oTall, clTree **p_oTreeSet, int iNumXCells, int iNumYCells, bool bFullCheck, bool bUpdateNow, bool bUpdateAllometry) |
Performs updates of the tree set to make sure the hash table is updated correctly. | |
void | DeleteHashTableTrees (clTreePopulation *p_oPop, clTree ****p_oShortestHD, clTree ****p_oTallestHD, clFakeLinkedList ***p_oShort, clFakeLinkedList ***p_oTall, clTree **p_oTreeSet, int iNumXCells, int iNumYCells) |
Deletes the set of trees in a certain order to make sure the hash table is updated correctly. | |
char * | WriteXMLFile1 () |
Writes a parameter file for testing. | |
char * | WriteXMLFile2 () |
Writes a parameter file for testing. | |
char * | WriteXMLFile3 () |
Writes a parameter file for testing. | |
char * | WriteXMLFile4 () |
Writes a parameter file for testing. | |
char * | WriteXMLFile5 () |
Writes a parameter file for testing. | |
Classes | |
class | clFakeLinkedList |
This is for making a fake linked list. More... | |
struct | treeResults |
This structure is for testing tree results - arrays of this struct can tell, for a given list of trees, which should be found, and which actually were. More... |
The test script guiding the test is Population Test.xls.
void clTestTreePopulation::CheckHashTable | ( | clTreePopulation * | p_oPop, | |
clTree **** | p_oShortestHD, | |||
clTree **** | p_oTallestHD, | |||
clFakeLinkedList *** | p_oShort, | |||
clFakeLinkedList *** | p_oTall, | |||
int | iNumXCells, | |||
int | iNumYCells | |||
) | [protected] |
Checks the real hash table against the predicted results.
p_oPop | Pointer to tree population. | |
p_oShortestHD | Shortest links | |
p_oTallestHD | Tallest links | |
p_oShort | Fake shortest hash table. | |
p_oTall | Fake tallest hash table. | |
iNumXCells | Number population X cells. | |
iNumYCells | Number population Y cells. |
void clTestTreePopulation::CheckTreeSearch | ( | struct treeResults * | p_expected, | |
short int | iNumResults, | |||
clTreeSearch * | p_oActual, | |||
clTree * | p_oFirstTree | |||
) | [protected] |
Checks the tree results against a list of expected results.
This will check for trees not found that should be found, trees that are found which should not be found, and trees found multiple times. This will also make sure that tree searches can handle continued calls to NextTree() after NULL-ing without choking. Results are directed to the log file.
p_expected | Array of treeResults which shows expected values. There can be trees in this list that are not expected to be found. | |
iNumResults | Number of elements in p_expected array. | |
p_oActual | Tree search object to test. | |
p_oFirstTree | The expected first tree found. |
void clTestTreePopulation::DeleteHashTableTrees | ( | clTreePopulation * | p_oPop, | |
clTree **** | p_oShortestHD, | |||
clTree **** | p_oTallestHD, | |||
clFakeLinkedList *** | p_oShort, | |||
clFakeLinkedList *** | p_oTall, | |||
clTree ** | p_oTreeSet, | |||
int | iNumXCells, | |||
int | iNumYCells | |||
) | [protected] |
Deletes the set of trees in a certain order to make sure the hash table is updated correctly.
p_oPop | Pointer to tree population object | |
p_oShortestHD | Shortest links | |
p_oTallestHD | Tallest links | |
p_oShort | Fake shortest hash table. | |
p_oTall | Fake tallest hash table. | |
iNumXCells | Number population X cells. | |
iNumYCells | Number population Y cells. | |
p_oTreeSet | The set of trees |
void clTestTreePopulation::EmptyFakeHashTable | ( | clTree **** | p_oShortestHD, | |
clTree **** | p_oTallestHD, | |||
clFakeLinkedList *** | p_oShort, | |||
clFakeLinkedList *** | p_oTall, | |||
int | iNumXCells, | |||
int | iNumYCells | |||
) | [protected] |
Cleans up memory for CheckHashTable.
p_oShortestHD | Shortest links | |
p_oTallestHD | Tallest links | |
p_oShort | Fake shortest hash table. | |
p_oTall | Fake tallest hash table. | |
iNumXCells | Number population X cells. | |
iNumYCells | Number population Y cells. |
void clTestTreePopulation::LoadTrees1 | ( | clTreePopulation * | p_oPop, | |
clTree **** | p_oShortestHD, | |||
clTree **** | p_oTallestHD, | |||
clFakeLinkedList *** | p_oShort, | |||
clFakeLinkedList *** | p_oTall, | |||
clTree ** | p_oTreeSet, | |||
int | iNumXCells, | |||
int | iNumYCells, | |||
bool | bFullCheck, | |||
bool | bUpdateHashTable | |||
) | [protected] |
Loads the first set of trees for hash table checking.
p_oPop | Pointer to tree population. | |
p_oShortestHD | Shortest links | |
p_oTallestHD | Tallest links | |
p_oShort | Fake shortest hash table. | |
p_oTall | Fake tallest hash table. | |
iNumXCells | Number population X cells. | |
iNumYCells | Number population Y cells. | |
p_oTreeSet | The set of trees to create | |
bFullCheck | If true, the function checks the hash table after each tree is created to make sure it is correct. | |
bUpdateHashTable | If true, this creates the fake hash table and keeps it updated. |
void clTestTreePopulation::LoadTrees2 | ( | clTreePopulation * | p_oPop, | |
clTree ** | p_oTreeSet, | |||
bool | bFullCheck | |||
) | [protected] |
Loads the first set of trees for hash table checking.
p_oPop | Pointer to tree population. | |
p_oTreeSet | The set of trees to create | |
bFullCheck | If true, the function checks the hash table after each tree is created to make sure it is correct. |
void clTestTreePopulation::TestGetters | ( | clSimManager * | p_oSimManager | ) | [protected] |
Tests tree population getter functions.
WriteXMLFile1() is used to load a file.
p_oSimManager | Sim Manager object. |
void clTestTreePopulation::TestHashTable | ( | clSimManager * | p_oSimManager | ) | [protected] |
Tests hash table loading and organization.
Particular sets of trees are created and hard-coded into a hash table in the correct sort. This test hash table is then compared to the real hash table to see if they match. The set of trees has been chosen to test the hash table sorting as much as possible.
WriteXMLFile1() is used to load a file. This function is structured the way it is because it was ported from other code.
p_oSimManager | Sim Manager object. |
void clTestTreePopulation::TestHashTableNoAllomUpdate | ( | clSimManager * | p_oSimManager | ) | [protected] |
Does the same tests as TestHashTable, but does it with no updates and no automatic allometry updating.
WriteXMLFile1() is used to load a file. This function is structured the way it is because it was ported from other code.
p_oSimManager | Sim Manager object. |
void clTestTreePopulation::TestKillTree | ( | clSimManager * | p_oSimManager | ) | [protected] |
Tests tree killing.
To test to make sure snags are correctly created, WriteXMLFile3() is used to load a file. Seedlings, saplings, adults, and snags with all dead reasons are fed to KillTree() to make sure that the right thing happens. Then, to make sure snags aren't created when they aren't wanted, WriteXMLFile4() is used to load a file and the same thing done to the trees.
p_oSimManager | Sim Manager object. |
void clTestTreePopulation::TestSnagAges | ( | clSimManager * | p_oSimManager | ) | [protected] |
This tests the snag age updating.
It uses WriteXMLFile4() to create a run where snags are supported. Two snags are created in the file. Another is created by the function. It is verified that the ages of all are 0. Then a timestep is run, and it is verified that the ages of all snags are 1. The process is repeated with WriteXMLFile5(), which does the same thing except with three years per timestep.
void clTestTreePopulation::TestTreeSearching | ( | clSimManager * | p_oSimManager | ) | [protected] |
Tests tree searching.
A known list of trees is loaded. Then the expected results of a search, hard-coded, are compared against the actual search returned. An array of trees has a place to count the number of trees each tree is found (this makes sure that trees are not returned multiple times). The hard-coded expected results indicates whether the tree should have been found or not. Then CheckTreeSearch validates the results of each search. WriteXMLFile2() is used to load a file. This is structured like it is because it was ported from other code.
p_oSimManager | Sim Manager object. |
void clTestTreePopulation::UpdateHashTableTrees | ( | clTreePopulation * | p_oPop, | |
clTree **** | p_oShortestHD, | |||
clTree **** | p_oTallestHD, | |||
clFakeLinkedList *** | p_oShort, | |||
clFakeLinkedList *** | p_oTall, | |||
clTree ** | p_oTreeSet, | |||
int | iNumXCells, | |||
int | iNumYCells, | |||
bool | bFullCheck, | |||
bool | bUpdateNow, | |||
bool | bUpdateAllometry | |||
) | [protected] |
Performs updates of the tree set to make sure the hash table is updated correctly.
p_oPop | Pointer to tree population object | |
p_oShortestHD | Shortest links | |
p_oTallestHD | Tallest links | |
p_oShort | Fake shortest hash table. | |
p_oTall | Fake tallest hash table. | |
iNumXCells | Number population X cells. | |
iNumYCells | Number population Y cells. | |
p_oTreeSet | The set of trees to create | |
bFullCheck | Whether to check the hash table after each update | |
bUpdateNow | Matches the trees' bUpdateNow argument | |
bUpdateAllometry | Matches the trees' bUpdateAllometry argument |
char* clTestTreePopulation::WriteXMLFile1 | ( | ) | [protected] |
Writes a parameter file for testing.
This is primarily for hash table sorting. Characteristics:
char* clTestTreePopulation::WriteXMLFile2 | ( | ) | [protected] |
Writes a parameter file for testing.
This is primarily for hash table sorting. Characteristics:
char* clTestTreePopulation::WriteXMLFile3 | ( | ) | [protected] |
Writes a parameter file for testing.
Characteristics:
char* clTestTreePopulation::WriteXMLFile4 | ( | ) | [protected] |
Writes a parameter file for testing.
Characteristics:
char* clTestTreePopulation::WriteXMLFile5 | ( | ) | [protected] |
Writes a parameter file for testing.
Characteristics: