namespace utility { using Console = System.Console; using Counter = System.Diagnostics.Counter; using Hashtable = System.Collections.Hashtable; using Random = System.Random; using Thread = System.Threading.Thread; /// /// A program to test some aspects of the Date interface /// and the DateImpl class. /// public class DateTest { public static int Main(string[] args) { int tSize = 100; Random tRandom = new Random(); Hashtable tHashtable = new Hashtable(); for (int i=1;i<=tSize;i++) { int tYear = tRandom.Next(1900, 2000); int tMonth = tRandom.Next(1, 13); int tDay = tRandom.Next(1, 29); // Console.WriteLine(tYear*10000+tMonth*100+tDay); Date tDate = new DateImpl(tYear, tMonth, tDay); tHashtable.Add(i, tDate); } for (int j=1;j<=20;j++) { DateImpl.Count = 0; long tStart = Counter.Value; for (int i=1;i<=tSize;i++) { Date tDate = (Date)tHashtable[i]; bool tFound = tHashtable.ContainsValue(tDate); } long tFinish = Counter.Value; Console.WriteLine(DateImpl.Count + " " + (tFinish - tStart)); } // Console.Write("Type in a date: "); // string tDateString = Console.ReadLine(); // Date tFirstDate = new DateImpl(tDateString); // Console.WriteLine(tFirstDate.ToString()); Thread.Sleep(3000); return 0; } } }