Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
openzeppelin-contracts-upgradeable
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
俞永鹏
openzeppelin-contracts-upgradeable
Commits
4cd8aa79
Commit
4cd8aa79
authored
Nov 18, 2016
by
Manuel Araoz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add more limit tests to LimitBalance
parent
44138018
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletions
+27
-1
LimitBalance.sol
contracts/LimitBalance.sol
+1
-1
LimitBalance.js
test/LimitBalance.js
+26
-0
No files found.
contracts/LimitBalance.sol
View file @
4cd8aa79
...
...
@@ -8,7 +8,7 @@ contract LimitBalance {
}
modifier limitedPayable() {
if (this.balance
+ msg.value
> limit) {
if (this.balance > limit) {
throw;
}
_;
...
...
test/LimitBalance.js
View file @
4cd8aa79
...
...
@@ -35,4 +35,30 @@ contract('LimitBalance', function(accounts) {
.
then
(
done
)
});
it
(
"should allow multiple sends below limit"
,
function
(
done
)
{
var
amount
=
500
;
return
lb
.
limitedDeposit
({
value
:
amount
})
.
then
(
function
()
{
assert
.
equal
(
web3
.
eth
.
getBalance
(
lb
.
address
),
amount
);
return
lb
.
limitedDeposit
({
value
:
amount
})
})
.
then
(
function
()
{
assert
.
equal
(
web3
.
eth
.
getBalance
(
lb
.
address
),
amount
*
2
);
})
.
then
(
done
)
});
it
(
"shouldnt allow multiple sends above limit"
,
function
(
done
)
{
var
amount
=
500
;
return
lb
.
limitedDeposit
({
value
:
amount
})
.
then
(
function
()
{
assert
.
equal
(
web3
.
eth
.
getBalance
(
lb
.
address
),
amount
);
return
lb
.
limitedDeposit
({
value
:
amount
+
1
})
})
.
catch
(
function
(
error
)
{
if
(
error
.
message
.
search
(
'invalid JUMP'
)
==
-
1
)
throw
error
;
})
.
then
(
done
)
});
});
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