use of de.be4.ltl.core.ctlparser.node.Start in project probparsers by bendisposto.
the class PositionAspectTest method testSimpleNode.
@Test
public void testSimpleNode() throws Exception {
final String testMachine = "#EXPRESSION x";
final BParser parser = new BParser("testcase");
final Start startNode = parser.parse(testMachine, true);
final PExpression expression = ((AExpressionParseUnit) startNode.getPParseUnit()).getExpression();
final SourcePosition startPos = expression.getStartPos();
final SourcePosition endPos = expression.getEndPos();
assertNotNull(startNode);
assertNotNull(endPos);
assertEquals(1, startPos.getLine());
assertEquals(13, startPos.getPos());
assertEquals(1, endPos.getLine());
assertEquals(14, endPos.getPos());
}
use of de.be4.ltl.core.ctlparser.node.Start in project probparsers by bendisposto.
the class DefinitionsOrderTest method testReordered.
@Test
public void testReordered() throws IOException, BCompoundException {
machine = new File(PATH + "DefinitionsOccurReordered.mch");
final BParser parser = new BParser(machine.getName());
Start start = parser.parseFile(machine, false);
assertNotNull(start);
}
use of de.be4.ltl.core.ctlparser.node.Start in project probparsers by bendisposto.
the class LexerTest method testStringLabeledElements.
@Test
public void testStringLabeledElements() throws BException {
final Start rootNode = parseInput("machine Test invariants \n\t@inv1 asdf \n fdsa \n\t@inv2 qwer: \t rewq \nend", false);
final AMachineParseUnit parseUnit = (AMachineParseUnit) rootNode.getPParseUnit();
final LinkedList<PInvariant> invariants = parseUnit.getInvariants();
AInvariant invariant = (AInvariant) invariants.get(0);
// correct invariant label?
assertEquals("inv1", invariant.getName().getText());
// correct string representation for predicate?
assertEquals("asdf \n fdsa", invariant.getPredicate().getText());
invariant = (AInvariant) invariants.get(1);
// correct invariant label?
assertEquals("inv2", invariant.getName().getText());
// correct string representation for predicate?
assertEquals("qwer: \t rewq", invariant.getPredicate().getText());
}
use of de.be4.ltl.core.ctlparser.node.Start in project probparsers by bendisposto.
the class LexerTest method testStringVariant.
@Test
public void testStringVariant() throws BException {
final Start rootNode = parseInput("machine Test\nvariant y-x\nend", false);
final AMachineParseUnit parseUnit = (AMachineParseUnit) rootNode.getPParseUnit();
final AVariant variantClause = (AVariant) parseUnit.getVariant();
assertEquals("y-x", variantClause.getExpression().getText());
}
use of de.be4.ltl.core.ctlparser.node.Start in project probparsers by bendisposto.
the class StructureTest method testIdentifierTick.
@Test
public void testIdentifierTick() throws Exception {
final Start root = parseInput("machine Mac variables x' y end", false);
final AMachineParseUnit parseUnit = (AMachineParseUnit) root.getPParseUnit();
final LinkedList<PVariable> variables = parseUnit.getVariables();
assertEquals(2, variables.size());
assertEquals("x'", ((AVariable) variables.get(0)).getName().getText());
assertEquals("y", ((AVariable) variables.get(1)).getName().getText());
}
Aggregations