use of co.rsk.test.dsl.DslParser in project rskj by rsksmart.
the class DslParserTest method parseSimpleCommandWithAdditionalSpacesAndTabs.
@Test
public void parseSimpleCommandWithAdditionalSpacesAndTabs() {
DslParser parser = new DslParser(" do\t\t arg1 \t arg2 ");
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 DslParserTest method parseSimpleCommandSkippingEmptyLines.
@Test
public void parseSimpleCommandSkippingEmptyLines() {
DslParser parser = new DslParser(" \ndo arg1 arg2\n ");
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 DslParserTest method parseSimpleCommandWithNoArguments.
@Test
public void parseSimpleCommandWithNoArguments() {
DslParser parser = new DslParser("do");
DslCommand cmd = parser.nextCommand();
Assert.assertNotNull(cmd);
Assert.assertTrue(cmd.isCommand("do"));
Assert.assertEquals(0, cmd.getArity());
Assert.assertNull(parser.nextCommand());
}
use of co.rsk.test.dsl.DslParser in project rskj by rsksmart.
the class WorldDslProcessorTest method processBlockChainCommandWithTwoChildBlocks.
@Test
public void processBlockChainCommandWithTwoChildBlocks() throws DslProcessorException {
World world = new World();
WorldDslProcessor processor = new WorldDslProcessor(world);
DslParser parser = new DslParser("block_chain g00 b01 b02");
processor.processCommands(parser);
Block genesis = world.getBlockByName("g00");
Block block1 = world.getBlockByName("b01");
Assert.assertNotNull(block1);
Assert.assertEquals(1, block1.getNumber());
Assert.assertEquals(genesis.getHash(), block1.getParentHash());
Block block2 = world.getBlockByName("b02");
Assert.assertNotNull(block2);
Assert.assertEquals(2, block2.getNumber());
Assert.assertEquals(block1.getHash(), block2.getParentHash());
}
use of co.rsk.test.dsl.DslParser in project rskj by rsksmart.
the class WorldDslProcessorTest method processAccountNewCommandWithBalance.
@Test
public void processAccountNewCommandWithBalance() throws DslProcessorException {
World world = new World();
WorldDslProcessor processor = new WorldDslProcessor(world);
DslParser parser = new DslParser("account_new acc1 1000000");
processor.processCommands(parser);
Account account = world.getAccountByName("acc1");
Assert.assertNotNull(account);
Assert.assertEquals(new BigInteger("1000000"), world.getRepository().getBalance(account.getAddress()).asBigInteger());
}
Aggregations