public static void main(String[] args) throws IOException, InterruptedException {
        File testDir = new File(System.getProperty("java.class.path") + "/../tests/pa4_tests");
        int failures = 0;
        for (File x : testDir.listFiles()) {
            if (x.getName().startsWith(".") || x.getName().endsWith("mJAM") || x.getName().endsWith("asm"))
                continue;
            int returnCode = runTest(x);
            if (x.getName().indexOf("pass") != -1) {
                if (returnCode == 0) {
                    try {
                        int val = executeTest(x);
                        int expected = Integer.parseInt(x.getName().substring(5, 7));
                        if (val == expected)
                            System.out.println(x.getName() + " ran successfully!");
                        else {
                            failures++;
                            System.err
                                    .println(x.getName() + " compiled but did not run successfully--got output " + val);
                        }
                    } catch (Exception ex) {
                        failures++;
                        System.err.println(x.getName() + " did not output correctly.");
                    }
                } else {
                    failures++;
                    System.err.println(x.getName() + " failed to be processed!");
                }
            } else {
                if (returnCode == 4)
                    System.out.println(x.getName() + " failed successfully!");
                else {
                    System.err.println(x.getName() + " did not fail properly!");
                    failures++;
                }
            }
        }
        System.out.println(failures + " failures in all.");
    }