* Feature Issue #1745 * Feature Issue #1745 remove whitespace in contract * Feature Issue #1745 fix Solidity linter issues * Feature Issue #1745 fix JS lint issues * Update contracts/drafts/Strings.sol Co-Authored-By: Nicolás Venturo <nicolas.venturo@gmail.com> * Update contracts/drafts/Strings.sol Co-Authored-By: Nicolás Venturo <nicolas.venturo@gmail.com> * Update contracts/drafts/Strings.sol Co-Authored-By: Nicolás Venturo <nicolas.venturo@gmail.com> * Updates based on PR feedback * Remove trailing whitespace * Update tests based on @nventuro feedback * Removed return name * Rename length as suggested * Rename temp variables in uint256ToString * Renamed bytes variable to buffer * Change concatenate to use abi.encodePacked * Moved OraclizeAPI reference to unit256ToString * Add emoji concat test * Remove concatenate * Remove concatenate from StringsMock and test * Rename function to fromUint256 * Update StringsMock.sol
24 lines
698 B
JavaScript
24 lines
698 B
JavaScript
const { constants } = require('openzeppelin-test-helpers');
|
|
|
|
const StringsMock = artifacts.require('StringsMock');
|
|
|
|
contract('Strings', function () {
|
|
beforeEach(async function () {
|
|
this.strings = await StringsMock.new();
|
|
});
|
|
|
|
describe('from uint256', function () {
|
|
it('converts 0', async function () {
|
|
(await this.strings.fromUint256(0)).should.equal('0');
|
|
});
|
|
|
|
it('converts a positive number', async function () {
|
|
(await this.strings.fromUint256(4132)).should.equal('4132');
|
|
});
|
|
|
|
it('converts MAX_UINT256', async function () {
|
|
(await this.strings.fromUint256(constants.MAX_UINT256)).should.equal(constants.MAX_UINT256.toString());
|
|
});
|
|
});
|
|
});
|