/** Tests if a given formula is ripe for CTL verification. */ @Test public void testIsCtlFormula() { Formula a = Prop("a"); Formula b = Prop("b"); Formula c = Prop("c"); // Any simple propositional formula assertTrue(a.isCtlFormula()); assertTrue(True().isCtlFormula()); assertTrue(False().isCtlFormula()); assertTrue(And(Or(Not(a), b), c).isCtlFormula()); // implication-like operators assertTrue(Implies(a, b).isCtlFormula()); assertTrue(Follows(a, b).isCtlFormula()); assertTrue(Equiv(a, b).isCtlFormula()); // No next without path quantifier assertFalse(Next(a).isCtlFormula()); assertTrue(Exists(Next(a)).isCtlFormula()); // No until without path quantifier assertFalse(Until(a, b).isCtlFormula()); assertTrue(Forall(Until(a, b)).isCtlFormula()); // no weak until or release assertFalse(Forall(WUntil(a, b)).isCtlFormula()); assertFalse(Forall(Release(a, b)).isCtlFormula()); assertFalse(Forall(SRelease(a, b)).isCtlFormula()); assertTrue(Forall(Until(a, b)).isCtlFormula()); // No isolated path quantifier assertFalse(Forall(a).isCtlFormula()); }
private void testParse(String text, Formula expected) { Formula result = FormulaParser.instance().parse(text); assertEquals(expected, result); if (result.hasErrors()) { fail(result.getErrors().toString()); } }
private void testToCtlFormula(String expected, Formula f) { try { assertEquals(FormulaParser.instance().parse(expected), f.toCtlFormula()); } catch (FormatException e) { fail(e.getMessage()); } }
private void testEquals(String s, Formula f) { assertEquals(s, f.toLine().toFlatString()); }
private void testParseError(String text) { Formula result = FormulaParser.instance().parse(text); assertTrue(result.hasErrors()); }