Procedural SafeCast.sol generation (#3245)

This commit is contained in:
Hadrien Croubois
2022-05-21 14:38:31 +02:00
committed by GitHub
parent c4f76cfa15
commit b61faf8368
13 changed files with 1402 additions and 9 deletions

View File

@ -1,6 +1,6 @@
const { BN, expectRevert } = require('@openzeppelin/test-helpers');
const { expect } = require('chai');
const { range } = require('../../../scripts/helpers');
const SafeCastMock = artifacts.require('SafeCastMock');
@ -41,7 +41,7 @@ contract('SafeCast', async (accounts) => {
});
}
[8, 16, 32, 64, 96, 128, 224].forEach(bits => testToUint(bits));
range(8, 256, 8).forEach(bits => testToUint(bits));
describe('toUint256', () => {
const maxInt256 = new BN('2').pow(new BN(255)).subn(1);
@ -129,7 +129,7 @@ contract('SafeCast', async (accounts) => {
});
}
[8, 16, 32, 64, 128].forEach(bits => testToInt(bits));
range(8, 256, 8).forEach(bits => testToInt(bits));
describe('toInt256', () => {
const maxUint256 = new BN('2').pow(new BN(256)).subn(1);