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
d3ebc4e8
Commit
d3ebc4e8
authored
Oct 03, 2018
by
0mkar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add forLoopIteratesOverDynamicArray tests
parent
cd6e23a8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
94 additions
and
21 deletions
+94
-21
staticAnalysisIntegration-test.js
...-analyzer/test/analysis/staticAnalysisIntegration-test.js
+80
-21
forLoopIteratesOverDynamicArray.sol
...alysis/test-contracts/forLoopIteratesOverDynamicArray.sol
+14
-0
No files found.
remix-analyzer/test/analysis/staticAnalysisIntegration-test.js
View file @
d3ebc4e8
...
...
@@ -33,7 +33,8 @@ var testFiles = [
'blockLevelCompare.sol'
,
'intDivisionTruncate.sol'
,
'ERC20.sol'
,
'stringBytesLength.sol'
'stringBytesLength.sol'
,
'forLoopIteratesOverDynamicArray.sol'
]
var
testFileAsts
=
{}
...
...
@@ -72,7 +73,8 @@ test('Integration test thisLocal.js', function (t) {
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
0
,
'stringBytesLength.sol'
:
0
'stringBytesLength.sol'
:
0
,
'forLoopIteratesOverDynamicArray.sol'
:
0
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
...
@@ -109,7 +111,8 @@ test('Integration test checksEffectsInteraction.js', function (t) {
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
0
,
'stringBytesLength.sol'
:
0
'stringBytesLength.sol'
:
0
,
'forLoopIteratesOverDynamicArray.sol'
:
0
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
...
@@ -146,7 +149,8 @@ test('Integration test constantFunctions.js', function (t) {
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
0
,
'stringBytesLength.sol'
:
0
'stringBytesLength.sol'
:
0
,
'forLoopIteratesOverDynamicArray.sol'
:
0
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
...
@@ -183,7 +187,8 @@ test('Integration test inlineAssembly.js', function (t) {
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
0
,
'stringBytesLength.sol'
:
0
'stringBytesLength.sol'
:
0
,
'forLoopIteratesOverDynamicArray.sol'
:
0
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
...
@@ -220,7 +225,8 @@ test('Integration test txOrigin.js', function (t) {
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
0
,
'stringBytesLength.sol'
:
0
'stringBytesLength.sol'
:
0
,
'forLoopIteratesOverDynamicArray.sol'
:
0
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
...
@@ -257,7 +263,8 @@ test('Integration test gasCosts.js', function (t) {
'blockLevelCompare.sol'
:
1
,
'intDivisionTruncate.sol'
:
1
,
'ERC20.sol'
:
2
,
'stringBytesLength.sol'
:
1
'stringBytesLength.sol'
:
1
,
'forLoopIteratesOverDynamicArray.sol'
:
1
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
...
@@ -294,7 +301,8 @@ test('Integration test similarVariableNames.js', function (t) {
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
0
,
'stringBytesLength.sol'
:
0
'stringBytesLength.sol'
:
0
,
'forLoopIteratesOverDynamicArray.sol'
:
0
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
...
@@ -331,7 +339,8 @@ test('Integration test inlineAssembly.js', function (t) {
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
0
,
'stringBytesLength.sol'
:
0
'stringBytesLength.sol'
:
0
,
'forLoopIteratesOverDynamicArray.sol'
:
0
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
...
@@ -368,7 +377,8 @@ test('Integration test blockTimestamp.js', function (t) {
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
0
,
'stringBytesLength.sol'
:
0
'stringBytesLength.sol'
:
0
,
'forLoopIteratesOverDynamicArray.sol'
:
0
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
...
@@ -405,7 +415,8 @@ test('Integration test lowLevelCalls.js', function (t) {
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
0
,
'stringBytesLength.sol'
:
0
'stringBytesLength.sol'
:
0
,
'forLoopIteratesOverDynamicArray.sol'
:
0
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
...
@@ -442,7 +453,8 @@ test('Integration test blockBlockhash.js', function (t) {
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
0
,
'stringBytesLength.sol'
:
0
'stringBytesLength.sol'
:
0
,
'forLoopIteratesOverDynamicArray.sol'
:
0
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
...
@@ -479,7 +491,8 @@ test('Integration test noReturn.js', function (t) {
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
0
,
'stringBytesLength.sol'
:
0
'stringBytesLength.sol'
:
0
,
'forLoopIteratesOverDynamicArray.sol'
:
0
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
...
@@ -516,7 +529,8 @@ test('Integration test selfdestruct.js', function (t) {
'blockLevelCompare.sol'
:
0
,
'ERC20.sol'
:
0
,
'intDivisionTruncate.sol'
:
5
,
'stringBytesLength.sol'
:
0
'stringBytesLength.sol'
:
0
,
'forLoopIteratesOverDynamicArray.sol'
:
0
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
...
@@ -553,7 +567,8 @@ test('Integration test guardConditions.js', function (t) {
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
1
,
'ERC20.sol'
:
0
,
'stringBytesLength.sol'
:
0
'stringBytesLength.sol'
:
0
,
'forLoopIteratesOverDynamicArray.sol'
:
0
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
...
@@ -590,7 +605,8 @@ test('Integration test deleteDynamicArrays.js', function (t) {
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
0
,
'stringBytesLength.sol'
:
0
'stringBytesLength.sol'
:
0
,
'forLoopIteratesOverDynamicArray.sol'
:
0
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
...
@@ -627,7 +643,8 @@ test('Integration test deleteFromDynamicArray.js', function (t) {
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
0
,
'stringBytesLength.sol'
:
0
'stringBytesLength.sol'
:
0
,
'forLoopIteratesOverDynamicArray.sol'
:
0
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
...
@@ -664,7 +681,8 @@ test('Integration test assignAndCompare.js', function (t) {
'blockLevelCompare.sol'
:
8
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
0
,
'stringBytesLength.sol'
:
0
'stringBytesLength.sol'
:
0
,
'forLoopIteratesOverDynamicArray.sol'
:
0
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
...
@@ -701,7 +719,8 @@ test('Integration test intDivisionTruncate.js', function (t) {
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
2
,
'ERC20.sol'
:
0
,
'stringBytesLength.sol'
:
0
'stringBytesLength.sol'
:
0
,
'forLoopIteratesOverDynamicArray.sol'
:
0
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
...
@@ -738,7 +757,8 @@ test('Integration test erc20Decimal.js', function (t) {
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
1
,
'stringBytesLength.sol'
:
0
'stringBytesLength.sol'
:
0
,
'forLoopIteratesOverDynamicArray.sol'
:
0
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
...
@@ -775,7 +795,8 @@ test('Integration test stringBytesLength.js', function (t) {
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
0
,
'stringBytesLength.sol'
:
1
'stringBytesLength.sol'
:
1
,
'forLoopIteratesOverDynamicArray.sol'
:
0
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
...
...
@@ -783,6 +804,44 @@ test('Integration test stringBytesLength.js', function (t) {
})
})
test
(
'Integration test forLoopIteratesOverDynamicArray.js'
,
function
(
t
)
{
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../src/solidity-analyzer/modules/forLoopIteratesOverDynamicArray'
)
var
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'assembly.sol'
:
0
,
'ballot.sol'
:
2
,
'ballot_reentrant.sol'
:
1
,
'ballot_withoutWarnings.sol'
:
0
,
'cross_contract.sol'
:
0
,
'inheritance.sol'
:
0
,
'modifier1.sol'
:
0
,
'modifier2.sol'
:
0
,
'notReentrant.sol'
:
0
,
'structReentrant.sol'
:
0
,
'thisLocal.sol'
:
0
,
'globals.sol'
:
0
,
'library.sol'
:
0
,
'transfer.sol'
:
0
,
'ctor.sol'
:
0
,
'forgottenReturn.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
0
,
'stringBytesLength.sol'
:
0
,
'forLoopIteratesOverDynamicArray.sol'
:
1
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
t
.
equal
(
report
.
length
,
lengthCheck
[
file
],
`
${
file
}
has right amount of forLoopIteratesOverDynamicArray warnings`
)
})
})
// #################### Helpers
function
runModuleOnFiles
(
module
,
t
,
cb
)
{
var
statRunner
=
new
StatRunner
()
...
...
remix-analyzer/test/analysis/test-contracts/forLoopIteratesOverDynamicArray.sol
0 → 100644
View file @
d3ebc4e8
pragma solidity ^0.4.22;
contract forLoopArr {
uint[] array;
constructor(uint[] _array) {
array = _array;
}
function shiftArrItem(uint index) returns(uint[]) {
for (uint i = index; i < array.length-1; i++) {
array[i] = array[i+1];
}
return array;
}
}
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