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 {
46
46
/**
47
47
* @dev Converts a `int256` to its ASCII `string` decimal representation.
48
48
*/
49
- function toString (int256 value ) internal pure returns (string memory ) {
49
+ function toStringSigned (int256 value ) internal pure returns (string memory ) {
50
50
return string .concat (value < 0 ? "- " : "" , toString (SignedMath.abs (value)));
51
51
}
52
52
Original file line number Diff line number Diff line change @@ -48,22 +48,22 @@ contract('Strings', function () {
48
48
describe ( 'int256' , function ( ) {
49
49
it ( 'converts MAX_INT256' , async function ( ) {
50
50
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 ) ) ;
52
52
} ) ;
53
53
54
54
it ( 'converts MIN_INT256' , async function ( ) {
55
55
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 ) ) ;
57
57
} ) ;
58
58
59
59
for ( const value of values ) {
60
60
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 ) ;
62
62
} ) ;
63
63
64
64
it ( `convert negative ${ value } ` , async function ( ) {
65
65
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 ) ) ;
67
67
} ) ;
68
68
}
69
69
} ) ;
You can’t perform that action at this time.
0 commit comments