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
cd6e23a8
Commit
cd6e23a8
authored
Oct 03, 2018
by
0mkar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add deleteFromDynamicArray tests
parent
80181a1d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
0 deletions
+78
-0
staticAnalysisIntegration-test.js
...-analyzer/test/analysis/staticAnalysisIntegration-test.js
+57
-0
deleteFromDynamicArray.sol
...r/test/analysis/test-contracts/deleteFromDynamicArray.sol
+21
-0
No files found.
remix-analyzer/test/analysis/staticAnalysisIntegration-test.js
View file @
cd6e23a8
...
@@ -29,6 +29,7 @@ var testFiles = [
...
@@ -29,6 +29,7 @@ var testFiles = [
'forgottenReturn.sol'
,
'forgottenReturn.sol'
,
'selfdestruct.sol'
,
'selfdestruct.sol'
,
'deleteDynamicArray.sol'
,
'deleteDynamicArray.sol'
,
'deleteFromDynamicArray.sol'
,
'blockLevelCompare.sol'
,
'blockLevelCompare.sol'
,
'intDivisionTruncate.sol'
,
'intDivisionTruncate.sol'
,
'ERC20.sol'
,
'ERC20.sol'
,
...
@@ -67,6 +68,7 @@ test('Integration test thisLocal.js', function (t) {
...
@@ -67,6 +68,7 @@ test('Integration test thisLocal.js', function (t) {
'forgottenReturn.sol'
:
0
,
'forgottenReturn.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
0
,
'ERC20.sol'
:
0
,
...
@@ -103,6 +105,7 @@ test('Integration test checksEffectsInteraction.js', function (t) {
...
@@ -103,6 +105,7 @@ test('Integration test checksEffectsInteraction.js', function (t) {
'forgottenReturn.sol'
:
0
,
'forgottenReturn.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
0
,
'ERC20.sol'
:
0
,
...
@@ -139,6 +142,7 @@ test('Integration test constantFunctions.js', function (t) {
...
@@ -139,6 +142,7 @@ test('Integration test constantFunctions.js', function (t) {
'forgottenReturn.sol'
:
0
,
'forgottenReturn.sol'
:
0
,
'selfdestruct.sol'
:
1
,
'selfdestruct.sol'
:
1
,
'deleteDynamicArray.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
0
,
'ERC20.sol'
:
0
,
...
@@ -175,6 +179,7 @@ test('Integration test inlineAssembly.js', function (t) {
...
@@ -175,6 +179,7 @@ test('Integration test inlineAssembly.js', function (t) {
'forgottenReturn.sol'
:
0
,
'forgottenReturn.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
0
,
'ERC20.sol'
:
0
,
...
@@ -211,6 +216,7 @@ test('Integration test txOrigin.js', function (t) {
...
@@ -211,6 +216,7 @@ test('Integration test txOrigin.js', function (t) {
'forgottenReturn.sol'
:
0
,
'forgottenReturn.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
0
,
'ERC20.sol'
:
0
,
...
@@ -247,6 +253,7 @@ test('Integration test gasCosts.js', function (t) {
...
@@ -247,6 +253,7 @@ test('Integration test gasCosts.js', function (t) {
'forgottenReturn.sol'
:
3
,
'forgottenReturn.sol'
:
3
,
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
2
,
'deleteDynamicArray.sol'
:
2
,
'deleteFromDynamicArray.sol'
:
2
,
'blockLevelCompare.sol'
:
1
,
'blockLevelCompare.sol'
:
1
,
'intDivisionTruncate.sol'
:
1
,
'intDivisionTruncate.sol'
:
1
,
'ERC20.sol'
:
2
,
'ERC20.sol'
:
2
,
...
@@ -283,6 +290,7 @@ test('Integration test similarVariableNames.js', function (t) {
...
@@ -283,6 +290,7 @@ test('Integration test similarVariableNames.js', function (t) {
'forgottenReturn.sol'
:
0
,
'forgottenReturn.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
1
,
'deleteDynamicArray.sol'
:
1
,
'deleteFromDynamicArray.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
0
,
'ERC20.sol'
:
0
,
...
@@ -319,6 +327,7 @@ test('Integration test inlineAssembly.js', function (t) {
...
@@ -319,6 +327,7 @@ test('Integration test inlineAssembly.js', function (t) {
'forgottenReturn.sol'
:
0
,
'forgottenReturn.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
0
,
'ERC20.sol'
:
0
,
...
@@ -355,6 +364,7 @@ test('Integration test blockTimestamp.js', function (t) {
...
@@ -355,6 +364,7 @@ test('Integration test blockTimestamp.js', function (t) {
'forgottenReturn.sol'
:
0
,
'forgottenReturn.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
0
,
'ERC20.sol'
:
0
,
...
@@ -391,6 +401,7 @@ test('Integration test lowLevelCalls.js', function (t) {
...
@@ -391,6 +401,7 @@ test('Integration test lowLevelCalls.js', function (t) {
'forgottenReturn.sol'
:
0
,
'forgottenReturn.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
0
,
'ERC20.sol'
:
0
,
...
@@ -427,6 +438,7 @@ test('Integration test blockBlockhash.js', function (t) {
...
@@ -427,6 +438,7 @@ test('Integration test blockBlockhash.js', function (t) {
'forgottenReturn.sol'
:
0
,
'forgottenReturn.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
0
,
'ERC20.sol'
:
0
,
...
@@ -463,6 +475,7 @@ test('Integration test noReturn.js', function (t) {
...
@@ -463,6 +475,7 @@ test('Integration test noReturn.js', function (t) {
'forgottenReturn.sol'
:
1
,
'forgottenReturn.sol'
:
1
,
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
0
,
'ERC20.sol'
:
0
,
...
@@ -499,6 +512,7 @@ test('Integration test selfdestruct.js', function (t) {
...
@@ -499,6 +512,7 @@ test('Integration test selfdestruct.js', function (t) {
'forgottenReturn.sol'
:
0
,
'forgottenReturn.sol'
:
0
,
'selfdestruct.sol'
:
3
,
'selfdestruct.sol'
:
3
,
'deleteDynamicArray.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'ERC20.sol'
:
0
,
'ERC20.sol'
:
0
,
'intDivisionTruncate.sol'
:
5
,
'intDivisionTruncate.sol'
:
5
,
...
@@ -535,6 +549,7 @@ test('Integration test guardConditions.js', function (t) {
...
@@ -535,6 +549,7 @@ test('Integration test guardConditions.js', function (t) {
'forgottenReturn.sol'
:
0
,
'forgottenReturn.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
1
,
'deleteDynamicArray.sol'
:
1
,
'deleteFromDynamicArray.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
1
,
'intDivisionTruncate.sol'
:
1
,
'ERC20.sol'
:
0
,
'ERC20.sol'
:
0
,
...
@@ -571,6 +586,7 @@ test('Integration test deleteDynamicArrays.js', function (t) {
...
@@ -571,6 +586,7 @@ test('Integration test deleteDynamicArrays.js', function (t) {
'forgottenReturn.sol'
:
0
,
'forgottenReturn.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
2
,
'deleteDynamicArray.sol'
:
2
,
'deleteFromDynamicArray.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
0
,
'ERC20.sol'
:
0
,
...
@@ -582,6 +598,43 @@ test('Integration test deleteDynamicArrays.js', function (t) {
...
@@ -582,6 +598,43 @@ test('Integration test deleteDynamicArrays.js', function (t) {
})
})
})
})
test
(
'Integration test deleteFromDynamicArray.js'
,
function
(
t
)
{
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../src/solidity-analyzer/modules/deleteFromDynamicArray'
)
var
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'assembly.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot_reentrant.sol'
:
0
,
'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'
:
1
,
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
0
,
'stringBytesLength.sol'
:
0
}
runModuleOnFiles
(
module
,
t
,
(
file
,
report
)
=>
{
t
.
equal
(
report
.
length
,
lengthCheck
[
file
],
`
${
file
}
has right amount of deleteFromDynamicArray warnings`
)
})
})
test
(
'Integration test assignAndCompare.js'
,
function
(
t
)
{
test
(
'Integration test assignAndCompare.js'
,
function
(
t
)
{
t
.
plan
(
testFiles
.
length
)
t
.
plan
(
testFiles
.
length
)
...
@@ -607,6 +660,7 @@ test('Integration test assignAndCompare.js', function (t) {
...
@@ -607,6 +660,7 @@ test('Integration test assignAndCompare.js', function (t) {
'forgottenReturn.sol'
:
0
,
'forgottenReturn.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
'blockLevelCompare.sol'
:
8
,
'blockLevelCompare.sol'
:
8
,
'intDivisionTruncate.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
0
,
'ERC20.sol'
:
0
,
...
@@ -643,6 +697,7 @@ test('Integration test intDivisionTruncate.js', function (t) {
...
@@ -643,6 +697,7 @@ test('Integration test intDivisionTruncate.js', function (t) {
'forgottenReturn.sol'
:
0
,
'forgottenReturn.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
2
,
'intDivisionTruncate.sol'
:
2
,
'ERC20.sol'
:
0
,
'ERC20.sol'
:
0
,
...
@@ -679,6 +734,7 @@ test('Integration test erc20Decimal.js', function (t) {
...
@@ -679,6 +734,7 @@ test('Integration test erc20Decimal.js', function (t) {
'forgottenReturn.sol'
:
0
,
'forgottenReturn.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
1
,
'ERC20.sol'
:
1
,
...
@@ -715,6 +771,7 @@ test('Integration test stringBytesLength.js', function (t) {
...
@@ -715,6 +771,7 @@ test('Integration test stringBytesLength.js', function (t) {
'forgottenReturn.sol'
:
0
,
'forgottenReturn.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'selfdestruct.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteDynamicArray.sol'
:
0
,
'deleteFromDynamicArray.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'intDivisionTruncate.sol'
:
0
,
'ERC20.sol'
:
0
,
'ERC20.sol'
:
0
,
...
...
remix-analyzer/test/analysis/test-contracts/deleteFromDynamicArray.sol
0 → 100644
View file @
cd6e23a8
pragma solidity ^0.4.22;
contract arr {
uint[] array = [1,2,3];
function removeAtIndex() public returns (uint[]) {
delete array[1];
return array;
}
function safeRemoveAtIndex(uint index) returns (uint[]) {
if (index >= array.length) return;
for (uint i = index; i < array.length-1; i++) {
array[i] = array[i+1];
}
delete array[array.length-1];
array.length--;
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