@@ -60,7 +60,6 @@ ClassMethod StoreIntCoverage(pRun As %Integer, pTestPath As %String, pName As %S
60
60
#dim tResult As %SQL.StatementResult
61
61
Set tSC = ##class (TestCoverage.Data.CodeUnit ).GetCurrentByName (pName _" ." _pType ,,.tCodeUnit ,.pCache )
62
62
$$$ThrowOnError(tSC )
63
-
64
63
If ..UniqueCoverageDataExists (pRun ,tCodeUnit .Hash ,pTestPath ,.tID ) {
65
64
Set tInstance = ..%OpenId (tID ,,.tSC )
66
65
$$$ThrowOnError(tSC )
@@ -70,6 +69,10 @@ ClassMethod StoreIntCoverage(pRun As %Integer, pTestPath As %String, pName As %S
70
69
$$$ThrowOnError(tSC )
71
70
Set tInstance .TestPath = pTestPath
72
71
Set tInstance .Hash = tCodeUnit
72
+ For tLineNumber =1 :1 :tCodeUnit .Lines .Count () {
73
+ do tInstance .RtnLine .SetAt (0 , tLineNumber ) // initialized to 0 hits of each line
74
+ // necessary for the python coverages because they don't track lines that aren't covered, only lines that are covered
75
+ }
73
76
}
74
77
75
78
Set tCoveredLines = tInstance .CoveredLines
@@ -102,12 +105,17 @@ ClassMethod StoreIntCoverage(pRun As %Integer, pTestPath As %String, pName As %S
102
105
$$$ThrowOnError(tSC )
103
106
}
104
107
Else { // If pType = "PY"
105
- //^IRIS.TEMP.TestCoveragePy(ClassName) contains the number of covered lines in this class
106
- //^IRIS.TEMP.TestCoveragePy(ClassName, i) in increasing order contain the line numbers for the covered lines
108
+ // $$$PyMonitorResults(classname, linenumber) = the number of times that linenumber in that class was covered
109
+
107
110
if $Data ($$$PyMonitorResults(pName )) {
108
- for i = 1 :1 :($$$PyMonitorResults(pName )-1 ) {
109
- Set tLineNumber = $$$PyMonitorResults(pName , i )
110
- Set $Bit (tCoveredLines , tLineNumber ) = 1
111
+ Set tLine = " "
112
+ for {
113
+ Set tLine = $Order ($$$PyMonitorResults(pName , tLine ), 1 , tLineCount )
114
+ if (tLine = " " ) {
115
+ quit
116
+ }
117
+ Set $Bit (tCoveredLines , tLine ) = 1
118
+ Do tInstance .RtnLine .SetAt (tInstance .RtnLine .GetAt (tLine ) + tLineCount , tLine )
111
119
}
112
120
}
113
121
0 commit comments