/*
The High Performance Template Library is a Licensed as LGPL.
It is intended to provide a base object Testitecture, with
Serialization, thread control, etc.
It is based on a merger of QT, BOOST, STL, and SigSlots.
License information is in the HtlLicense.h file
October 2012
*/
#pragma once
#pragma warning(push)
#pragma warning (disable : 4005 ) /* macro redefinition */
#define HTL_DLLEXPORT
#pragma warning(pop)
#include "..\stdafx.h"
#include ".\TestMap02.h"
#include "modHtlGUID.h"
#include "modHtlRandNumGen.h"
#include <string>
using namespace std;
using namespace HTL;
namespace HTLTest
{
void PrintIntNode2(HtlDebugPrinter & ptrPrint, HtlTreeNode<int,double>* ptrNode)
{
if(!ptrNode){return;};
ptrPrint.DebugPrint(1,"\nNODE\n");
ptrPrint.DebugPrint(1," %03d\n",ptrNode->m_objKey);
ptrPrint.DebugPrint(1,"|------------|\n",ptrNode->m_objKey);
ptrPrint.DebugPrint(1,"| |\n",ptrNode->m_objKey);
HtlTreeNode<int,double>* ptrLeft = ptrNode->m_ptrLeft;
HtlTreeNode<int,double>* ptrRight = ptrNode->m_ptrRight;
if(!ptrLeft)
{
ptrPrint.DebugPrint(1,"NULL ");
}else{
ptrPrint.DebugPrint(1,"%03d ",ptrLeft->m_objKey);
}
if(!ptrRight)
{
ptrPrint.DebugPrint(1,"NULL\n");
}else{
ptrPrint.DebugPrint(1,"%03d\n",ptrRight->m_objKey);
}
if(!ptrLeft)
{
ptrPrint.DebugPrint(1,"NULL ");
}else{
ptrPrint.DebugPrint(1,"%p ",ptrLeft);
}
if(!ptrRight)
{
ptrPrint.DebugPrint(1,"NULL\n");
}else{
ptrPrint.DebugPrint(1,"%p\n",ptrRight);
}
//call recursively
if(ptrLeft){PrintIntNode2(ptrPrint,ptrLeft);};
if(ptrRight){PrintIntNode2(ptrPrint,ptrRight);};
};
HtlTestMap02::HtlTestMap02()
{
m_strTestName = "HtlTestMap02";
std::string strFileName = "HtlTestMap02.txt";
m_objDebug.Set_strFileName(strFileName);
m_objDebug.Set_blnPrintToFile(true);
m_objDebug.Set_intPrintLevel(2);
//delete file if already exists to clear it
m_objDebug.DeleteDebugFile();
};
HtlTestMap02::HtlTestMap02(HtlTestNode* ptrParent)
{
};
HtlTestMap02::~HtlTestMap02()
{
};
//Test Node virtual operations functions
//! Setup the Test Objects
int HtlTestMap02::SetupTest(void)
{
return 0;
};
//! Perform any test pre-processing
int HtlTestMap02::PreProcessTest(void)
{
return 0;
};
//! Run the actual test suite for this node. CAN involve other sub test nodes
int HtlTestMap02::RunTest(void)
{
m_objDebug.DebugPrint(4,"DEBUG PRINTER LEVEL TEST");
std::string strA, strB;
int i, intUbound, intTemp;
double dblTemp;
HtlUniform objRNG;
objRNG.initialize();
//PUSH_BACK AND POP_BACK TESTS
//Test for basic string literal assignment
strA = "This is my Second Map <int, double> ";
m_objDebug.DebugPrint(1,"%s\n",strA.c_str());
intUbound = 100;
HTL::HtlMap<int,CPP_INT,double, CPP_DOUBLE> mapDblTest;
m_objDebug.DebugPrint(1,"Inserting elements...\n");
for(i = 0; i < intUbound; i++)
{
intTemp = (int)objRNG.dblNextAB(-100,100);
dblTemp = objRNG.dblNextAB(0,1);
m_objDebug.DebugPrint(1,"INSERT %d , %f\n", intTemp, dblTemp);
mapDblTest.insert(intTemp,dblTemp);
}
m_objDebug.DebugPrint(1,"Finished inserting...size %d\n",mapDblTest.size());
m_objDebug.DebugPrint(1,"PRINTING TREE...\n");
HTLTest::PrintIntNode2(m_objDebug,mapDblTest.root());
m_objDebug.DebugPrint(1,"END TREE...\n");
return 1;
};
int HtlTestMap02::PostProcessTest(void)
{
return 0;
};
int HtlTestMap02::ClearTest(void)
{
return 0;
};
};