//This method is called by the probe inserted after each covered line in the instrumented SUT public static void CompletedLine(string className, string methodName, int lineNo) { ObjectiveRecorder.RegisterTarget(ObjectiveNaming.LineObjectiveName(className, lineNo)); //TODO: description ExecutionTracer.ExecutedLine(className, methodName, "desc", lineNo); }
public static List <TargetInfo> GetTargetInfos(IEnumerable <int> ids) { var list = new List <TargetInfo>(); var objectives = ExecutionTracer.GetInternalReferenceToObjectiveCoverage(); ids.ToList().ForEach(id => { var descriptiveId = ObjectiveRecorder.GetDescriptiveId(id); var info = objectives[descriptiveId]; info = info == null ? TargetInfo.NotReached(id) : info.WithMappedId(id).WithNoDescriptiveId(); list.Add(info); }); //If new targets were found, we add them even if not requested by EM ObjectiveRecorder.GetTargetsSeenFirstTime().ToList().ForEach(s => { var mappedId = ObjectiveRecorder.GetMappedId(s); var info = objectives[s].WithMappedId(mappedId); list.Add(info); }); return(list); }
public void TestSpecificLineCoverage(int a, int b, int c, string returnLine) { ITriangleClassification tc = new TriangleClassificationImpl(); ExecutionTracer.Reset(); ObjectiveRecorder.Reset(true); Assert.Equal(0, ExecutionTracer.GetNumberOfObjectives()); Assert.Empty(ObjectiveRecorder.AllTargets); tc.Classify(a, b, c); Assert.Contains(returnLine, ObjectiveRecorder.AllTargets); }
public void TestLastLineCoverage(int a, int b, int c) { ITriangleClassification tc = new TriangleClassificationImpl(); ExecutionTracer.Reset(); ObjectiveRecorder.Reset(true); Assert.Equal(0, ExecutionTracer.GetNumberOfObjectives()); Assert.Empty(ObjectiveRecorder.AllTargets); tc.Classify(a, b, c); //assert that the last line of the method is reached Assert.Contains("Line_at_TriangleClassificationImpl_00027", ObjectiveRecorder.AllTargets); }