SORTIE C++ Test Documentation
Classes | Functions
TestTreePopulation.h File Reference
#include <stddef.h>

Classes

class  clFakeLinkedList
 Tests the clTreePopulation class. 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...
 

Functions

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. More...
 
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. More...
 
void LoadTrees2 (clTreePopulation *p_oPop, clTree **p_oTreeSet, bool bFullCheck)
 Loads the first set of trees for hash table checking. More...
 
void EmptyFakeHashTable (clTree ****p_oShortestHD, clTree ****p_oTallestHD, clFakeLinkedList ***p_oShort, clFakeLinkedList ***p_oTall, int iNumXCells, int iNumYCells)
 Cleans up memory for CheckHashTable. More...
 
void DoSet1Searches (clTreePopulation *p_oPop, clTree **p_oTreeSet)
 Performs the first set of tree search tests. More...
 
void DoSet2Searches (clTreePopulation *p_oPop, clTree **p_oTreeSet)
 Performs the second set of tree search tests. More...
 
void DoSet3Searches (clTreePopulation *p_oPop)
 Performs the third set of tree search tests. More...
 
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. More...
 
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. More...
 
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. More...
 
const char * WriteTreePopulationXMLFile1 ()
 Writes a parameter file for testing. More...
 
const char * WriteTreePopulationXMLFile2 ()
 Writes a parameter file for testing. More...
 
const char * WriteTreePopulationXMLFile3 ()
 Writes a parameter file for testing. More...
 
const char * WriteTreePopulationXMLFile4 ()
 Writes a parameter file for testing. More...
 
const char * WriteTreePopulationXMLFile5 ()
 Writes a parameter file for testing. More...
 
const char * WriteTreePopulationXMLFile6 ()
 Writes a parameter file for testing distance-height tree searches on a plot which has odd-sized end grids (100X100 m plot). More...
 

Function Documentation

◆ CheckHashTable()

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.

Parameters
p_oPopPointer to tree population.
p_oShortestHDShortest links
p_oTallestHDTallest links
p_oShortFake shortest hash table.
p_oTallFake tallest hash table.
iNumXCellsNumber population X cells.
iNumYCellsNumber population Y cells.

◆ CheckTreeSearch()

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.

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.

Parameters
p_expectedArray of treeResults which shows expected values. There can be trees in this list that are not expected to be found.
iNumResultsNumber of elements in p_expected array.
p_oActualTree search object to test.
p_oFirstTreeThe expected first tree found.

◆ DeleteHashTableTrees()

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.

Parameters
p_oPopPointer to tree population object
p_oShortestHDShortest links
p_oTallestHDTallest links
p_oShortFake shortest hash table.
p_oTallFake tallest hash table.
iNumXCellsNumber population X cells.
iNumYCellsNumber population Y cells.
p_oTreeSetThe set of trees

◆ DoSet1Searches()

void DoSet1Searches ( clTreePopulation *  p_oPop,
clTree **  p_oTreeSet 
)

Performs the first set of tree search tests.

◆ DoSet2Searches()

void DoSet2Searches ( clTreePopulation *  p_oPop,
clTree **  p_oTreeSet 
)

Performs the second set of tree search tests.

◆ DoSet3Searches()

void DoSet3Searches ( clTreePopulation *  p_oPop)

Performs the third set of tree search tests.

◆ EmptyFakeHashTable()

void EmptyFakeHashTable ( clTree ****  p_oShortestHD,
clTree ****  p_oTallestHD,
clFakeLinkedList ***  p_oShort,
clFakeLinkedList ***  p_oTall,
int  iNumXCells,
int  iNumYCells 
)

Cleans up memory for CheckHashTable.

Parameters
p_oShortestHDShortest links
p_oTallestHDTallest links
p_oShortFake shortest hash table.
p_oTallFake tallest hash table.
iNumXCellsNumber population X cells.
iNumYCellsNumber population Y cells.

◆ LoadTrees1()

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.

Parameters
p_oPopPointer to tree population.
p_oShortestHDShortest links
p_oTallestHDTallest links
p_oShortFake shortest hash table.
p_oTallFake tallest hash table.
iNumXCellsNumber population X cells.
iNumYCellsNumber population Y cells.
p_oTreeSetThe set of trees to create
bFullCheckIf true, the function checks the hash table after each tree is created to make sure it is correct.
bUpdateHashTableIf true, this creates the fake hash table and keeps it updated.

◆ LoadTrees2()

void LoadTrees2 ( clTreePopulation *  p_oPop,
clTree **  p_oTreeSet,
bool  bFullCheck 
)

Loads the first set of trees for hash table checking.

Parameters
p_oPopPointer to tree population.
p_oTreeSetThe set of trees to create
bFullCheckIf true, the function checks the hash table after each tree is created to make sure it is correct.

◆ UpdateHashTableTrees()

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.

Parameters
p_oPopPointer to tree population object
p_oShortestHDShortest links
p_oTallestHDTallest links
p_oShortFake shortest hash table.
p_oTallFake tallest hash table.
iNumXCellsNumber population X cells.
iNumYCellsNumber population Y cells.
p_oTreeSetThe set of trees to create
bFullCheckWhether to check the hash table after each update
bUpdateNowMatches the trees' bUpdateNow argument
bUpdateAllometryMatches the trees' bUpdateAllometry argument

◆ WriteTreePopulationXMLFile1()

const char* WriteTreePopulationXMLFile1 ( )

Writes a parameter file for testing.

This is primarily for hash table sorting. Characteristics:

  • Three species, with various values for getting/setting.
  • Known plot lengths for pop. cell testing.
  • The only behavior does not use snags or stumps.
Returns
Filename written.

◆ WriteTreePopulationXMLFile2()

const char* WriteTreePopulationXMLFile2 ( )

Writes a parameter file for testing.

This is primarily for hash table sorting. Characteristics:

  • Known plot lengths for pop. cell testing.
  • The only behavior does not use snags or stumps.
Returns
Filename written.

◆ WriteTreePopulationXMLFile3()

const char* WriteTreePopulationXMLFile3 ( )

Writes a parameter file for testing.

Characteristics:

  • Two species.
  • There is no behavior which uses snags.
  • There is a behavior which uses stumps, but only for Species 1.
  • There is a tree map with seedlings, saplings, adults, and snags.
Returns
Filename written.

◆ WriteTreePopulationXMLFile4()

const char* WriteTreePopulationXMLFile4 ( )

Writes a parameter file for testing.

Characteristics:

  • Two species.
  • There is a behavior which uses snags.
  • There is a behavior which uses stumps, but only for Species 1.
  • There is a tree map with seedlings, saplings, adults, and snags.
Returns
Filename written.

◆ WriteTreePopulationXMLFile5()

const char* WriteTreePopulationXMLFile5 ( )

Writes a parameter file for testing.

Characteristics:

  • 3 years per timestep.
  • Two species.
  • There is a behavior which uses snags.
  • There is a behavior which uses stumps, but only for Species 1.
  • There is a tree map with seedlings, saplings, adults, and snags.
Returns
Filename written.

◆ WriteTreePopulationXMLFile6()

const char* WriteTreePopulationXMLFile6 ( )

Writes a parameter file for testing distance-height tree searches on a plot which has odd-sized end grids (100X100 m plot).

Returns
Filename written.