use of co.rsk.test.dsl.DslParser in project rskj by rsksmart.
the class WorldDslProcessorTest method failedAssertBestCommand.
@Test
public void failedAssertBestCommand() {
World world = new World();
WorldDslProcessor processor = new WorldDslProcessor(world);
DslParser parser = new DslParser("block_chain g00 b01 b02\nblock_connect b01 b02\nassert_best b01");
try {
processor.processCommands(parser);
Assert.fail();
} catch (DslProcessorException ex) {
Assert.assertEquals("Expected best block 'b01'", ex.getMessage());
}
}
use of co.rsk.test.dsl.DslParser in project rskj by rsksmart.
the class RevertOpCodeTest method runAndRevertThenRunFullContract.
@Test
public void runAndRevertThenRunFullContract() throws FileNotFoundException, DslProcessorException {
DslParser parser = DslParser.fromResource("dsl/opcode_revert2.txt");
World world = new World();
WorldDslProcessor processor = new WorldDslProcessor(world);
processor.processCommands(parser);
Assert.assertNotNull(world.getAccountByName("acc1"));
Assert.assertTrue(world.getTransactionByName("contract_with_revert").isContractCreation());
Assert.assertTrue(!world.getTransactionByName("tx02").isContractCreation());
Assert.assertTrue(!world.getTransactionByName("tx03").isContractCreation());
}
use of co.rsk.test.dsl.DslParser in project rskj by rsksmart.
the class DslFilesTest method runBlocks03Resource.
@Test
public void runBlocks03Resource() throws FileNotFoundException, DslProcessorException {
DslParser parser = DslParser.fromResource("dsl/blocks03.txt");
World world = new World();
WorldDslProcessor processor = new WorldDslProcessor(world);
processor.processCommands(parser);
Assert.assertNotNull(world.getBlockByName("b01"));
Assert.assertNotNull(world.getBlockByName("b02"));
Assert.assertEquals(2, world.getBlockChain().getStatus().getBestBlock().getNumber());
}
use of co.rsk.test.dsl.DslParser in project rskj by rsksmart.
the class DslFilesTest method runUncles01Resource.
@Test
public void runUncles01Resource() throws FileNotFoundException, DslProcessorException {
DslParser parser = DslParser.fromResource("dsl/uncles01.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.assertEquals(2, world.getBlockChain().getStatus().getBestBlock().getNumber());
}
use of co.rsk.test.dsl.DslParser in project rskj by rsksmart.
the class DslFilesTest method runBlocks01Resource.
@Test
public void runBlocks01Resource() throws FileNotFoundException, DslProcessorException {
DslParser parser = DslParser.fromResource("dsl/blocks01.txt");
World world = new World();
WorldDslProcessor processor = new WorldDslProcessor(world);
processor.processCommands(parser);
Assert.assertNotNull(world.getBlockByName("b01"));
Assert.assertNotNull(world.getBlockByName("b02"));
Assert.assertEquals(2, world.getBlockChain().getStatus().getBestBlock().getNumber());
}
Aggregations