use of co.rsk.test.dsl.WorldDslProcessor in project rskj by rsksmart.
the class DslFilesTest method runUncles04Resource.
@Test
public void runUncles04Resource() throws FileNotFoundException, DslProcessorException {
DslParser parser = DslParser.fromResource("dsl/uncles04.txt");
World world = new World();
WorldDslProcessor processor = new WorldDslProcessor(world);
processor.processCommands(parser);
Assert.assertNotNull(world.getBlockByName("b01"));
Assert.assertNotNull(world.getBlockByName("u01"));
Assert.assertNotNull(world.getBlockByName("u02"));
Assert.assertNotNull(world.getBlockByName("b02"));
Assert.assertNotNull(world.getBlockByName("c02"));
Assert.assertEquals(2, world.getBlockChain().getStatus().getBestBlock().getNumber());
}
use of co.rsk.test.dsl.WorldDslProcessor in project rskj by rsksmart.
the class WorldDslProcessorTest method processAssertConnectWithImportedNotBestBlock.
@Test
public void processAssertConnectWithImportedNotBestBlock() throws DslProcessorException {
World world = new World();
WorldDslProcessor processor = new WorldDslProcessor(world);
DslParser parser = new DslParser("block_chain g00 b01 b02\nblock_chain g00 c01\nblock_connect b01 b02\n" + "block_connect c01\nassert_connect not_best");
processor.processCommands(parser);
Block block = world.getBlockChain().getStatus().getBestBlock();
Assert.assertNotNull(block);
Assert.assertEquals(2, block.getNumber());
}
use of co.rsk.test.dsl.WorldDslProcessor in project rskj by rsksmart.
the class WorldDslProcessorTest method processBlockConnectCommandWithTwoBlocks.
@Test
public void processBlockConnectCommandWithTwoBlocks() throws DslProcessorException {
World world = new World();
WorldDslProcessor processor = new WorldDslProcessor(world);
DslParser parser = new DslParser("block_chain g00 b01 b02\nblock_connect b01 b02");
processor.processCommands(parser);
Block parent = world.getBlockByName("b01");
Block block = world.getBlockChain().getStatus().getBestBlock();
Assert.assertNotNull(parent);
Assert.assertNotNull(block);
Assert.assertEquals(2, block.getNumber());
Assert.assertEquals(parent.getHash(), block.getParentHash());
}
use of co.rsk.test.dsl.WorldDslProcessor in project rskj by rsksmart.
the class WorldDslProcessorTest method processAccountNewCommand.
@Test
public void processAccountNewCommand() throws DslProcessorException {
World world = new World();
WorldDslProcessor processor = new WorldDslProcessor(world);
DslParser parser = new DslParser("account_new acc1");
processor.processCommands(parser);
Account account = world.getAccountByName("acc1");
Assert.assertNotNull(account);
Assert.assertEquals(BigInteger.ZERO, world.getRepository().getBalance(account.getAddress()).asBigInteger());
}
use of co.rsk.test.dsl.WorldDslProcessor in project rskj by rsksmart.
the class WorldDslProcessorTest method processBlockBuildCommand.
@Test
public void processBlockBuildCommand() throws DslProcessorException {
World world = new World();
WorldDslProcessor processor = new WorldDslProcessor(world);
DslParser parser = new DslParser("block_build b01\nparent g00\nbuild");
processor.processCommands(parser);
Block block = world.getBlockByName("b01");
Assert.assertNotNull(block);
Assert.assertEquals(1, block.getNumber());
}
Aggregations