public bool Test( string programName, string startupArgs, string[] runtimeInputs, string[] expected) { if (programName == null) { throw new System.ArgumentNullException(); } // run the program with args and get output // constraints string[] outputs = ExternExeRunner.Run(programName, startupArgs, runtimeInputs); // return(AssertIsEqual(expected, outputs)); }
// run the program given exercise's test inputs // and return the result that consists of // Item1(pass or not) and Item2 (program's output) private static Tuple <bool, string[]> RunAndTest(ExerciseSingle exercise) { // run the generated file with exercise test inputs string programPath = outputProgramsPath + exercise.Name + dotExe; string[] runtimeArgs = exercise.Problem.TestInputs.ToArray(); string[] actualOutputs = ExternExeRunner.Run(programPath, null, runtimeArgs); // check outputs by asserting // that if the exepectedOutputs is the same as actualOutputs string[] expectedOutputs = exercise.Problem.TestOutputs.ToArray(); if (!Utils.IsSameStringArray(actualOutputs, expectedOutputs)) { return(new Tuple <bool, string[]>(false, expectedOutputs)); } else { return(new Tuple <bool, string[]>(true, expectedOutputs)); } }