use of de.be4.classicalb.core.preparser.parser.Parser in project probparsers by bendisposto.
the class ByteOrderMarkTests method testParsable.
@Test
public void testParsable() throws Exception {
final BParser parser = new BParser(machine.getName());
Start start = parser.parseFile(machine, false);
start.apply(new PositionTester());
assertNotNull(start);
}
use of de.be4.classicalb.core.preparser.parser.Parser in project probparsers by bendisposto.
the class DefinitionFilesTest method testRealFiles.
/*
* test with real files
*/
@Test
public void testRealFiles() throws Exception {
final BParser parser = new BParser("testcase");
File machine = new File("src/test/resources/parsable/DefinitionFileTest.mch");
parser.parseFile(machine, false);
final IDefinitions definitions = parser.getDefinitions();
final APredicateDefinitionDefinition def1 = (APredicateDefinitionDefinition) definitions.getDefinition("GRD2");
assertEquals("GRD2", def1.getName().getText());
assertEquals(0, def1.getParameters().size());
assertTrue(def1.getRhs() instanceof PPredicate);
final APredicateDefinitionDefinition def2 = (APredicateDefinitionDefinition) definitions.getDefinition("GRD1");
assertEquals("GRD1", def2.getName().getText());
assertEquals(0, def2.getParameters().size());
assertTrue(def2.getRhs() instanceof PPredicate);
}
use of de.be4.classicalb.core.preparser.parser.Parser in project probparsers by bendisposto.
the class DefinitionFilesTest method testOneDefinitionFile.
@Test
public void testOneDefinitionFile() throws BCompoundException {
final String testMachine = "MACHINE Test\nDEFINITIONS \"DefFile\"; def1 == xx\nINVARIANT def2 = def3\nEND";
final BParser parser = new BParser("testcase");
parser.parse(testMachine, true, this);
final IDefinitions definitions = parser.getDefinitions();
final AExpressionDefinitionDefinition def1 = (AExpressionDefinitionDefinition) definitions.getDefinition("def1");
assertEquals("def1", def1.getName().getText());
assertEquals(0, def1.getParameters().size());
assertTrue(def1.getRhs() instanceof AIdentifierExpression);
final AExpressionDefinitionDefinition def2 = (AExpressionDefinitionDefinition) definitions.getDefinition("def2");
assertEquals("def2", def2.getName().getText());
assertEquals(0, def2.getParameters().size());
assertTrue(def2.getRhs() instanceof AIdentifierExpression);
}
use of de.be4.classicalb.core.preparser.parser.Parser in project probparsers by bendisposto.
the class DefinitionsOrderTest method testLinearOrder.
@Test
public void testLinearOrder() throws IOException, BCompoundException {
machine = new File(PATH + "DefinitionsOccurInLinearOrder.mch");
final BParser parser = new BParser(machine.getName());
Start start = parser.parseFile(machine, false);
assertNotNull(start);
}
use of de.be4.classicalb.core.preparser.parser.Parser in project probparsers by bendisposto.
the class StructuralTest method testClause1.
@Test
public void testClause1() throws Exception {
final String testMachine = "MACHINE SimplyStructure END";
// System.out.println("Parsing: \"" + testMachine + "\":");
final BParser parser = new BParser("testcase");
final Start startNode = parser.parse(testMachine, true);
assertNotNull(startNode);
// TODO more tests
}
Aggregations