Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
        /*
         *  Each time we start/stop/reset the SUT, we need to make sure
         *  to reset the collection of bytecode info.
         */
        public static void ResetForNewTest()
        {
            ExecutionTracer.Reset();

            /*
             * Note: it should be fine but, if for any reason EM did not do
             * a GET on the targets, then all those newly encountered targets
             * would be lost, as EM will have no way to ask for them later, unless
             * we explicitly say to return ALL targets
             */
            //ObjectiveRecorder.clearFirstTimeEncountered();
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
0
        public void TestLineCoverage()
        {
            ITriangleClassification tc = new TriangleClassificationImpl();

            ExecutionTracer.Reset();

            Assert.Equal(0, ExecutionTracer.GetNumberOfObjectives());

            tc.Classify(-1, 0, 0);

            var a = ExecutionTracer.GetNumberOfObjectives();

            //at least one line should have been covered
            Assert.True(a > 0);
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
0
 public static void ResetForNewSearch()
 {
     ExecutionTracer.Reset();
     //ObjectiveRecorder.reset(false);
 }
Ejemplo n.º 8
0
 public static List <AdditionalInfo> GetAdditionalInfoList()
 {
     return(new List <AdditionalInfo>(ExecutionTracer.ExposeAdditionalInfoList()));
 }
Ejemplo n.º 9
0
 public sealed override void NewActionSpecificHandler(ActionDto dto)
 {
     ExecutionTracer.SetAction(new Action(dto.Index, dto.InputVariables));
 }