Example #1
0
void testIterator ()
{
	BinTree<int> t;

	t.insertBOT(59)
	 .insertBOT(23)
	 .insertBOT(68)
	 .insertBOT(190)
	 .insertBOT(41)
	 .insertBOT(67);

	 	
	 BinTree<int>::LeftRootRightIterator it = t.begin();

	 assert (*it == 23);

	 ++it; 
	 ++it;
	 assert (*it == 59);;

	 int count = 0;
	 for (it = t.begin(); it != t.end(); ++it)
	 {
	 	count++;
	 }


	 assert (count == 6);

}
Example #2
0
int main ()
{
	
	testMember ();
	testAssignment();
	testMinEl();
	testIterator();

	BinTree<int> t;

	t.insertBOT(56)
	 .insertBOT(23)
	 .insertBOT(68)
	 .insertBOT(190)
	 .insertBOT(41)
	 .insertBOT(60)
	 .insertBOT(65)
	 .insertBOT(59);


	cerr << "digraph G{" << endl;
	t.dottyPrint (cerr);
	cerr << "}\n";

	prettyPrint<int> (t.rootIter());

	testMakeTree();


	return 0;
}
Example #3
0
void testMinEl ()
{
	BinTree<int> t;

	t.insertBOT(59)
	 .insertBOT(23)
	 .insertBOT(68)
	 .insertBOT(190)
	 .insertBOT(41)
	 .insertBOT(67);

	 assert (t.minelement() == 23);
}