Commit b8e2db29 authored by Michael Fröwis's avatar Michael Fröwis Committed by chriseth

Static Analysis: more unit tests

parent f9f03813
......@@ -412,6 +412,9 @@ test('staticAnalysisCommon.getSuperLocalCallName', function (t) {
],
'name': 'MemberAccess'
}
test('staticAnalysisCommon.getExternalDirectCallContractName', function (t) {
t.plan(3)
var localCall = {
'attributes': {
'type': 'tuple()',
......@@ -520,6 +523,7 @@ test('staticAnalysisCommon.getExternalDirectCallContractName', function (t) {
name: 'MemberAccess',
src: '405:6:0'
}
t.ok(common.getExternalDirectCallContractName(externalDirect) === 'InfoFeed', 'external direct call contract name from node')
t.throws(() => common.getExternalDirectCallContractName(thisLocalCall), undefined, 'throws on other nodes')
t.throws(() => common.getExternalDirectCallContractName(localCall), undefined, 'throws on other nodes')
......@@ -811,6 +815,7 @@ test('staticAnalysisCommon.getStateVariableDeclarationsFormContractNode', functi
'name': 'ContractDefinition'
}
var res = common.getStateVariableDeclarationsFormContractNode(contract).map(common.getDeclaredVariableName)
t.ok(res[0] === 'chairperson', 'var 1 should be ')
t.ok(res[1] === 'voters', 'var 2 should be ')
t.ok(res[2] === 'proposals', 'var 3 should be ')
......@@ -1192,6 +1197,7 @@ test('staticAnalysisCommon.isBuiltinFunctionCall', function (t) {
t.notOk(common.isBuiltinFunctionCall(localCall), 'local call is not builtin')
})
test('staticAnalysisCommon.isStorageVariableDeclaration', function (t) {
t.plan(3)
var node1 = {
......@@ -1713,6 +1719,7 @@ test('staticAnalysisCommon.isBlockTimestampAccess', function (t) {
t.notOk(common.isNowAccess(node), 'is now used should not work')
})
<<<<<<< 1ca54743848c4b5087105325dbc095c1b6a8b428
test('staticAnalysisCommon.isBlockBlockhashAccess', function (t) {
t.plan(4)
var node = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment