File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,18 @@ contract TestICS20 is Test {
106106 // This should not revert if the input is not a valid hex string.
107107 ICS20LibTestHelper.hexStringToAddress (any);
108108 }
109+
110+ function testParseUint256String () public {
111+ bytes memory maxAmountStr = bytes ("115792089237316195423570985008687907853269984665640564039457584007913129639935 \" " );
112+ (uint256 amount , uint256 pos ) = ICS20LibTestHelper.parseUint256String (maxAmountStr, 0 );
113+ assertEq (amount, 115792089237316195423570985008687907853269984665640564039457584007913129639935 );
114+ assertEq (pos, maxAmountStr.length );
115+
116+ bytes memory minAmountStr = bytes ("1 \" " );
117+ (amount, pos) = ICS20LibTestHelper.parseUint256String (minAmountStr, 0 );
118+ assertEq (amount, 1 );
119+ assertEq (pos, minAmountStr.length );
120+ }
109121}
110122
111123library ICS20LibTestHelper {
@@ -128,4 +140,8 @@ library ICS20LibTestHelper {
128140 function isEscapedJSONString (string calldata s ) public pure returns (bool ) {
129141 return ICS20Lib.isEscapedJSONString (s);
130142 }
143+
144+ function parseUint256String (bytes calldata bz , uint256 pos ) public pure returns (uint256 , uint256 ) {
145+ return ICS20Lib.parseUint256String (bz, pos);
146+ }
131147}
You can’t perform that action at this time.
0 commit comments