import java.io.*;
import RunSchemeTest1;
import OutputFormatter1;
import java.lang.Character;

public class TestGenerator1 {
    
    OutputFormatter1 myof1;
    RunSchemeTest1 myrst1;
    RunSchemeTest1 myrst2;

    public TestGenerator1(OutputFormatter1 of1, RunSchemeTest1 rst1, RunSchemeTest1 rst2){
        myof1 = of1;
        myrst1 = rst1;
        myrst2 = rst2;
    }
    
    
    public void getCases(String fileNameForRegTests, String fileNameForSpecialTests) throws IOException {
        String reg = fileNameForRegTests;
        String spec = fileNameForSpecialTests;
        File inputFile = new File(reg);
        FileReader in = new FileReader(inputFile);
        int f = 0;
        int testNumber = 0;
        
        //standard test cases
        while (f != -1) {  //the ~ is the character that asserts the end of the file.
            String testCase = "";
            testNumber++;
            while ((f = in.read()) != '#') {      //the # is the character that asserts the end of a test case.
                testCase = testCase + (char) f;   
            }
            myof1.getTest(testNumber, testCase);  //outputformatter object.
            myrst1.runTest(testNumber, testCase); //authority program object.
            myrst2.runTest(testNumber, testCase); //user program object.
        }
        in.close();
        
        
        //special test cases
        if (spec.compareTo("") != 0) {
            File inputFile1 = new File(spec);
            FileReader in1 = new FileReader(inputFile1);
            f = 0;
            while (f != -1) {  //the ~ is the character that asserts the end of the file.
                String testCase = "";
                testNumber++;
                while ((f = in1.read()) != '#') {  //the # is the character that asserts the end of a test case.
                    testCase = testCase + (char) f;   
                }
                myof1.getTest(testNumber, testCase);  //outputformatter object.
                myrst1.runTest(testNumber, testCase); //authority program object.
                myrst2.runTest(testNumber, testCase); //user program object.
            }
        }
        in.close();
        
        testNumber++;
        myof1.getTest(testNumber, "done");
    }//getCases

}//TestGenerator1

