Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
b8e2db29
Commit
b8e2db29
authored
Mar 31, 2017
by
Michael Fröwis
Committed by
chriseth
May 17, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Static Analysis: more unit tests
parent
f9f03813
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
staticAnalysisCommon-test.js
test/staticanalysis/staticAnalysisCommon-test.js
+7
-0
No files found.
test/staticanalysis/staticAnalysisCommon-test.js
View file @
b8e2db29
...
@@ -412,6 +412,9 @@ test('staticAnalysisCommon.getSuperLocalCallName', function (t) {
...
@@ -412,6 +412,9 @@ test('staticAnalysisCommon.getSuperLocalCallName', function (t) {
],
],
'name'
:
'MemberAccess'
'name'
:
'MemberAccess'
}
}
test
(
'staticAnalysisCommon.getExternalDirectCallContractName'
,
function
(
t
)
{
t
.
plan
(
3
)
var
localCall
=
{
var
localCall
=
{
'attributes'
:
{
'attributes'
:
{
'type'
:
'tuple()'
,
'type'
:
'tuple()'
,
...
@@ -520,6 +523,7 @@ test('staticAnalysisCommon.getExternalDirectCallContractName', function (t) {
...
@@ -520,6 +523,7 @@ test('staticAnalysisCommon.getExternalDirectCallContractName', function (t) {
name
:
'MemberAccess'
,
name
:
'MemberAccess'
,
src
:
'405:6:0'
src
:
'405:6:0'
}
}
t
.
ok
(
common
.
getExternalDirectCallContractName
(
externalDirect
)
===
'InfoFeed'
,
'external direct call contract name from node'
)
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
(
thisLocalCall
),
undefined
,
'throws on other nodes'
)
t
.
throws
(()
=>
common
.
getExternalDirectCallContractName
(
localCall
),
undefined
,
'throws on other nodes'
)
t
.
throws
(()
=>
common
.
getExternalDirectCallContractName
(
localCall
),
undefined
,
'throws on other nodes'
)
...
@@ -811,6 +815,7 @@ test('staticAnalysisCommon.getStateVariableDeclarationsFormContractNode', functi
...
@@ -811,6 +815,7 @@ test('staticAnalysisCommon.getStateVariableDeclarationsFormContractNode', functi
'name'
:
'ContractDefinition'
'name'
:
'ContractDefinition'
}
}
var
res
=
common
.
getStateVariableDeclarationsFormContractNode
(
contract
).
map
(
common
.
getDeclaredVariableName
)
var
res
=
common
.
getStateVariableDeclarationsFormContractNode
(
contract
).
map
(
common
.
getDeclaredVariableName
)
t
.
ok
(
res
[
0
]
===
'chairperson'
,
'var 1 should be '
)
t
.
ok
(
res
[
0
]
===
'chairperson'
,
'var 1 should be '
)
t
.
ok
(
res
[
1
]
===
'voters'
,
'var 2 should be '
)
t
.
ok
(
res
[
1
]
===
'voters'
,
'var 2 should be '
)
t
.
ok
(
res
[
2
]
===
'proposals'
,
'var 3 should be '
)
t
.
ok
(
res
[
2
]
===
'proposals'
,
'var 3 should be '
)
...
@@ -1192,6 +1197,7 @@ test('staticAnalysisCommon.isBuiltinFunctionCall', function (t) {
...
@@ -1192,6 +1197,7 @@ test('staticAnalysisCommon.isBuiltinFunctionCall', function (t) {
t
.
notOk
(
common
.
isBuiltinFunctionCall
(
localCall
),
'local call is not builtin'
)
t
.
notOk
(
common
.
isBuiltinFunctionCall
(
localCall
),
'local call is not builtin'
)
})
})
test
(
'staticAnalysisCommon.isStorageVariableDeclaration'
,
function
(
t
)
{
test
(
'staticAnalysisCommon.isStorageVariableDeclaration'
,
function
(
t
)
{
t
.
plan
(
3
)
t
.
plan
(
3
)
var
node1
=
{
var
node1
=
{
...
@@ -1713,6 +1719,7 @@ test('staticAnalysisCommon.isBlockTimestampAccess', function (t) {
...
@@ -1713,6 +1719,7 @@ test('staticAnalysisCommon.isBlockTimestampAccess', function (t) {
t
.
notOk
(
common
.
isNowAccess
(
node
),
'is now used should not work'
)
t
.
notOk
(
common
.
isNowAccess
(
node
),
'is now used should not work'
)
})
})
<<<<<<<
1
ca54743848c4b5087105325dbc095c1b6a8b428
test
(
'staticAnalysisCommon.isBlockBlockhashAccess'
,
function
(
t
)
{
test
(
'staticAnalysisCommon.isBlockBlockhashAccess'
,
function
(
t
)
{
t
.
plan
(
4
)
t
.
plan
(
4
)
var
node
=
{
var
node
=
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment