// Manage the files for the testing program
// Obtains the name of an executable file as well as names of directories 
// containing test input and expected output for that input
// Creates a report noting when the actual output obtained from running the 
// program on the test input differs from the expected output

// Beth Katz, August and September 2004

#include <iostream>
#include <cstdlib>
#include "testing.h"

using namespace std;

int main (int argc, char * const argv[]) {
   if (argc != 4) {
      cerr << "Need exactly 3 command line arguments: "
           << "executableName inputDirectory expectedOutputDirectory\n";
      cerr << argc << " arguments provided" << endl;
      exit(2);
   } else {

      if (fileExists(argv[1])) {
         cout << "Will run " << argv[1] << endl;
      } else {
         cerr << "Executable file doesn't exist. Quitting.\n";
         exit(4);
      }

      if (fileExists(argv[2])) {
         cout << "Input will come from " << argv[2] << endl;
      } else {
         cerr << "Input directory doesn't exist. Quitting.\n";
         exit(4);
      }

      if (fileExists(argv[3])) {
         cout << "Expected output is in " << argv[3] << endl;
      } else {
         cerr << "Expected output directory doesn't exist. Quitting.\n";
         exit(4);
      }
      
      runTests(argv[1], argv[2], argv[3]);     
   }
   return 0;
}