|
|
@ -6,40 +6,40 @@ injector.callEvent = function injectCallEvent(contract, fileName, injectionPoint |
|
|
|
const linecount = (contract.instrumented.slice(0, injectionPoint).match(/\n/g) || []).length + 1; |
|
|
|
const linecount = (contract.instrumented.slice(0, injectionPoint).match(/\n/g) || []).length + 1; |
|
|
|
contract.runnableLines.push(linecount); |
|
|
|
contract.runnableLines.push(linecount); |
|
|
|
contract.instrumented = contract.instrumented.slice(0, injectionPoint) + |
|
|
|
contract.instrumented = contract.instrumented.slice(0, injectionPoint) + |
|
|
|
'__Coverage' + contract.contractName + '(\'' + fileName + '\',' + linecount + ');\n' + |
|
|
|
'emit __Coverage' + contract.contractName + '(\'' + fileName + '\',' + linecount + ');\n' + |
|
|
|
contract.instrumented.slice(injectionPoint); |
|
|
|
contract.instrumented.slice(injectionPoint); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
injector.callFunctionEvent = function injectCallFunctionEvent(contract, fileName, injectionPoint, injection) { |
|
|
|
injector.callFunctionEvent = function injectCallFunctionEvent(contract, fileName, injectionPoint, injection) { |
|
|
|
contract.instrumented = contract.instrumented.slice(0, injectionPoint) + |
|
|
|
contract.instrumented = contract.instrumented.slice(0, injectionPoint) + |
|
|
|
'__FunctionCoverage' + contract.contractName + '(\'' + fileName + '\',' + injection.fnId + ');\n' + |
|
|
|
'emit __FunctionCoverage' + contract.contractName + '(\'' + fileName + '\',' + injection.fnId + ');\n' + |
|
|
|
contract.instrumented.slice(injectionPoint); |
|
|
|
contract.instrumented.slice(injectionPoint); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
injector.callBranchEvent = function injectCallFunctionEvent(contract, fileName, injectionPoint, injection) { |
|
|
|
injector.callBranchEvent = function injectCallFunctionEvent(contract, fileName, injectionPoint, injection) { |
|
|
|
contract.instrumented = contract.instrumented.slice(0, injectionPoint) + |
|
|
|
contract.instrumented = contract.instrumented.slice(0, injectionPoint) + |
|
|
|
(injection.openBracket ? '{' : '') + |
|
|
|
(injection.openBracket ? '{' : '') + |
|
|
|
'__BranchCoverage' + contract.contractName + '(\'' + fileName + '\',' + injection.branchId + ',' + injection.locationIdx + ')' + |
|
|
|
'emit __BranchCoverage' + contract.contractName + '(\'' + fileName + '\',' + injection.branchId + ',' + injection.locationIdx + ')' + |
|
|
|
(injection.comma ? ',' : ';') + |
|
|
|
(injection.comma ? ',' : ';') + |
|
|
|
contract.instrumented.slice(injectionPoint); |
|
|
|
contract.instrumented.slice(injectionPoint); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
injector.callEmptyBranchEvent = function injectCallEmptyBranchEvent(contract, fileName, injectionPoint, injection) { |
|
|
|
injector.callEmptyBranchEvent = function injectCallEmptyBranchEvent(contract, fileName, injectionPoint, injection) { |
|
|
|
contract.instrumented = contract.instrumented.slice(0, injectionPoint) + |
|
|
|
contract.instrumented = contract.instrumented.slice(0, injectionPoint) + |
|
|
|
'else { __BranchCoverage' + contract.contractName + '(\'' + fileName + '\',' + injection.branchId + ',' + injection.locationIdx + ');}\n' + |
|
|
|
'else { emit __BranchCoverage' + contract.contractName + '(\'' + fileName + '\',' + injection.branchId + ',' + injection.locationIdx + ');}\n' + |
|
|
|
contract.instrumented.slice(injectionPoint); |
|
|
|
contract.instrumented.slice(injectionPoint); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
injector.callAssertPreEvent = function callAssertPreEvent(contract, fileName, injectionPoint, injection) { |
|
|
|
injector.callAssertPreEvent = function callAssertPreEvent(contract, fileName, injectionPoint, injection) { |
|
|
|
contract.instrumented = contract.instrumented.slice(0, injectionPoint) + |
|
|
|
contract.instrumented = contract.instrumented.slice(0, injectionPoint) + |
|
|
|
'__AssertPreCoverage' + contract.contractName + '(\'' + fileName + '\',' + injection.branchId + ');\n' + |
|
|
|
'emit __AssertPreCoverage' + contract.contractName + '(\'' + fileName + '\',' + injection.branchId + ');\n' + |
|
|
|
contract.instrumented.slice(injectionPoint); |
|
|
|
contract.instrumented.slice(injectionPoint); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
injector.callAssertPostEvent = function callAssertPostEvent(contract, fileName, injectionPoint, injection) { |
|
|
|
injector.callAssertPostEvent = function callAssertPostEvent(contract, fileName, injectionPoint, injection) { |
|
|
|
contract.instrumented = contract.instrumented.slice(0, injectionPoint) + |
|
|
|
contract.instrumented = contract.instrumented.slice(0, injectionPoint) + |
|
|
|
'__AssertPostCoverage' + contract.contractName + '(\'' + fileName + '\',' + injection.branchId + ');\n' + |
|
|
|
'emit __AssertPostCoverage' + contract.contractName + '(\'' + fileName + '\',' + injection.branchId + ');\n' + |
|
|
|
contract.instrumented.slice(injectionPoint); |
|
|
|
contract.instrumented.slice(injectionPoint); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -57,7 +57,7 @@ injector.literal = function injectLiteral(contract, fileName, injectionPoint, in |
|
|
|
|
|
|
|
|
|
|
|
injector.statement = function injectStatement(contract, fileName, injectionPoint, injection) { |
|
|
|
injector.statement = function injectStatement(contract, fileName, injectionPoint, injection) { |
|
|
|
contract.instrumented = contract.instrumented.slice(0, injectionPoint) + |
|
|
|
contract.instrumented = contract.instrumented.slice(0, injectionPoint) + |
|
|
|
' __StatementCoverage' + contract.contractName + '(\'' + fileName + '\',' + injection.statementId + ');\n' + |
|
|
|
'emit __StatementCoverage' + contract.contractName + '(\'' + fileName + '\',' + injection.statementId + ');\n' + |
|
|
|
contract.instrumented.slice(injectionPoint); |
|
|
|
contract.instrumented.slice(injectionPoint); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|