コード例 #1
0
ファイル: CoverageMapper.cs プロジェクト: jsschultz/PTVS
 public CoverageMapper(PythonAst ast, string filename, HashSet<int> hits) {
     _ast = ast;
     _filename = filename;
     GlobalScope = new CoverageScope(ast);
     CurScopes.Add(GlobalScope);
     _blockCount++;
     _hits = hits;
 }
コード例 #2
0
 public CoverageMapper(PythonAst ast, string filename, HashSet <int> hits)
 {
     _ast        = ast;
     _filename   = filename;
     GlobalScope = new CoverageScope(ast);
     CurScopes.Add(GlobalScope);
     _blockCount++;
     _hits = hits;
 }
コード例 #3
0
 private void AggregateStats(CoverageScope scope, ref int linesCovered, ref int linesNotCovered, ref int blocksCovered, ref int blocksNotCovered)
 {
     linesCovered     += scope.LinesCovered;
     linesNotCovered  += scope.LinesNotCovered;
     blocksCovered    += scope.BlocksCovered;
     blocksNotCovered += scope.BlocksNotCovered;
     foreach (var child in scope.Children)
     {
         AggregateStats(child, ref linesCovered, ref linesNotCovered, ref blocksCovered, ref blocksNotCovered);
     }
 }
コード例 #4
0
        private void WriteMethods(CoverageScope klass)
        {
            foreach (var child in klass.Children)
            {
                FunctionDefinition funcDef = child.Statement as FunctionDefinition;
                if (funcDef != null)
                {
                    WriteMethod(child, GetQualifiedFunctionName(child.Statement));

                    WriteMethods(child);
                }
            }
        }
コード例 #5
0
        private CoverageScope WalkScope(ScopeStatement node)
        {
            var prevScope = CurScope;
            var newScope  = new CoverageScope(node);

            CurScopes.Add(newScope);
            var wasCovered = _blockCovered;

            _blockCovered = null;
            if (node.Body != null)
            {
                node.Body.Walk(this);
            }

            CurScopes.RemoveAt(CurScopes.Count - 1);
            _blockCovered = wasCovered;
            return(newScope);
        }
コード例 #6
0
        private void WriteClass(string filename, CoverageScope klass, string name)
        {
            _writer.WriteStartElement("Class");

            WriteElement("ClassKeyName", filename + "!" + name);
            WriteElement("ClassName", name);
            WriteElement("NamespaceKeyName", filename + "!" + name);

            int linesCovered = 0, linesNotCovered = 0, blocksCovered = 0, blocksNotCovered = 0;

            AggregateStats(klass, ref linesCovered, ref linesNotCovered, ref blocksCovered, ref blocksNotCovered);

            WriteCoverageData(linesCovered, linesNotCovered, blocksCovered, blocksNotCovered);

            WriteMethod(klass, klass.Statement.Name);
            WriteMethods(klass);

            _writer.WriteEndElement();
        }
コード例 #7
0
        private void WriteMethod(CoverageScope child, string name)
        {
            _writer.WriteStartElement("Method");
            WriteElement("MethodKeyName", "method!" + ++_methodCount);
            WriteElement("MethodName", name);
            WriteElement("MethodFullName", name);
            WriteCoverageData(child);

            foreach (var line in child.Lines)
            {
                var lineNo   = line.Key;
                var lineInfo = line.Value;
                _writer.WriteStartElement("Lines");
                WriteElement("LnStart", lineNo);
                WriteElement("ColStart", lineInfo.ColumnStart);
                WriteElement("LnEnd", lineNo);
                WriteElement("ColEnd", lineInfo.ColumnEnd);
                WriteElement("Coverage", (int)(lineInfo.Covered ? CoverageStatus.Covered : CoverageStatus.NotCovered));
                WriteElement("SourceFileID", _curFile + 1);
                WriteElement("LineID", line.Key);
                _writer.WriteEndElement();
            }
            _writer.WriteEndElement();
        }
