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
56805303
Commit
56805303
authored
Mar 17, 2020
by
aniket-engg
Committed by
Aniket
Mar 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
0.5.0 contracts integration tests updated
parent
52000695
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
221 additions
and
226 deletions
+221
-226
staticAnalysisCommon.ts
...zer/src/solidity-analyzer/modules/staticAnalysisCommon.ts
+5
-5
staticAnalysisIntegration-test-0.5.0.ts
...zer/test/analysis/staticAnalysisIntegration-test-0.5.0.ts
+188
-193
staticAnalysisIssues-test-0.5.0.ts
...analyzer/test/analysis/staticAnalysisIssues-test-0.5.0.ts
+28
-28
No files found.
remix-analyzer/src/solidity-analyzer/modules/staticAnalysisCommon.ts
View file @
56805303
...
@@ -448,18 +448,18 @@ function getFullQuallyfiedFuncDefinitionIdent (contract: ContractDefinitionAstNo
...
@@ -448,18 +448,18 @@ function getFullQuallyfiedFuncDefinitionIdent (contract: ContractDefinitionAstNo
function
getUnAssignedTopLevelBinOps
(
subScope
:
BlockAstNode
|
IfStatementAstNode
|
WhileStatementAstNode
|
ForStatementAstNode
):
ExpressionStatementAstNode
[]
{
function
getUnAssignedTopLevelBinOps
(
subScope
:
BlockAstNode
|
IfStatementAstNode
|
WhileStatementAstNode
|
ForStatementAstNode
):
ExpressionStatementAstNode
[]
{
let
result
:
ExpressionStatementAstNode
[]
=
[]
let
result
:
ExpressionStatementAstNode
[]
=
[]
if
(
subScope
.
nodeType
===
'Block'
)
if
(
subScope
&&
subScope
.
nodeType
===
'Block'
)
result
=
subScope
.
statements
.
filter
(
isBinaryOpInExpression
)
result
=
subScope
.
statements
.
filter
(
isBinaryOpInExpression
)
// for 'without braces' loops
// for 'without braces' loops
else
if
(
subScope
&&
subScope
.
nodeType
&&
isSubScopeStatement
(
subScope
))
{
else
if
(
subScope
&&
subScope
.
nodeType
&&
isSubScopeStatement
(
subScope
))
{
if
(
subScope
.
nodeType
===
'IfStatement'
){
if
(
subScope
.
nodeType
===
'IfStatement'
){
if
((
subScope
.
trueBody
.
nodeType
===
"ExpressionStatement"
&&
isBinaryOpInExpression
(
subScope
.
trueBody
)))
if
((
subScope
.
trueBody
&&
subScope
.
trueBody
.
nodeType
===
"ExpressionStatement"
&&
isBinaryOpInExpression
(
subScope
.
trueBody
)))
result
.
push
(
subScope
.
trueBody
)
result
.
push
(
subScope
.
trueBody
)
if
(
subScope
.
falseBody
.
nodeType
===
"ExpressionStatement"
&&
isBinaryOpInExpression
(
subScope
.
falseBody
))
if
(
subScope
.
falseBody
&&
subScope
.
falseBody
.
nodeType
===
"ExpressionStatement"
&&
isBinaryOpInExpression
(
subScope
.
falseBody
))
result
.
push
(
subScope
.
falseBody
)
result
.
push
(
subScope
.
falseBody
)
}
}
else
{
else
{
if
(
subScope
.
body
.
nodeType
===
"ExpressionStatement"
&&
isBinaryOpInExpression
(
subScope
.
body
))
if
(
subScope
.
body
&&
subScope
.
body
.
nodeType
===
"ExpressionStatement"
&&
isBinaryOpInExpression
(
subScope
.
body
))
result
.
push
(
subScope
.
body
)
result
.
push
(
subScope
.
body
)
}
}
}
}
...
@@ -982,7 +982,7 @@ function isStringToBytesConversion (node: FunctionCallAstNode): boolean {
...
@@ -982,7 +982,7 @@ function isStringToBytesConversion (node: FunctionCallAstNode): boolean {
function
isExplicitCast
(
node
:
FunctionCallAstNode
,
castFromType
:
string
,
castToType
:
string
):
boolean
{
function
isExplicitCast
(
node
:
FunctionCallAstNode
,
castFromType
:
string
,
castToType
:
string
):
boolean
{
return
node
.
kind
===
"typeConversion"
&&
return
node
.
kind
===
"typeConversion"
&&
nodeType
(
node
.
expression
,
exactMatch
(
nodeTypes
.
ELEMENTARYTYPENAMEEXPRESSION
))
&&
node
.
expression
.
typeName
.
name
===
castToType
&&
nodeType
(
node
.
expression
,
exactMatch
(
nodeTypes
.
ELEMENTARYTYPENAMEEXPRESSION
))
&&
node
.
expression
.
typeName
===
castToType
&&
nodeType
(
node
.
arguments
[
0
],
exactMatch
(
nodeTypes
.
IDENTIFIER
))
&&
typeDescription
(
node
.
arguments
[
0
],
castFromType
)
nodeType
(
node
.
arguments
[
0
],
exactMatch
(
nodeTypes
.
IDENTIFIER
))
&&
typeDescription
(
node
.
arguments
[
0
],
castFromType
)
}
}
...
...
remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.5.0.ts
View file @
56805303
...
@@ -6,7 +6,7 @@ import { default as StatRunner } from '../../dist/src/solidity-analyzer'
...
@@ -6,7 +6,7 @@ import { default as StatRunner } from '../../dist/src/solidity-analyzer'
import
{
install
,
require
as
requireNPMmodule
}
from
'npm-install-version'
import
{
install
,
require
as
requireNPMmodule
}
from
'npm-install-version'
install
(
'solc@0.5.0'
)
install
(
'solc@0.5.0'
)
const
compiler
=
requireNPMmodule
(
'solc@0.5.0'
)
const
compiler
=
requireNPMmodule
(
'solc@0.5.0'
)
const
{
compilerInput
}
=
helpers
.
compiler
const
{
compilerInput
}
=
helpers
.
compiler
const
folder
=
'solidity-v0.5'
const
folder
=
'solidity-v0.5'
const
testFiles
=
[
const
testFiles
=
[
...
@@ -30,12 +30,12 @@ const testFiles = [
...
@@ -30,12 +30,12 @@ const testFiles = [
'selfdestruct.sol'
,
'selfdestruct.sol'
,
'deleteDynamicArray.sol'
,
'deleteDynamicArray.sol'
,
'deleteFromDynamicArray.sol'
,
'deleteFromDynamicArray.sol'
,
//
'blockLevelCompare.sol',
'blockLevelCompare.sol'
,
//
'intDivisionTruncate.sol',
'intDivisionTruncate.sol'
,
//
'ERC20.sol',
'ERC20.sol'
,
//
'stringBytesLength.sol',
'stringBytesLength.sol'
,
//
'etherTransferInLoop.sol',
'etherTransferInLoop.sol'
,
//
'forLoopIteratesOverDynamicArray.sol'
'forLoopIteratesOverDynamicArray.sol'
]
]
var
testFileAsts
=
{}
var
testFileAsts
=
{}
...
@@ -45,16 +45,12 @@ testFiles.forEach((fileName) => {
...
@@ -45,16 +45,12 @@ testFiles.forEach((fileName) => {
testFileAsts
[
fileName
]
=
JSON
.
parse
(
compiler
.
compile
(
compilerInput
(
content
)))
testFileAsts
[
fileName
]
=
JSON
.
parse
(
compiler
.
compile
(
compilerInput
(
content
)))
})
})
// console.log(testFileAsts['ballot.sol'].sources['test.sol'].ast.nodes[1].nodes)
test
(
'Integration test thisLocal.js'
,
function
(
t
)
{
test
(
'Integration test thisLocal.js'
,
function
(
t
)
{
// console.log('testFileAsts---------',testFileAsts)
t
.
plan
(
testFiles
.
length
)
// t.plan(testFiles.length)
t
.
plan
(
20
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/thisLocal'
).
default
const
module
=
require
(
'../../dist/src/solidity-analyzer/modules/thisLocal'
).
default
var
lengthCheck
=
{
const
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
'assembly.sol'
:
0
,
'assembly.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
...
@@ -75,12 +71,12 @@ test('Integration test thisLocal.js', function (t) {
...
@@ -75,12 +71,12 @@ test('Integration test thisLocal.js', function (t) {
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
//
'blockLevelCompare.sol': 0,
'blockLevelCompare.sol'
:
0
,
//
'intDivisionTruncate.sol': 0,
'intDivisionTruncate.sol'
:
0
,
//
'ERC20.sol': 0,
'ERC20.sol'
:
0
,
//
'stringBytesLength.sol': 0,
'stringBytesLength.sol'
:
0
,
//
'etherTransferInLoop.sol': 0,
'etherTransferInLoop.sol'
:
0
,
//
'forLoopIteratesOverDynamicArray.sol': 0
'forLoopIteratesOverDynamicArray.sol'
:
0
}
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
@@ -89,11 +85,11 @@ test('Integration test thisLocal.js', function (t) {
...
@@ -89,11 +85,11 @@ test('Integration test thisLocal.js', function (t) {
})
})
test
(
'Integration test checksEffectsInteraction.js'
,
function
(
t
)
{
test
(
'Integration test checksEffectsInteraction.js'
,
function
(
t
)
{
t
.
plan
(
20
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/checksEffectsInteraction'
).
default
const
module
=
require
(
'../../dist/src/solidity-analyzer/modules/checksEffectsInteraction'
).
default
var
lengthCheck
=
{
const
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
1
,
'KingOfTheEtherThrone.sol'
:
1
,
'assembly.sol'
:
1
,
'assembly.sol'
:
1
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
...
@@ -114,12 +110,12 @@ test('Integration test checksEffectsInteraction.js', function (t) {
...
@@ -114,12 +110,12 @@ test('Integration test checksEffectsInteraction.js', function (t) {
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
//
'blockLevelCompare.sol': 0,
'blockLevelCompare.sol'
:
0
,
//
'intDivisionTruncate.sol': 0,
'intDivisionTruncate.sol'
:
0
,
//
'ERC20.sol': 0,
'ERC20.sol'
:
0
,
//
'stringBytesLength.sol': 0,
'stringBytesLength.sol'
:
0
,
//
'etherTransferInLoop.sol': 0,
'etherTransferInLoop.sol'
:
0
,
//
'forLoopIteratesOverDynamicArray.sol': 0
'forLoopIteratesOverDynamicArray.sol'
:
0
}
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
@@ -128,11 +124,11 @@ test('Integration test checksEffectsInteraction.js', function (t) {
...
@@ -128,11 +124,11 @@ test('Integration test checksEffectsInteraction.js', function (t) {
})
})
test
(
'Integration test constantFunctions.js'
,
function
(
t
)
{
test
(
'Integration test constantFunctions.js'
,
function
(
t
)
{
t
.
plan
(
20
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/constantFunctions'
).
default
const
module
=
require
(
'../../dist/src/solidity-analyzer/modules/constantFunctions'
).
default
var
lengthCheck
=
{
const
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
'assembly.sol'
:
0
,
'assembly.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
...
@@ -153,12 +149,12 @@ test('Integration test constantFunctions.js', function (t) {
...
@@ -153,12 +149,12 @@ test('Integration test constantFunctions.js', function (t) {
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
//
'blockLevelCompare.sol': 0,
'blockLevelCompare.sol'
:
0
,
//
'intDivisionTruncate.sol': 0,
'intDivisionTruncate.sol'
:
0
,
//
'ERC20.sol': 0,
'ERC20.sol'
:
0
,
//
'stringBytesLength.sol': 0,
'stringBytesLength.sol'
:
0
,
//
'etherTransferInLoop.sol': 0,
'etherTransferInLoop.sol'
:
0
,
//
'forLoopIteratesOverDynamicArray.sol': 0
'forLoopIteratesOverDynamicArray.sol'
:
0
}
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
@@ -167,11 +163,11 @@ test('Integration test constantFunctions.js', function (t) {
...
@@ -167,11 +163,11 @@ test('Integration test constantFunctions.js', function (t) {
})
})
test
(
'Integration test inlineAssembly.js'
,
function
(
t
)
{
test
(
'Integration test inlineAssembly.js'
,
function
(
t
)
{
t
.
plan
(
20
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/inlineAssembly'
).
default
const
module
=
require
(
'../../dist/src/solidity-analyzer/modules/inlineAssembly'
).
default
var
lengthCheck
=
{
const
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
'assembly.sol'
:
2
,
'assembly.sol'
:
2
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
...
@@ -192,12 +188,12 @@ test('Integration test inlineAssembly.js', function (t) {
...
@@ -192,12 +188,12 @@ test('Integration test inlineAssembly.js', function (t) {
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
//
'blockLevelCompare.sol': 0,
'blockLevelCompare.sol'
:
0
,
//
'intDivisionTruncate.sol': 0,
'intDivisionTruncate.sol'
:
0
,
//
'ERC20.sol': 0,
'ERC20.sol'
:
0
,
//
'stringBytesLength.sol': 0,
'stringBytesLength.sol'
:
0
,
//
'etherTransferInLoop.sol': 0,
'etherTransferInLoop.sol'
:
0
,
//
'forLoopIteratesOverDynamicArray.sol': 0
'forLoopIteratesOverDynamicArray.sol'
:
0
}
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
@@ -206,11 +202,11 @@ test('Integration test inlineAssembly.js', function (t) {
...
@@ -206,11 +202,11 @@ test('Integration test inlineAssembly.js', function (t) {
})
})
test
(
'Integration test txOrigin.js'
,
function
(
t
)
{
test
(
'Integration test txOrigin.js'
,
function
(
t
)
{
t
.
plan
(
20
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/txOrigin'
).
default
const
module
=
require
(
'../../dist/src/solidity-analyzer/modules/txOrigin'
).
default
var
lengthCheck
=
{
const
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
'assembly.sol'
:
1
,
'assembly.sol'
:
1
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
...
@@ -231,12 +227,12 @@ test('Integration test txOrigin.js', function (t) {
...
@@ -231,12 +227,12 @@ test('Integration test txOrigin.js', function (t) {
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
//
'blockLevelCompare.sol': 0,
'blockLevelCompare.sol'
:
0
,
//
'intDivisionTruncate.sol': 0,
'intDivisionTruncate.sol'
:
0
,
//
'ERC20.sol': 0,
'ERC20.sol'
:
0
,
//
'stringBytesLength.sol': 0,
'stringBytesLength.sol'
:
0
,
//
'etherTransferInLoop.sol': 0,
'etherTransferInLoop.sol'
:
0
,
//
'forLoopIteratesOverDynamicArray.sol': 0
'forLoopIteratesOverDynamicArray.sol'
:
0
}
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
@@ -245,11 +241,11 @@ test('Integration test txOrigin.js', function (t) {
...
@@ -245,11 +241,11 @@ test('Integration test txOrigin.js', function (t) {
})
})
test
(
'Integration test gasCosts.js'
,
function
(
t
)
{
test
(
'Integration test gasCosts.js'
,
function
(
t
)
{
t
.
plan
(
20
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/gasCosts'
).
default
const
module
=
require
(
'../../dist/src/solidity-analyzer/modules/gasCosts'
).
default
var
lengthCheck
=
{
const
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
2
,
'KingOfTheEtherThrone.sol'
:
2
,
'assembly.sol'
:
2
,
'assembly.sol'
:
2
,
'ballot.sol'
:
3
,
'ballot.sol'
:
3
,
...
@@ -270,12 +266,12 @@ test('Integration test gasCosts.js', function (t) {
...
@@ -270,12 +266,12 @@ test('Integration test gasCosts.js', function (t) {
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
2
,
'deleteDynamicArray.sol'
:
2
,
'deleteFromDynamicArray.sol'
:
1
,
'deleteFromDynamicArray.sol'
:
1
,
//
'blockLevelCompare.sol': 1,
'blockLevelCompare.sol'
:
1
,
//
'intDivisionTruncate.sol': 1,
'intDivisionTruncate.sol'
:
1
,
//
'ERC20.sol': 2,
'ERC20.sol'
:
2
,
//
'stringBytesLength.sol': 1,
'stringBytesLength.sol'
:
1
,
//
'etherTransferInLoop.sol': 3,
'etherTransferInLoop.sol'
:
3
,
//
'forLoopIteratesOverDynamicArray.sol': 2
'forLoopIteratesOverDynamicArray.sol'
:
2
}
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
@@ -284,11 +280,11 @@ test('Integration test gasCosts.js', function (t) {
...
@@ -284,11 +280,11 @@ test('Integration test gasCosts.js', function (t) {
})
})
test
(
'Integration test similarVariableNames.js'
,
function
(
t
)
{
test
(
'Integration test similarVariableNames.js'
,
function
(
t
)
{
t
.
plan
(
20
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/similarVariableNames'
).
default
const
module
=
require
(
'../../dist/src/solidity-analyzer/modules/similarVariableNames'
).
default
var
lengthCheck
=
{
const
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
'assembly.sol'
:
0
,
'assembly.sol'
:
0
,
'ballot.sol'
:
2
,
'ballot.sol'
:
2
,
...
@@ -309,12 +305,12 @@ test('Integration test similarVariableNames.js', function (t) {
...
@@ -309,12 +305,12 @@ test('Integration test similarVariableNames.js', function (t) {
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
1
,
'deleteDynamicArray.sol'
:
1
,
'deleteFromDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
//
'blockLevelCompare.sol': 0,
'blockLevelCompare.sol'
:
0
,
//
'intDivisionTruncate.sol': 0,
'intDivisionTruncate.sol'
:
0
,
//
'ERC20.sol': 0,
'ERC20.sol'
:
0
,
//
'stringBytesLength.sol': 0,
'stringBytesLength.sol'
:
0
,
//
'etherTransferInLoop.sol': 0,
'etherTransferInLoop.sol'
:
0
,
//
'forLoopIteratesOverDynamicArray.sol': 0
'forLoopIteratesOverDynamicArray.sol'
:
0
}
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
@@ -323,11 +319,11 @@ test('Integration test similarVariableNames.js', function (t) {
...
@@ -323,11 +319,11 @@ test('Integration test similarVariableNames.js', function (t) {
})
})
test
(
'Integration test blockTimestamp.js'
,
function
(
t
)
{
test
(
'Integration test blockTimestamp.js'
,
function
(
t
)
{
t
.
plan
(
20
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/blockTimestamp'
).
default
const
module
=
require
(
'../../dist/src/solidity-analyzer/modules/blockTimestamp'
).
default
var
lengthCheck
=
{
const
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
1
,
'KingOfTheEtherThrone.sol'
:
1
,
'assembly.sol'
:
0
,
'assembly.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
...
@@ -348,12 +344,12 @@ test('Integration test blockTimestamp.js', function (t) {
...
@@ -348,12 +344,12 @@ test('Integration test blockTimestamp.js', function (t) {
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
//
'blockLevelCompare.sol': 0,
'blockLevelCompare.sol'
:
0
,
//
'intDivisionTruncate.sol': 0,
'intDivisionTruncate.sol'
:
0
,
//
'ERC20.sol': 0,
'ERC20.sol'
:
0
,
//
'stringBytesLength.sol': 0,
'stringBytesLength.sol'
:
0
,
//
'etherTransferInLoop.sol': 0,
'etherTransferInLoop.sol'
:
0
,
//
'forLoopIteratesOverDynamicArray.sol': 0
'forLoopIteratesOverDynamicArray.sol'
:
0
}
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
@@ -362,11 +358,11 @@ test('Integration test blockTimestamp.js', function (t) {
...
@@ -362,11 +358,11 @@ test('Integration test blockTimestamp.js', function (t) {
})
})
test
(
'Integration test lowLevelCalls.js'
,
function
(
t
)
{
test
(
'Integration test lowLevelCalls.js'
,
function
(
t
)
{
t
.
plan
(
20
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/lowLevelCalls'
).
default
const
module
=
require
(
'../../dist/src/solidity-analyzer/modules/lowLevelCalls'
).
default
var
lengthCheck
=
{
const
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
1
,
'KingOfTheEtherThrone.sol'
:
1
,
'assembly.sol'
:
1
,
'assembly.sol'
:
1
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
...
@@ -387,12 +383,12 @@ test('Integration test lowLevelCalls.js', function (t) {
...
@@ -387,12 +383,12 @@ test('Integration test lowLevelCalls.js', function (t) {
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
//
'blockLevelCompare.sol': 0,
'blockLevelCompare.sol'
:
0
,
//
'intDivisionTruncate.sol': 0,
'intDivisionTruncate.sol'
:
0
,
//
'ERC20.sol': 0,
'ERC20.sol'
:
0
,
//
'stringBytesLength.sol': 0,
'stringBytesLength.sol'
:
0
,
//
'etherTransferInLoop.sol': 0,
'etherTransferInLoop.sol'
:
0
,
//
'forLoopIteratesOverDynamicArray.sol': 0
'forLoopIteratesOverDynamicArray.sol'
:
0
}
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
@@ -401,11 +397,11 @@ test('Integration test lowLevelCalls.js', function (t) {
...
@@ -401,11 +397,11 @@ test('Integration test lowLevelCalls.js', function (t) {
})
})
test
(
'Integration test blockBlockhash.js'
,
function
(
t
)
{
test
(
'Integration test blockBlockhash.js'
,
function
(
t
)
{
t
.
plan
(
20
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/blockBlockhash'
).
default
const
module
=
require
(
'../../dist/src/solidity-analyzer/modules/blockBlockhash'
).
default
var
lengthCheck
=
{
const
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
'assembly.sol'
:
0
,
'assembly.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
...
@@ -426,12 +422,12 @@ test('Integration test blockBlockhash.js', function (t) {
...
@@ -426,12 +422,12 @@ test('Integration test blockBlockhash.js', function (t) {
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
//
'blockLevelCompare.sol': 0,
'blockLevelCompare.sol'
:
0
,
//
'intDivisionTruncate.sol': 0,
'intDivisionTruncate.sol'
:
0
,
//
'ERC20.sol': 0,
'ERC20.sol'
:
0
,
//
'stringBytesLength.sol': 0,
'stringBytesLength.sol'
:
0
,
//
'etherTransferInLoop.sol': 0,
'etherTransferInLoop.sol'
:
0
,
//
'forLoopIteratesOverDynamicArray.sol': 0
'forLoopIteratesOverDynamicArray.sol'
:
0
}
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
@@ -440,11 +436,11 @@ test('Integration test blockBlockhash.js', function (t) {
...
@@ -440,11 +436,11 @@ test('Integration test blockBlockhash.js', function (t) {
})
})
test
(
'Integration test selfdestruct.js'
,
function
(
t
)
{
test
(
'Integration test selfdestruct.js'
,
function
(
t
)
{
t
.
plan
(
20
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/selfdestruct'
).
default
const
module
=
require
(
'../../dist/src/solidity-analyzer/modules/selfdestruct'
).
default
var
lengthCheck
=
{
const
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
'assembly.sol'
:
0
,
'assembly.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
...
@@ -465,12 +461,12 @@ test('Integration test selfdestruct.js', function (t) {
...
@@ -465,12 +461,12 @@ test('Integration test selfdestruct.js', function (t) {
'selfdestruct.sol'
:
3
,
'selfdestruct.sol'
:
3
,
'deleteDynamicArray.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
//
'blockLevelCompare.sol': 0,
'blockLevelCompare.sol'
:
0
,
//
'ERC20.sol': 0,
'ERC20.sol'
:
0
,
//
'intDivisionTruncate.sol': 5,
'intDivisionTruncate.sol'
:
5
,
//
'stringBytesLength.sol': 0,
'stringBytesLength.sol'
:
0
,
//
'etherTransferInLoop.sol': 0,
'etherTransferInLoop.sol'
:
0
,
//
'forLoopIteratesOverDynamicArray.sol': 0
'forLoopIteratesOverDynamicArray.sol'
:
0
}
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
@@ -479,11 +475,11 @@ test('Integration test selfdestruct.js', function (t) {
...
@@ -479,11 +475,11 @@ test('Integration test selfdestruct.js', function (t) {
})
})
test
(
'Integration test guardConditions.js'
,
function
(
t
)
{
test
(
'Integration test guardConditions.js'
,
function
(
t
)
{
t
.
plan
(
20
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/guardConditions'
).
default
const
module
=
require
(
'../../dist/src/solidity-analyzer/modules/guardConditions'
).
default
var
lengthCheck
=
{
const
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
'assembly.sol'
:
1
,
'assembly.sol'
:
1
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
...
@@ -504,12 +500,12 @@ test('Integration test guardConditions.js', function (t) {
...
@@ -504,12 +500,12 @@ test('Integration test guardConditions.js', function (t) {
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
1
,
'deleteDynamicArray.sol'
:
1
,
'deleteFromDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
//
'blockLevelCompare.sol': 0,
'blockLevelCompare.sol'
:
0
,
//
'intDivisionTruncate.sol': 1,
'intDivisionTruncate.sol'
:
1
,
//
'ERC20.sol': 0,
'ERC20.sol'
:
0
,
//
'stringBytesLength.sol': 0,
'stringBytesLength.sol'
:
0
,
//
'etherTransferInLoop.sol': 0,
'etherTransferInLoop.sol'
:
0
,
//
'forLoopIteratesOverDynamicArray.sol': 0
'forLoopIteratesOverDynamicArray.sol'
:
0
}
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
@@ -518,11 +514,11 @@ test('Integration test guardConditions.js', function (t) {
...
@@ -518,11 +514,11 @@ test('Integration test guardConditions.js', function (t) {
})
})
test
(
'Integration test deleteDynamicArrays.js'
,
function
(
t
)
{
test
(
'Integration test deleteDynamicArrays.js'
,
function
(
t
)
{
t
.
plan
(
20
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/deleteDynamicArrays'
).
default
const
module
=
require
(
'../../dist/src/solidity-analyzer/modules/deleteDynamicArrays'
).
default
var
lengthCheck
=
{
const
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
'assembly.sol'
:
0
,
'assembly.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
...
@@ -543,12 +539,12 @@ test('Integration test deleteDynamicArrays.js', function (t) {
...
@@ -543,12 +539,12 @@ test('Integration test deleteDynamicArrays.js', function (t) {
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
2
,
'deleteDynamicArray.sol'
:
2
,
'deleteFromDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
//
'blockLevelCompare.sol': 0,
'blockLevelCompare.sol'
:
0
,
//
'intDivisionTruncate.sol': 0,
'intDivisionTruncate.sol'
:
0
,
//
'ERC20.sol': 0,
'ERC20.sol'
:
0
,
//
'stringBytesLength.sol': 0,
'stringBytesLength.sol'
:
0
,
//
'etherTransferInLoop.sol': 0,
'etherTransferInLoop.sol'
:
0
,
//
'forLoopIteratesOverDynamicArray.sol': 0
'forLoopIteratesOverDynamicArray.sol'
:
0
}
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
@@ -557,11 +553,11 @@ test('Integration test deleteDynamicArrays.js', function (t) {
...
@@ -557,11 +553,11 @@ test('Integration test deleteDynamicArrays.js', function (t) {
})
})
test
(
'Integration test deleteFromDynamicArray.js'
,
function
(
t
)
{
test
(
'Integration test deleteFromDynamicArray.js'
,
function
(
t
)
{
t
.
plan
(
20
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/deleteFromDynamicArray'
).
default
const
module
=
require
(
'../../dist/src/solidity-analyzer/modules/deleteFromDynamicArray'
).
default
var
lengthCheck
=
{
const
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
'assembly.sol'
:
0
,
'assembly.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
...
@@ -582,12 +578,12 @@ test('Integration test deleteFromDynamicArray.js', function (t) {
...
@@ -582,12 +578,12 @@ test('Integration test deleteFromDynamicArray.js', function (t) {
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
1
,
'deleteFromDynamicArray.sol'
:
1
,
//
'blockLevelCompare.sol': 0,
'blockLevelCompare.sol'
:
0
,
//
'intDivisionTruncate.sol': 0,
'intDivisionTruncate.sol'
:
0
,
//
'ERC20.sol': 0,
'ERC20.sol'
:
0
,
//
'stringBytesLength.sol': 0,
'stringBytesLength.sol'
:
0
,
//
'etherTransferInLoop.sol': 0,
'etherTransferInLoop.sol'
:
0
,
//
'forLoopIteratesOverDynamicArray.sol': 0
'forLoopIteratesOverDynamicArray.sol'
:
0
}
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
@@ -596,11 +592,11 @@ test('Integration test deleteFromDynamicArray.js', function (t) {
...
@@ -596,11 +592,11 @@ test('Integration test deleteFromDynamicArray.js', function (t) {
})
})
test
(
'Integration test assignAndCompare.js'
,
function
(
t
)
{
test
(
'Integration test assignAndCompare.js'
,
function
(
t
)
{
t
.
plan
(
20
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/assignAndCompare'
).
default
const
module
=
require
(
'../../dist/src/solidity-analyzer/modules/assignAndCompare'
).
default
var
lengthCheck
=
{
const
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
'assembly.sol'
:
0
,
'assembly.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
...
@@ -621,12 +617,12 @@ test('Integration test assignAndCompare.js', function (t) {
...
@@ -621,12 +617,12 @@ test('Integration test assignAndCompare.js', function (t) {
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
//
'blockLevelCompare.sol': 8,
'blockLevelCompare.sol'
:
8
,
//
'intDivisionTruncate.sol': 0,
'intDivisionTruncate.sol'
:
0
,
//
'ERC20.sol': 0,
'ERC20.sol'
:
0
,
//
'stringBytesLength.sol': 0,
'stringBytesLength.sol'
:
0
,
//
'etherTransferInLoop.sol': 0,
'etherTransferInLoop.sol'
:
0
,
//
'forLoopIteratesOverDynamicArray.sol': 0
'forLoopIteratesOverDynamicArray.sol'
:
0
}
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
@@ -635,11 +631,11 @@ test('Integration test assignAndCompare.js', function (t) {
...
@@ -635,11 +631,11 @@ test('Integration test assignAndCompare.js', function (t) {
})
})
test
(
'Integration test intDivisionTruncate.js'
,
function
(
t
)
{
test
(
'Integration test intDivisionTruncate.js'
,
function
(
t
)
{
t
.
plan
(
20
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/intDivisionTruncate'
).
default
const
module
=
require
(
'../../dist/src/solidity-analyzer/modules/intDivisionTruncate'
).
default
var
lengthCheck
=
{
const
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
'assembly.sol'
:
0
,
'assembly.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
...
@@ -660,12 +656,12 @@ test('Integration test intDivisionTruncate.js', function (t) {
...
@@ -660,12 +656,12 @@ test('Integration test intDivisionTruncate.js', function (t) {
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
//
'blockLevelCompare.sol': 0,
'blockLevelCompare.sol'
:
0
,
//
'intDivisionTruncate.sol': 2,
'intDivisionTruncate.sol'
:
2
,
//
'ERC20.sol': 0,
'ERC20.sol'
:
0
,
//
'stringBytesLength.sol': 0,
'stringBytesLength.sol'
:
0
,
//
'etherTransferInLoop.sol': 0,
'etherTransferInLoop.sol'
:
0
,
//
'forLoopIteratesOverDynamicArray.sol': 0
'forLoopIteratesOverDynamicArray.sol'
:
0
}
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
@@ -674,11 +670,11 @@ test('Integration test intDivisionTruncate.js', function (t) {
...
@@ -674,11 +670,11 @@ test('Integration test intDivisionTruncate.js', function (t) {
})
})
test
(
'Integration test erc20Decimal.js'
,
function
(
t
)
{
test
(
'Integration test erc20Decimal.js'
,
function
(
t
)
{
t
.
plan
(
20
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/erc20Decimals'
).
default
const
module
=
require
(
'../../dist/src/solidity-analyzer/modules/erc20Decimals'
).
default
var
lengthCheck
=
{
const
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
'assembly.sol'
:
0
,
'assembly.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
...
@@ -699,12 +695,12 @@ test('Integration test erc20Decimal.js', function (t) {
...
@@ -699,12 +695,12 @@ test('Integration test erc20Decimal.js', function (t) {
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
//
'blockLevelCompare.sol': 0,
'blockLevelCompare.sol'
:
0
,
//
'intDivisionTruncate.sol': 0,
'intDivisionTruncate.sol'
:
0
,
//
'ERC20.sol': 1,
'ERC20.sol'
:
1
,
//
'stringBytesLength.sol': 0,
'stringBytesLength.sol'
:
0
,
//
'etherTransferInLoop.sol': 0,
'etherTransferInLoop.sol'
:
0
,
//
'forLoopIteratesOverDynamicArray.sol': 0
'forLoopIteratesOverDynamicArray.sol'
:
0
}
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
@@ -713,11 +709,11 @@ test('Integration test erc20Decimal.js', function (t) {
...
@@ -713,11 +709,11 @@ test('Integration test erc20Decimal.js', function (t) {
})
})
test
(
'Integration test stringBytesLength.js'
,
function
(
t
)
{
test
(
'Integration test stringBytesLength.js'
,
function
(
t
)
{
t
.
plan
(
20
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/stringBytesLength'
).
default
const
module
=
require
(
'../../dist/src/solidity-analyzer/modules/stringBytesLength'
).
default
var
lengthCheck
=
{
const
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
'assembly.sol'
:
0
,
'assembly.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
...
@@ -738,12 +734,12 @@ test('Integration test stringBytesLength.js', function (t) {
...
@@ -738,12 +734,12 @@ test('Integration test stringBytesLength.js', function (t) {
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
//
'blockLevelCompare.sol': 0,
'blockLevelCompare.sol'
:
0
,
//
'intDivisionTruncate.sol': 0,
'intDivisionTruncate.sol'
:
0
,
//
'ERC20.sol': 0,
'ERC20.sol'
:
0
,
//
'stringBytesLength.sol': 1,
'stringBytesLength.sol'
:
1
,
//
'etherTransferInLoop.sol': 0,
'etherTransferInLoop.sol'
:
0
,
//
'forLoopIteratesOverDynamicArray.sol': 0
'forLoopIteratesOverDynamicArray.sol'
:
0
}
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
@@ -752,11 +748,11 @@ test('Integration test stringBytesLength.js', function (t) {
...
@@ -752,11 +748,11 @@ test('Integration test stringBytesLength.js', function (t) {
})
})
test
(
'Integration test etherTransferInLoop.js'
,
function
(
t
)
{
test
(
'Integration test etherTransferInLoop.js'
,
function
(
t
)
{
t
.
plan
(
20
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/etherTransferInLoop'
).
default
const
module
=
require
(
'../../dist/src/solidity-analyzer/modules/etherTransferInLoop'
).
default
var
lengthCheck
=
{
const
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
'assembly.sol'
:
0
,
'assembly.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
...
@@ -777,12 +773,12 @@ test('Integration test etherTransferInLoop.js', function (t) {
...
@@ -777,12 +773,12 @@ test('Integration test etherTransferInLoop.js', function (t) {
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
//
'blockLevelCompare.sol': 0,
'blockLevelCompare.sol'
:
0
,
//
'intDivisionTruncate.sol': 0,
'intDivisionTruncate.sol'
:
0
,
//
'ERC20.sol': 0,
'ERC20.sol'
:
0
,
//
'stringBytesLength.sol': 0,
'stringBytesLength.sol'
:
0
,
//
'etherTransferInLoop.sol': 3,
'etherTransferInLoop.sol'
:
3
,
//
'forLoopIteratesOverDynamicArray.sol': 0
'forLoopIteratesOverDynamicArray.sol'
:
0
}
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
@@ -791,11 +787,11 @@ test('Integration test etherTransferInLoop.js', function (t) {
...
@@ -791,11 +787,11 @@ test('Integration test etherTransferInLoop.js', function (t) {
})
})
test
(
'Integration test forLoopIteratesOverDynamicArray.js'
,
function
(
t
)
{
test
(
'Integration test forLoopIteratesOverDynamicArray.js'
,
function
(
t
)
{
t
.
plan
(
20
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/forLoopIteratesOverDynamicArray'
).
default
const
module
=
require
(
'../../dist/src/solidity-analyzer/modules/forLoopIteratesOverDynamicArray'
).
default
var
lengthCheck
=
{
const
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
'assembly.sol'
:
0
,
'assembly.sol'
:
0
,
'ballot.sol'
:
2
,
'ballot.sol'
:
2
,
...
@@ -816,12 +812,12 @@ test('Integration test forLoopIteratesOverDynamicArray.js', function (t) {
...
@@ -816,12 +812,12 @@ test('Integration test forLoopIteratesOverDynamicArray.js', function (t) {
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
//
'blockLevelCompare.sol': 0,
'blockLevelCompare.sol'
:
0
,
//
'intDivisionTruncate.sol': 0,
'intDivisionTruncate.sol'
:
0
,
//
'ERC20.sol': 0,
'ERC20.sol'
:
0
,
//
'stringBytesLength.sol': 0,
'stringBytesLength.sol'
:
0
,
//
'etherTransferInLoop.sol': 0,
'etherTransferInLoop.sol'
:
0
,
//
'forLoopIteratesOverDynamicArray.sol': 2
'forLoopIteratesOverDynamicArray.sol'
:
2
}
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
@@ -831,11 +827,10 @@ test('Integration test forLoopIteratesOverDynamicArray.js', function (t) {
...
@@ -831,11 +827,10 @@ test('Integration test forLoopIteratesOverDynamicArray.js', function (t) {
// #################### Helpers
// #################### Helpers
function
runModuleOnFiles
(
Module
,
t
,
cb
)
{
function
runModuleOnFiles
(
Module
,
t
,
cb
)
{
var
statRunner
=
new
StatRunner
()
const
statRunner
=
new
StatRunner
()
testFiles
.
forEach
((
fileName
)
=>
{
testFiles
.
forEach
((
fileName
)
=>
{
statRunner
.
runWithModuleList
(
testFileAsts
[
fileName
],
[{
name
:
new
Module
().
name
,
mod
:
new
Module
()
}],
(
reports
)
=>
{
statRunner
.
runWithModuleList
(
testFileAsts
[
fileName
],
[{
name
:
new
Module
().
name
,
mod
:
new
Module
()
}],
(
reports
)
=>
{
let
report
=
reports
[
0
].
report
let
report
=
reports
[
0
].
report
// console.log('reports----', report)
if
(
report
.
some
((
x
)
=>
x
[
'warning'
].
includes
(
'INTERNAL ERROR'
)))
{
if
(
report
.
some
((
x
)
=>
x
[
'warning'
].
includes
(
'INTERNAL ERROR'
)))
{
t
.
comment
(
'Error while executing Module: '
+
JSON
.
stringify
(
report
))
t
.
comment
(
'Error while executing Module: '
+
JSON
.
stringify
(
report
))
}
}
...
...
remix-analyzer/test/analysis/staticAnalysisIssues-test-0.5.0.ts
View file @
56805303
//
import { default as test} from "tape"
import
{
default
as
test
}
from
"tape"
//
import { helpers } from 'remix-lib'
import
{
helpers
}
from
'remix-lib'
//
import { readFileSync } from 'fs'
import
{
readFileSync
}
from
'fs'
//
import { join } from 'path'
import
{
join
}
from
'path'
//
import { default as StatRunner } from '../../dist/src/solidity-analyzer'
import
{
default
as
StatRunner
}
from
'../../dist/src/solidity-analyzer'
//
import { install, require as requireNPMmodule } from 'npm-install-version'
import
{
install
,
require
as
requireNPMmodule
}
from
'npm-install-version'
//
install('solc@0.5.0')
install
(
'solc@0.5.0'
)
//
const compiler = requireNPMmodule('solc@0.5.0')
const
compiler
=
requireNPMmodule
(
'solc@0.5.0'
)
//
const {compilerInput } = helpers.compiler
const
{
compilerInput
}
=
helpers
.
compiler
//
const folder = 'solidity-v0.5'
const
folder
=
'solidity-v0.5'
//
function compile (fileName) {
function
compile
(
fileName
)
{
//
const content = readFileSync(join(__dirname, 'test-contracts/' + folder, fileName), 'utf8')
const
content
=
readFileSync
(
join
(
__dirname
,
'test-contracts/'
+
folder
,
fileName
),
'utf8'
)
//
return JSON.parse(compiler.compile(compilerInput(content)))
return
JSON
.
parse
(
compiler
.
compile
(
compilerInput
(
content
)))
//
}
}
//
test('staticAnalysisIssues.functionParameterPassingError', function (t) {
test
(
'staticAnalysisIssues.functionParameterPassingError'
,
function
(
t
)
{
//
// https://github.com/ethereum/remix-ide/issues/889#issuecomment-351746474
// https://github.com/ethereum/remix-ide/issues/889#issuecomment-351746474
//
t.plan(2)
t
.
plan
(
2
)
//
const res = compile('functionParameters.sol')
const
res
=
compile
(
'functionParameters.sol'
)
//
const Module = require('../../dist/src/solidity-analyzer/modules/checksEffectsInteraction').default
const
Module
=
require
(
'../../dist/src/solidity-analyzer/modules/checksEffectsInteraction'
).
default
//
const statRunner = new StatRunner()
const
statRunner
=
new
StatRunner
()
//
t.doesNotThrow(() => {
t
.
doesNotThrow
(()
=>
{
//
statRunner.runWithModuleList(res, [{ name: new Module().name, mod: new Module() }], (reports) => {
statRunner
.
runWithModuleList
(
res
,
[{
name
:
new
Module
().
name
,
mod
:
new
Module
()
}],
(
reports
)
=>
{
//
})
})
//
}, 'Analysis should not throw')
},
'Analysis should not throw'
)
//
statRunner.runWithModuleList(res, [{ name: new Module().name, mod: new Module() }], (reports) => {
statRunner
.
runWithModuleList
(
res
,
[{
name
:
new
Module
().
name
,
mod
:
new
Module
()
}],
(
reports
)
=>
{
//
t.ok(!reports.some((mod) => mod.report.some((rep) => rep.warning.includes('INTERNAL ERROR')), 'Should not have internal errors'))
t
.
ok
(
!
reports
.
some
((
mod
)
=>
mod
.
report
.
some
((
rep
)
=>
rep
.
warning
.
includes
(
'INTERNAL ERROR'
)),
'Should not have internal errors'
))
//
})
})
//
})
})
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