Example #1
0
void main()
{
	_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);

	// Tests Canonical Functions
	DoubleLinkedList<int> alist;			//ctor
	DoubleLinkedList<int> blist(alist);		//copy ctor
	DoubleLinkedList<int> clist;

	clist = blist;							//= operator

	// Tests Mutators
	std::cout << alist.getHead() << std::endl;
	std::cout << alist.getTail() << std::endl;

	// Tests Methods

	TestAppend(alist);
	TestFirstAndLast(alist);
	TestPrepend(alist);
	TestPurge(alist);
	TestInsertBefore();
	TestInsertAfter();
	TestExtract();

	std::cout << "\n********** List Integrity **********" << std::endl;
	alist.PrintForwards();
	alist.PrintBackwards();
}
Example #2
0
void main()
{
	// Tests Canonical Functions
	DoubleLinkedList<int> alist;			//ctor
	DoubleLinkedList<int> blist(alist);		//copy ctor
	DoubleLinkedList<int> clist;

	clist = blist;							//= operator

	// Tests Mutators
	std::cout << alist.getHead() << std::endl;
	std::cout << alist.getTail() << std::endl;

	// Tests Methods
	
	TestAppend(alist);
	TestFirstAndLast(alist);
	TestPrepend(alist);
	TestPurge(alist);
	TestInsertBefore();
	TestInsertAfter();
	TestExtract();

	std::cout << "\n********** List Integrity **********" << std::endl;
	alist.PrintForwards();
	alist.PrintBackwards();
	_asm nop;//added as a break point location;
}
Example #3
0
void main()
{
	// Tests Canonical Functions
	DoubleLinkedList<int> alist;			//ctor
	DoubleLinkedList<int> blist(alist);		//copy ctor
	DoubleLinkedList<int> clist;

	clist = blist;							//= operator

	// Tests Mutators
	std::cout << alist.getHead() << std::endl;
	std::cout << alist.getTail() << std::endl;

	// Tests Methods
	
	TestAppend(alist);
	TestFirstAndLast(alist);
	TestPrepend(alist);
	TestPurge(alist);
	TestInsertBefore();
	TestInsertAfter();
	TestExtract();

	std::cout << "\n********** List Integrity **********" << std::endl;
	alist.PrintForwards();
	alist.PrintBackwards();

	//The memory leak tool detects leaks because alist isn't being destroyed before it is called
	//by calling the destructor or the following line of code, the list is destroyed and
	//there are no leaks:
	//alist.Purge();
	_CrtDumpMemoryLeaks();
}
Example #4
0
static void SimpleTest()
{
  fprintf(stdout, " ------------------------- Starting the basic test...\n");
  vector alphabet;
  VectorNew(&alphabet, sizeof(char), NULL, 4);
  TestAppend(&alphabet);
  TestSortSearch(&alphabet);
  TestAt(&alphabet);
  TestInsertDelete(&alphabet);
  TestReplace(&alphabet);
  VectorDispose(&alphabet);
}