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
e5eaa919
Commit
e5eaa919
authored
Dec 20, 2016
by
Arseniy Klempner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make isOwner() const. Add necessary toString() calls in tests.
parent
e8459148
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
9 deletions
+4
-9
Shareable.sol
contracts/Shareable.sol
+1
-2
ShareableMock.sol
contracts/test-helpers/ShareableMock.sol
+0
-3
Shareable.js
test/Shareable.js
+3
-4
No files found.
contracts/Shareable.sol
View file @
e5eaa919
...
@@ -98,7 +98,7 @@ contract Shareable {
...
@@ -98,7 +98,7 @@ contract Shareable {
return address(owners[ownerIndex + 1]);
return address(owners[ownerIndex + 1]);
}
}
function isOwner(address _addr) returns (bool) {
function isOwner(address _addr)
constant
returns (bool) {
return ownerIndex[uint(_addr)] > 0;
return ownerIndex[uint(_addr)] > 0;
}
}
...
@@ -162,4 +162,3 @@ contract Shareable {
...
@@ -162,4 +162,3 @@ contract Shareable {
}
}
}
}
contracts/test-helpers/ShareableMock.sol
View file @
e5eaa919
...
@@ -13,7 +13,4 @@ contract ShareableMock is Shareable {
...
@@ -13,7 +13,4 @@ contract ShareableMock is Shareable {
count = count + 1;
count = count + 1;
}
}
function isOwnerConst(address _addr) constant returns (bool) {
return isOwner(_addr);
}
}
}
test/Shareable.js
View file @
e5eaa919
...
@@ -12,7 +12,7 @@ contract('Shareable', function(accounts) {
...
@@ -12,7 +12,7 @@ contract('Shareable', function(accounts) {
for
(
let
i
=
0
;
i
<
accounts
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
accounts
.
length
;
i
++
)
{
let
owner
=
await
shareable
.
getOwner
(
i
);
let
owner
=
await
shareable
.
getOwner
(
i
);
let
isowner
=
await
shareable
.
isOwner
Const
(
accounts
[
i
]);
let
isowner
=
await
shareable
.
isOwner
(
accounts
[
i
]);
if
(
i
<=
owners
.
length
)
{
if
(
i
<=
owners
.
length
)
{
assert
.
equal
(
accounts
[
i
],
owner
);
assert
.
equal
(
accounts
[
i
],
owner
);
assert
.
isTrue
(
isowner
);
assert
.
isTrue
(
isowner
);
...
@@ -67,7 +67,6 @@ contract('Shareable', function(accounts) {
...
@@ -67,7 +67,6 @@ contract('Shareable', function(accounts) {
let
hash
=
1234
;
let
hash
=
1234
;
let
initCount
=
await
shareable
.
count
();
let
initCount
=
await
shareable
.
count
();
//initCount = initCount.toString();
for
(
let
i
=
0
;
i
<
requiredSigs
*
3
;
i
++
)
{
for
(
let
i
=
0
;
i
<
requiredSigs
*
3
;
i
++
)
{
await
shareable
.
increaseCount
(
hash
,
{
from
:
accounts
[
i
%
4
]});
await
shareable
.
increaseCount
(
hash
,
{
from
:
accounts
[
i
%
4
]});
...
@@ -76,7 +75,7 @@ contract('Shareable', function(accounts) {
...
@@ -76,7 +75,7 @@ contract('Shareable', function(accounts) {
initCount
=
Number
(
initCount
)
+
1
;
initCount
=
Number
(
initCount
)
+
1
;
assert
.
equal
(
initCount
,
count
);
assert
.
equal
(
initCount
,
count
);
}
else
{
}
else
{
assert
.
equal
(
initCount
,
count
);
assert
.
equal
(
initCount
.
toString
()
,
count
);
}
}
}
}
});
});
...
@@ -95,7 +94,7 @@ contract('Shareable', function(accounts) {
...
@@ -95,7 +94,7 @@ contract('Shareable', function(accounts) {
}
}
await
shareable
.
increaseCount
(
hash
,
{
from
:
accounts
[
i
]});
await
shareable
.
increaseCount
(
hash
,
{
from
:
accounts
[
i
]});
let
count
=
await
shareable
.
count
();
let
count
=
await
shareable
.
count
();
assert
.
equal
(
initCount
,
count
);
assert
.
equal
(
initCount
.
toString
()
,
count
);
}
}
});
});
...
...
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