本文整理汇总了Java中java.math.BigInteger.TEN属性的典型用法代码示例。如果您正苦于以下问题:Java BigInteger.TEN属性的具体用法?Java BigInteger.TEN怎么用?Java BigInteger.TEN使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.math.BigInteger
的用法示例。
在下文中一共展示了BigInteger.TEN属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test
@Test
public void test() throws IOException, ExecutionException, InterruptedException {
Address senderAddress = new Address(cfg.getMainCredentials().getAddress());
Address contractAddress = new Address("0x1");
long nonce = 123L;
BigInteger completedTransfers = BigInteger.TEN;
ChannelTransaction state = new ChannelTransaction();
state.setSender(senderAddress);
state.setChannelId(1);
state.setBlockNumber(1L);
state.setData("DATA".getBytes());
byte[] hash = callHash("hashState", senderAddress, new Uint256(nonce), new Uint256(completedTransfers));
Assert.assertEquals(Numeric.toHexString(state.hash()), Numeric.toHexString(hash));
}
示例2: encodeDecodeStatusMessageWithCompleteArguments
@Test
public void encodeDecodeStatusMessageWithCompleteArguments() {
Block block = BlockGenerator.getInstance().getBlock(1);
Status status = new Status(block.getNumber(), block.getHash(), block.getParentHash(), BigInteger.TEN);
StatusMessage message = new StatusMessage(status);
byte[] encoded = message.getEncoded();
Message result = Message.create(encoded);
Assert.assertNotNull(result);
Assert.assertArrayEquals(encoded, result.getEncoded());
Assert.assertEquals(MessageType.STATUS_MESSAGE, result.getMessageType());
StatusMessage newmessage = (StatusMessage) result;
Assert.assertArrayEquals(block.getHash(), newmessage.getStatus().getBestBlockHash());
Assert.assertEquals(block.getNumber(), newmessage.getStatus().getBestBlockNumber());
}
示例3: createWithCompleteArguments
@Test
public void createWithCompleteArguments() {
Block genesis = BlockGenerator.getInstance().getGenesisBlock();
Block block = BlockGenerator.getInstance().createChildBlock(genesis);
Status status = new Status(block.getNumber(), block.getHash(), block.getParentHash(), BigInteger.TEN);
StatusMessage message = new StatusMessage(status);
Assert.assertEquals(MessageType.STATUS_MESSAGE, message.getMessageType());
Assert.assertSame(status, message.getStatus());
Assert.assertEquals(1, message.getStatus().getBestBlockNumber());
Assert.assertArrayEquals(block.getHash(), message.getStatus().getBestBlockHash());
Assert.assertNotNull(message.getStatus().getBestBlockParentHash());
Assert.assertArrayEquals(block.getParentHash(), message.getStatus().getBestBlockParentHash());
Assert.assertNotNull(message.getStatus().getTotalDifficulty());
Assert.assertEquals(BigInteger.TEN, message.getStatus().getTotalDifficulty());
}
示例4: processStatusMessageUsingSyncProcessor
@Test
public void processStatusMessageUsingSyncProcessor() throws UnknownHostException {
final SimpleMessageChannel sender = new SimpleMessageChannel();
final NodeMessageHandler handler = NodeMessageHandlerUtil.createHandlerWithSyncProcessor();
final Block block = BlockGenerator.getInstance().createChildBlock(BlockGenerator.getInstance().getGenesisBlock());
final Status status = new Status(block.getNumber(), block.getHash(), block.getParentHash(), BigInteger.TEN);
final Message message = new StatusMessage(status);
handler.processMessage(sender, message);
Assert.assertNotNull(sender.getGetBlockMessages());
Assert.assertTrue(sender.getGetBlockMessages().isEmpty());
Assert.assertNotNull(sender.getMessages());
Assert.assertEquals(1, sender.getMessages().size());
Message request = sender.getMessages().get(0);
Assert.assertNotNull(request);
Assert.assertEquals(MessageType.BLOCK_HEADERS_REQUEST_MESSAGE, request.getMessageType());
}
示例5: createAccountWithBalanceAndCode
@Test
public void createAccountWithBalanceAndCode() {
World world = new World();
byte[] code = new byte[] { 0x01, 0x02, 0x03 };
BigInteger balance = BigInteger.TEN;
Account account = new AccountBuilder(world).name("acc1")
.balance(BigInteger.TEN)
.code(code)
.build();
Assert.assertNotNull(account);
Assert.assertTrue(account.getEcKey().hasPrivKey());
Assert.assertEquals(balance, world.getRepository().getBalance(account.getAddress().getBytes()));
Assert.assertArrayEquals(code, world.getRepository().getCode(account.getAddress().getBytes()));
}
示例6: testSubSetRanges
@Test(dataProvider = "NavigableSet<?>", dataProviderClass = EmptyNavigableSet.class)
public void testSubSetRanges(String description, NavigableSet navigableSet) {
Object first = isDescending(navigableSet) ? BigInteger.TEN : BigInteger.ZERO;
Object last = (BigInteger.ZERO == first) ? BigInteger.TEN : BigInteger.ZERO;
NavigableSet subSet = navigableSet.subSet(first, true, last, true);
// same subset
subSet.subSet(first, true, last, true);
// slightly smaller
NavigableSet ns = subSet.subSet(first, false, last, false);
// slight exapansion
assertThrows(() -> {
ns.subSet(first, true, last, true);
},
IllegalArgumentException.class,
description + ": Expansion should not be allowed");
// much smaller
subSet.subSet(first, false, BigInteger.ONE, false);
}
示例7: testSubMapRanges
@Test(dataProvider = "NavigableMap<?,?>", dataProviderClass = EmptyNavigableMap.class)
public void testSubMapRanges(String description, NavigableMap navigableMap) {
Object first = isDescending(navigableMap) ? BigInteger.TEN : BigInteger.ZERO;
Object last = (BigInteger.ZERO == first) ? BigInteger.TEN : BigInteger.ZERO;
NavigableMap subMap = navigableMap.subMap(first, true, last, true);
// same subset
subMap.subMap(first, true, last, true);
// slightly smaller
NavigableMap ns = subMap.subMap(first, false, last, false);
// slight exapansion
assertThrows(() -> {
ns.subMap(first, true, last, true);
},
IllegalArgumentException.class,
description + ": Expansion should not be allowed");
// much smaller
subMap.subMap(first, false, BigInteger.ONE, false);
}
示例8: testSubSetRanges
@Test(dataProvider = "NavigableSet<?>", dataProviderClass = EmptyNavigableSet.class)
public void testSubSetRanges(String description, NavigableSet navigableSet) {
Object first = isDescending(navigableSet) ? BigInteger.TEN : BigInteger.ZERO;
Object last = (BigInteger.ZERO == first) ? BigInteger.TEN : BigInteger.ZERO;
NavigableSet subSet = navigableSet.subSet(first, true, last, true);
// same subset
subSet.subSet(first, true, last, true);
// slightly smaller
NavigableSet ns = subSet.subSet(first, false, last, false);
// slight expansion
assertThrowsIAE(() -> {
ns.subSet(first, true, last, true);
},
description + ": Expansion should not be allowed");
// much smaller
subSet.subSet(first, false, BigInteger.ONE, false);
}
示例9: testSubMapRanges
@Test(dataProvider = "NavigableMap<?,?>", dataProviderClass = EmptyNavigableMap.class)
public void testSubMapRanges(String description, NavigableMap navigableMap) {
Object first = isDescending(navigableMap) ? BigInteger.TEN : BigInteger.ZERO;
Object last = (BigInteger.ZERO == first) ? BigInteger.TEN : BigInteger.ZERO;
NavigableMap subMap = navigableMap.subMap(first, true, last, true);
// same subset
subMap.subMap(first, true, last, true);
// slightly smaller
NavigableMap ns = subMap.subMap(first, false, last, false);
// slight expansion
assertThrowsIAE(() -> {
ns.subMap(first, true, last, true);
},
description + ": Expansion should not be allowed");
// much smaller
subMap.subMap(first, false, BigInteger.ONE, false);
}
示例10: numberListTest
@Test
public void numberListTest() {
final VersionComponent expected = new ListComponent(new NumberComponent(BigInteger.ONE),
new NumberComponent(BigInteger.TEN));
assertEquals("Parser produced wrong result", expected, VersionParser.parse("1_10"));
assertEquals("Parser produced wrong result", expected, VersionParser.parse("1-10"));
assertEquals("Parser produced wrong result", expected, VersionParser.parse("1.10"));
}
示例11: readBigInteger
/**
* Reads {@link BigInteger} value that was written via {@link #writeBigInteger(BigInteger, DataOutput)}.
*
* @param in Data input.
*
* @return Value.
*
* @throws IOException if failed to read value.
*/
public static BigInteger readBigInteger(DataInput in) throws IOException {
byte hint = in.readByte();
switch (hint) {
case DECIMAL_ZERO: {
return BigInteger.ZERO;
}
case DECIMAL_ONE: {
return BigInteger.ONE;
}
case DECIMAL_TEN: {
return BigInteger.TEN;
}
case DECIMAL_SMALL_UNSCALED: {
long val = readVarLong(in);
return BigInteger.valueOf(val);
}
case DECIMAL_BIG: {
int bytesLen = readVarIntUnsigned(in);
byte[] bytes = new byte[bytesLen];
in.readFully(bytes);
return new BigInteger(bytes);
}
default: {
throw new StreamCorruptedException("Unexpected hint for " + BigInteger.class.getName() + " value [hint=" + hint + ']');
}
}
}
示例12: testBigInteger
@Test
public void testBigInteger() throws Exception {
BigInteger v1 = BigInteger.valueOf(Long.MIN_VALUE);
BigInteger v2 = BigInteger.valueOf(Long.MAX_VALUE).multiply(BigInteger.valueOf(2));
BigInteger v3 = BigInteger.ZERO;
BigInteger v4 = BigInteger.ONE;
BigInteger v5 = BigInteger.TEN;
BigInteger v6 = BigInteger.valueOf(1000);
BigInteger v7 = BigInteger.valueOf(10000000);
check(input(v1, v2, v3, v4, v5, v6, v7), (v, out) -> out.writeBigInteger(v), DataReader::readBigInteger);
}
示例13: createBasicTransaction
@Test
public void createBasicTransaction() {
SimpleEthereum rsk = new SimpleEthereum();
TxBuilder builder = new TxBuilder(ConfigHelper.CONFIG, rsk, null, (Repository) rsk.repository);
BigInteger gasPrice = BigInteger.ONE;
BigInteger gasLimit = BigInteger.valueOf(21000);
BigInteger nonce = BigInteger.TEN;
Transaction tx = builder.createNewTransaction(gasPrice, gasLimit, nonce);
Assert.assertEquals(gasLimit, new BigInteger(1, tx.getGasLimit()));
Assert.assertEquals(gasPrice, new BigInteger(1, tx.getGasPrice()));
Assert.assertEquals(nonce, new BigInteger(1, tx.getNonce()));
}
示例14: createAndBroadcastTransaction
@Test
public void createAndBroadcastTransaction() {
SimpleEthereum rsk = new SimpleEthereum();
BlockProcessor blockProcessor = Mockito.mock(BlockProcessor.class);
TxBuilder builder = new TxBuilder(ConfigHelper.CONFIG, rsk, blockProcessor, (Repository) rsk.repository);
BigInteger nonce = BigInteger.TEN;
try {
builder.createNewTx(nonce);
}
catch (InterruptedException ex){
Assert.fail();
}
}
示例15: createWithCompleteArguments
@Test
public void createWithCompleteArguments() {
byte[] hash = HashUtil.randomHash();
byte[] parentHash = HashUtil.randomHash();
Status status = new Status(42, hash, parentHash, BigInteger.TEN);
Assert.assertEquals(42, status.getBestBlockNumber());
Assert.assertNotNull(status.getBestBlockHash());
Assert.assertArrayEquals(hash, status.getBestBlockHash());
Assert.assertNotNull(status.getBestBlockParentHash());
Assert.assertArrayEquals(parentHash, status.getBestBlockParentHash());
Assert.assertNotNull(status.getTotalDifficulty());
Assert.assertEquals(BigInteger.TEN, status.getTotalDifficulty());
}