static void Main(string[] args) { Options myOptions = new Options(); myOptions.Parse(args); if (myOptions.GetExec() && myOptions.GetLoad()) { Computer myComputer = new Computer(myOptions); myComputer.endRun += new Computer.EventHandler(delegate { }); myComputer.putChar += new Computer.EventHandler(delegate { }); myComputer.abort = false; myComputer.Run(); Environment.Exit(0); } else if (myOptions.GetTest()) { TestMemory.RunTests(); TestLoader.RunTests(myOptions); TestComputer.RunTests(myOptions); TestCPU.RunTests(myOptions); TestRegisters.RunTests(myOptions); Environment.Exit(0); } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new ARMSimForm(myOptions)); }
//Method: RunTests //Purpose: tests every method in the Computer class //Variables: myOptions - Options handle to options to class public static void RunTests(Options myOptions) { myOptions.SetFileName("ctest.exe"); Console.WriteLine("testing Computer setup..."); Computer myTestComp = new Computer(myOptions); myTestComp.endRun += new Computer.EventHandler(delegate { }); myTestComp.putChar += new Computer.EventHandler(delegate { }); Console.WriteLine("testing Computer Running..."); myTestComp.step(); Debug.Assert(myTestComp.getStepNum() == 1); myTestComp.Run(); Debug.Assert(myTestComp.getStepNum() == 20); Console.WriteLine("success!"); myTestComp.FileStreamClose(); }