And as for the test harness......

Drool at this baby..........

using System;

namespace SizedStack
{
class Program
{
public static void Main(string[] args)
{
System.Collections.MaxSizedStack mss = new System.Collections.MaxSizedStack(3);

mss.Push(1);
System.Diagnostics.Debug.WriteLine(mss.Pop().ToString());
System.Diagnostics.Debug.WriteLine(" ");
mss.Push(1);
mss.Push(2);
System.Diagnostics.Debug.WriteLine(mss.Pop().ToString());
System.Diagnostics.Debug.WriteLine(mss.Pop().ToString());
System.Diagnostics.Debug.WriteLine(" ");
mss.Push(1);
mss.Push(2);
mss.Push(3);
System.Diagnostics.Debug.WriteLine(mss.Pop().ToString());
System.Diagnostics.Debug.WriteLine(mss.Pop().ToString());
System.Diagnostics.Debug.WriteLine(mss.Pop().ToString());
System.Diagnostics.Debug.WriteLine(" ");
mss.Push(1);
mss.Push(2);
mss.Push(3);
mss.Push(4);
mss.Push(5);

do
{
System.Diagnostics.Debug.WriteLine(mss.Pop().ToString());
} while (mss.Count>0);
System.Diagnostics.Debug.WriteLine(" ");
try
{
System.Diagnostics.Debug.WriteLine(mss.Pop().ToString());
}
catch(System.InvalidOperationException invopex)
{
System.Diagnostics.Debug.WriteLine("Nothing on stack");
}
}
}
}

Posted By: Johnny Comecardiff on January 7th 2008 at 14:09:48


Message Thread


Reply to Message

In order to add a post to the WotB Message Board you must be a registered WotB user.

If you are not yet registered then please visit the registration page. You should ensure that their browser is setup to accept cookies.

Log in