Beispiel #1
0
        //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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        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);
        }