private List <Core.Transformation> SearchTransformation(Submission2 submission) { if (!transformationStorage.ContainsKey(submission.KeyPoint())) { return(new List <Core.Transformation>()); } return(transformationStorage[submission.KeyPoint()]); }
public List <String> TryToFixSubmission(Submission2 submission, List <String> testCasesList, List <Core.Transformation> transformationsList) { List <String> fixedCodesList = new List <String>(); for (int i = 0; i < transformationsList.Count; i++) { try { var transformation = transformationsList[i]; var generatedCodesList = refazer.Apply(transformation, submission.Code).ToList(); if (generatedCodesList.Count > 15) { generatedCodesList = generatedCodesList.GetRange(0, 20); } foreach (var code in generatedCodesList) { Tuple <bool, List <String> > testResult = RunPythonTest. Execute(testCasesList, code); if (testResult.Item1) { fixedCodesList.Add(code); break; } } if (!fixedCodesList.IsEmpty()) { break; } } catch (Exception e) { Trace.TraceError("Could not apply transformations because " + e.Message); } } return(fixedCodesList); }
public List <String> TryToFixSubmission(Submission2 submission, List <String> testCasesList) { return(TryToFixSubmission(submission, testCasesList, SearchTransformation(submission))); }