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
f162638c
Commit
f162638c
authored
Dec 06, 2017
by
Leo Arias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: add tests for max64 and min64 from Math
parent
83b941c7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
0 deletions
+43
-0
Math.test.js
test/Math.test.js
+26
-0
MathMock.sol
test/mocks/MathMock.sol
+17
-0
No files found.
test/Math.test.js
0 → 100644
View file @
f162638c
var
MathMock
=
artifacts
.
require
(
'./mocks/MathMock.sol'
);
contract
(
'Math'
,
function
(
accounts
)
{
let
math
;
before
(
async
function
()
{
math
=
await
MathMock
.
new
();
});
it
(
'returns max correctly'
,
async
function
()
{
let
a
=
5678
;
let
b
=
1234
;
await
math
.
max64
(
a
,
b
);
let
result
=
await
math
.
result
();
assert
.
equal
(
result
,
a
);
});
it
(
'returns min correctly'
,
async
function
()
{
let
a
=
5678
;
let
b
=
1234
;
await
math
.
min64
(
a
,
b
);
let
result
=
await
math
.
result
();
assert
.
equal
(
result
,
b
);
});
});
test/mocks/MathMock.sol
0 → 100644
View file @
f162638c
pragma solidity ^0.4.18;
import '../../contracts/math/Math.sol';
contract MathMock {
uint64 public result;
function max64(uint64 a, uint64 b) public {
result = Math.max64(a, b);
}
function min64(uint64 a, uint64 b) public {
result = Math.min64(a, b);
}
}
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