Remove Math.min64 and Math.max64 (#1156)
* remove Math.min64 and Math.max64 * refactor Math tests to use return values * enhance Math coveragepull/1158/head
parent
ba85aef95e
commit
bf34911857
@ -1,43 +1,34 @@ |
|||||||
const MathMock = artifacts.require('MathMock'); |
const MathMock = artifacts.require('MathMock'); |
||||||
|
|
||||||
contract('Math', function () { |
contract('Math', function () { |
||||||
let math; |
const min = 1234; |
||||||
|
const max = 5678; |
||||||
|
|
||||||
beforeEach(async function () { |
beforeEach(async function () { |
||||||
math = await MathMock.new(); |
this.math = await MathMock.new(); |
||||||
}); |
}); |
||||||
|
|
||||||
it('returns max64 correctly', async function () { |
describe('max', function () { |
||||||
const a = 5678; |
it('is correctly detected in first argument position', async function () { |
||||||
const b = 1234; |
const result = await this.math.max(max, min); |
||||||
await math.max64(a, b); |
assert.equal(result, max); |
||||||
const result = await math.result64(); |
}); |
||||||
assert.equal(result, a); |
|
||||||
}); |
|
||||||
|
|
||||||
it('returns min64 correctly', async function () { |
|
||||||
const a = 5678; |
|
||||||
const b = 1234; |
|
||||||
await math.min64(a, b); |
|
||||||
const result = await math.result64(); |
|
||||||
|
|
||||||
assert.equal(result, b); |
|
||||||
}); |
|
||||||
|
|
||||||
it('returns max256 correctly', async function () { |
it('is correctly detected in second argument position', async function () { |
||||||
const a = 5678; |
const result = await this.math.max(min, max); |
||||||
const b = 1234; |
assert.equal(result, max); |
||||||
await math.max256(a, b); |
}); |
||||||
const result = await math.result256(); |
|
||||||
assert.equal(result, a); |
|
||||||
}); |
}); |
||||||
|
|
||||||
it('returns min256 correctly', async function () { |
describe('min', function () { |
||||||
const a = 5678; |
it('is correctly detected in first argument position', async function () { |
||||||
const b = 1234; |
const result = await this.math.min(min, max); |
||||||
await math.min256(a, b); |
assert.equal(result, min); |
||||||
const result = await math.result256(); |
}); |
||||||
|
|
||||||
assert.equal(result, b); |
it('is correctly detected in second argument position', async function () { |
||||||
|
const result = await this.math.min(max, min); |
||||||
|
assert.equal(result, min); |
||||||
|
}); |
||||||
}); |
}); |
||||||
}); |
}); |
||||||
|
Loading…
Reference in new issue