コード例 #8
0
 private void WriteCoverageData(CoverageScope scope)
 {
     WriteCoverageData(scope.LinesCovered, scope.LinesNotCovered, scope.BlocksCovered, scope.BlocksNotCovered);
 }
コード例 #9
0
ファイル: CoverageMapper.cs プロジェクト: jsschultz/PTVS
        private CoverageScope WalkScope(ScopeStatement node) {
            var prevScope = CurScope;
            var newScope = new CoverageScope(node);
            CurScopes.Add(newScope);
            var wasCovered = _blockCovered;
            _blockCovered = null;
            if (node.Body != null) {
                node.Body.Walk(this);
            }

            CurScopes.RemoveAt(CurScopes.Count - 1);
            _blockCovered = wasCovered;
            return newScope;
        }
コード例 #10
0
ファイル: CoverageExporter.cs プロジェクト: jsschultz/PTVS
        private void WriteClass(string filename, CoverageScope klass, string name) {
            _writer.WriteStartElement("Class");

            WriteElement("ClassKeyName", filename + "!" + name);
            WriteElement("ClassName", name);
            WriteElement("NamespaceKeyName", filename + "!" + name);

            int linesCovered = 0, linesNotCovered = 0, blocksCovered = 0, blocksNotCovered = 0;
            AggregateStats(klass, ref linesCovered, ref linesNotCovered, ref blocksCovered, ref blocksNotCovered);

            WriteCoverageData(linesCovered, linesNotCovered, blocksCovered, blocksNotCovered);

            WriteMethod(klass, klass.Statement.Name);
            WriteMethods(klass);

            _writer.WriteEndElement();
        }
コード例 #11
0
ファイル: CoverageExporter.cs プロジェクト: jsschultz/PTVS
 private void AggregateStats(CoverageScope scope, ref int linesCovered, ref int linesNotCovered, ref int blocksCovered, ref int blocksNotCovered) {
     linesCovered += scope.LinesCovered;
     linesNotCovered += scope.LinesNotCovered;
     blocksCovered += scope.BlocksCovered;
     blocksNotCovered += scope.BlocksNotCovered;
     foreach (var child in scope.Children) {
         AggregateStats(child, ref linesCovered, ref linesNotCovered, ref blocksCovered, ref blocksNotCovered);
     }
 }
コード例 #12
0
ファイル: CoverageExporter.cs プロジェクト: jsschultz/PTVS
 private void WriteCoverageData(CoverageScope scope) {
     WriteCoverageData(scope.LinesCovered, scope.LinesNotCovered, scope.BlocksCovered, scope.BlocksNotCovered);
 }
コード例 #13
0
ファイル: CoverageExporter.cs プロジェクト: jsschultz/PTVS
        private void WriteMethod(CoverageScope child, string name) {
            _writer.WriteStartElement("Method");
            WriteElement("MethodKeyName", "method!" + ++_methodCount);
            WriteElement("MethodName", name);
            WriteElement("MethodFullName", name);
            WriteCoverageData(child);

            foreach (var line in child.Lines) {
                var lineNo = line.Key;
                var lineInfo = line.Value;
                _writer.WriteStartElement("Lines");
                WriteElement("LnStart", lineNo);
                WriteElement("ColStart", lineInfo.ColumnStart);
                WriteElement("LnEnd", lineNo);
                WriteElement("ColEnd", lineInfo.ColumnEnd);
                WriteElement("Coverage", (int)(lineInfo.Covered ? CoverageStatus.Covered : CoverageStatus.NotCovered));
                WriteElement("SourceFileID", _curFile + 1);
                WriteElement("LineID", line.Key);
                _writer.WriteEndElement();
            }
            _writer.WriteEndElement();
        }
コード例 #14
0
ファイル: CoverageExporter.cs プロジェクト: jsschultz/PTVS
        private void WriteMethods(CoverageScope klass) {
            foreach (var child in klass.Children) {
                FunctionDefinition funcDef = child.Statement as FunctionDefinition;
                if (funcDef != null) {
                    WriteMethod(child, GetQualifiedFunctionName(child.Statement));

                    WriteMethods(child);
                }
            }
        }