File tree Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' openzeppelin-solidity ' : major
3+ ---
4+
5+ ` Strings ` : Rename ` toString(int256) ` to ` toStringSigned(int256) ` .
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ library Strings {
4646 /**
4747 * @dev Converts a `int256` to its ASCII `string` decimal representation.
4848 */
49- function toString (int256 value ) internal pure returns (string memory ) {
49+ function toStringSigned (int256 value ) internal pure returns (string memory ) {
5050 return string .concat (value < 0 ? "- " : "" , toString (SignedMath.abs (value)));
5151 }
5252
Original file line number Diff line number Diff line change @@ -48,22 +48,22 @@ contract('Strings', function () {
4848 describe ( 'int256' , function ( ) {
4949 it ( 'converts MAX_INT256' , async function ( ) {
5050 const value = constants . MAX_INT256 ;
51- expect ( await this . strings . methods [ '$toString (int256)' ] ( value ) ) . to . equal ( value . toString ( 10 ) ) ;
51+ expect ( await this . strings . methods [ '$toStringSigned (int256)' ] ( value ) ) . to . equal ( value . toString ( 10 ) ) ;
5252 } ) ;
5353
5454 it ( 'converts MIN_INT256' , async function ( ) {
5555 const value = constants . MIN_INT256 ;
56- expect ( await this . strings . methods [ '$toString (int256)' ] ( value ) ) . to . equal ( value . toString ( 10 ) ) ;
56+ expect ( await this . strings . methods [ '$toStringSigned (int256)' ] ( value ) ) . to . equal ( value . toString ( 10 ) ) ;
5757 } ) ;
5858
5959 for ( const value of values ) {
6060 it ( `convert ${ value } ` , async function ( ) {
61- expect ( await this . strings . methods [ '$toString (int256)' ] ( value ) ) . to . equal ( value ) ;
61+ expect ( await this . strings . methods [ '$toStringSigned (int256)' ] ( value ) ) . to . equal ( value ) ;
6262 } ) ;
6363
6464 it ( `convert negative ${ value } ` , async function ( ) {
6565 const negated = new BN ( value ) . neg ( ) ;
66- expect ( await this . strings . methods [ '$toString (int256)' ] ( negated ) ) . to . equal ( negated . toString ( 10 ) ) ;
66+ expect ( await this . strings . methods [ '$toStringSigned (int256)' ] ( negated ) ) . to . equal ( negated . toString ( 10 ) ) ;
6767 } ) ;
6868 }
6969 } ) ;
You can’t perform that action at this time.
0 commit comments