feat: use require in SafeMath (#1187)
* feat: use require in SafeMath * fix: grammar with revert
This commit is contained in:
committed by
Nicolás Venturo
parent
6dab31288e
commit
c9e91586e7
@ -1,4 +1,4 @@
|
||||
const { assertJump } = require('../helpers/assertJump');
|
||||
const { assertRevert } = require('../helpers/assertRevert');
|
||||
const BigNumber = web3.BigNumber;
|
||||
const SafeMathMock = artifacts.require('SafeMathMock');
|
||||
|
||||
@ -22,11 +22,11 @@ contract('SafeMath', () => {
|
||||
result.should.be.bignumber.equal(a.plus(b));
|
||||
});
|
||||
|
||||
it('throws an error on addition overflow', async function () {
|
||||
it('throws a revert error on addition overflow', async function () {
|
||||
const a = MAX_UINT;
|
||||
const b = new BigNumber(1);
|
||||
|
||||
await assertJump(this.safeMath.add(a, b));
|
||||
await assertRevert(this.safeMath.add(a, b));
|
||||
});
|
||||
});
|
||||
|
||||
@ -39,11 +39,11 @@ contract('SafeMath', () => {
|
||||
result.should.be.bignumber.equal(a.minus(b));
|
||||
});
|
||||
|
||||
it('throws an error if subtraction result would be negative', async function () {
|
||||
it('throws a revert error if subtraction result would be negative', async function () {
|
||||
const a = new BigNumber(1234);
|
||||
const b = new BigNumber(5678);
|
||||
|
||||
await assertJump(this.safeMath.sub(a, b));
|
||||
await assertRevert(this.safeMath.sub(a, b));
|
||||
});
|
||||
});
|
||||
|
||||
@ -64,11 +64,11 @@ contract('SafeMath', () => {
|
||||
result.should.be.bignumber.equal(a.times(b));
|
||||
});
|
||||
|
||||
it('throws an error on multiplication overflow', async function () {
|
||||
it('throws a revert error on multiplication overflow', async function () {
|
||||
const a = MAX_UINT;
|
||||
const b = new BigNumber(2);
|
||||
|
||||
await assertJump(this.safeMath.mul(a, b));
|
||||
await assertRevert(this.safeMath.mul(a, b));
|
||||
});
|
||||
});
|
||||
|
||||
@ -81,11 +81,11 @@ contract('SafeMath', () => {
|
||||
result.should.be.bignumber.equal(a.div(b));
|
||||
});
|
||||
|
||||
it('throws an error on zero division', async function () {
|
||||
it('throws a revert error on zero division', async function () {
|
||||
const a = new BigNumber(5678);
|
||||
const b = new BigNumber(0);
|
||||
|
||||
await assertJump(this.safeMath.div(a, b));
|
||||
await assertRevert(this.safeMath.div(a, b));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user