Add all the assignment code.

Signed-off-by: jmug <u.g.a.mariano@gmail.com>
This commit is contained in:
Mariano Uvalle 2025-01-24 18:59:28 -08:00
parent 58c6b1f81c
commit cfe502c598
1277 changed files with 48709 additions and 1 deletions

31
hw2/bin/main.ml Normal file
View file

@ -0,0 +1,31 @@
open Util.Assert
open Arg
open X86
open Sim.Simulator
exception Ran_tests
let worklist = ref []
let suite = ref (timeout_suite 5 (Studenttests.provided_tests @ Gradedtests.graded_tests))
let exec_tests () =
let o = run_suite !suite in
Printf.printf "%s\n" (outcome_to_string o);
raise Ran_tests
let do_one_file fn =
let _ = Printf.printf "Processing: %s\n" fn in ()
(* Use the --test option to run unit tests and the quit the program. *)
let argspec = [
("--test", Unit exec_tests, "run the test suite, ignoring other inputs");
]
let _ =
try
Arg.parse argspec (fun f -> worklist := f :: !worklist)
"CIS341 main test harness \n";
match !worklist with
| [] -> print_endline "* Nothing to do"
| _ -> List.iter do_one_file !worklist
with Ran_tests -> ()