Update docs

This commit is contained in:
github-actions
2023-05-09 19:56:30 +00:00
parent 47e38c7bda
commit 6ae39c4dc1
579 changed files with 30453 additions and 21485 deletions

View File

@ -2,38 +2,38 @@ const { BN, constants } = require('@openzeppelin/test-helpers');
const { expect } = require('chai');
const { MIN_INT256, MAX_INT256 } = constants;
const SignedMathMock = artifacts.require('SignedMathMock');
const SignedMath = artifacts.require('$SignedMath');
contract('SignedMath', function (accounts) {
contract('SignedMath', function () {
const min = new BN('-1234');
const max = new BN('5678');
beforeEach(async function () {
this.math = await SignedMathMock.new();
this.math = await SignedMath.new();
});
describe('max', function () {
it('is correctly detected in first argument position', async function () {
expect(await this.math.max(max, min)).to.be.bignumber.equal(max);
expect(await this.math.$max(max, min)).to.be.bignumber.equal(max);
});
it('is correctly detected in second argument position', async function () {
expect(await this.math.max(min, max)).to.be.bignumber.equal(max);
expect(await this.math.$max(min, max)).to.be.bignumber.equal(max);
});
});
describe('min', function () {
it('is correctly detected in first argument position', async function () {
expect(await this.math.min(min, max)).to.be.bignumber.equal(min);
expect(await this.math.$min(min, max)).to.be.bignumber.equal(min);
});
it('is correctly detected in second argument position', async function () {
expect(await this.math.min(max, min)).to.be.bignumber.equal(min);
expect(await this.math.$min(max, min)).to.be.bignumber.equal(min);
});
});
describe('average', function () {
function bnAverage (a, b) {
function bnAverage(a, b) {
return a.add(b).divn(2);
}
@ -68,8 +68,10 @@ contract('SignedMath', function (accounts) {
for (const x of valuesX) {
for (const y of valuesY) {
expect(await this.math.average(x, y))
.to.be.bignumber.equal(bnAverage(x, y), `Bad result for average(${x}, ${y})`);
expect(await this.math.$average(x, y)).to.be.bignumber.equal(
bnAverage(x, y),
`Bad result for average(${x}, ${y})`,
);
}
}
});
@ -86,7 +88,7 @@ contract('SignedMath', function (accounts) {
MAX_INT256,
]) {
it(`correctly computes the absolute value of ${n}`, async function () {
expect(await this.math.abs(n)).to.be.bignumber.equal(n.abs());
expect(await this.math.$abs(n)).to.be.bignumber.equal(n.abs());
});
}
});