Skip to content

Commit

Permalink
Add requested testing on function (hyperledger-web3j#4)
Browse files Browse the repository at this point in the history
* Add requested testing on function
  • Loading branch information
NickFitton authored Jan 14, 2018
1 parent e933c08 commit 51dbc61
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions utils/src/test/java/org/web3j/utils/NumericTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ public class NumericTest {

private static final String HEX_RANGE_STRING = "0x0123456789abcdef";

@Test
public void testQuantityEncodeLeadingZero() {
assertThat(Numeric.toHexStringWithPrefixSafe(BigInteger.valueOf(0L)), equalTo("0x00"));
assertThat(Numeric.toHexStringWithPrefixSafe(BigInteger.valueOf(1024L)), equalTo("0x400"));
assertThat(Numeric.toHexStringWithPrefixSafe(BigInteger.valueOf(Long.MAX_VALUE)),
equalTo("0x7fffffffffffffff"));
assertThat(Numeric.toHexStringWithPrefixSafe(
new BigInteger("204516877000845695339750056077105398031")),
equalTo("0x99dc848b94efc27edfad28def049810f"));
}

@Test
public void testQuantityDecode() {
Expand Down

0 comments on commit 51dbc61

Please sign in to comment.