travis-ci-com
66 of 74 branches covered (89.19%)
Branch coverage included in aggregate %.
45 of 45 new or added lines in 4 files covered. (100.0%)
186 of 198 relevant lines covered (93.94%)
541.87 hits per line
1 |
pragma solidity ^0.5.11; |
|
2 |
|
|
3 |
library Utils { |
|
4 |
function uint2str(uint256 _i) |
|
5 |
internal |
|
6 |
pure |
|
7 |
returns (string memory _uintAsString)
|
|
8 |
{ |
|
|
if (_i == 0) { |
|
|
return '0'; |
× |
11 |
} |
|
|
uint256 j = _i; |
2,359✔ |
|
uint256 len; |
2,359✔ |
|
while (j != 0) { |
2,359✔ |
|
len++; |
5,813✔ |
|
j /= 10;
|
5,813✔ |
17 |
} |
|
|
bytes memory bstr = new bytes(len);
|
2,359✔ |
|
uint256 k = len - 1;
|
2,359✔ |
|
while (_i != 0) { |
2,359✔ |
|
bstr[k--] = byte(uint8(48 + (_i % 10))); |
5,813✔ |
|
_i /= 10;
|
5,813✔ |
23 |
} |
|
|
return string(bstr); |
2,359✔ |
25 |
} |
|
26 |
} |