use of co.rsk.test.dsl.DslParser in project rskj by rsksmart.
the class DslParserTest method parseSimpleCommandSkippingCommentLines.
@Test
public void parseSimpleCommandSkippingCommentLines() {
DslParser parser = new DslParser("# first comment \ndo arg1 arg2\n # second comment ");
DslCommand cmd = parser.nextCommand();
Assert.assertNotNull(cmd);
Assert.assertTrue(cmd.isCommand("do"));
Assert.assertEquals(2, cmd.getArity());
Assert.assertEquals("arg1", cmd.getArgument(0));
Assert.assertEquals("arg2", cmd.getArgument(1));
Assert.assertNull(parser.nextCommand());
}
use of co.rsk.test.dsl.DslParser 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.DslParser 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.DslParser 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.DslParser 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