use of de.neemann.digital.analyse.expression.Expression in project Digital by hneemann.
the class FormatToExpressionTest method testFormatExp2.
public void testFormatExp2() throws Exception {
Variable a = v("A");
Variable b = v("B");
Variable c = v("C");
Expression e = or(and(a, not(b), c), and(a, not(b), not(c)));
assertEquals("(A !B C) + (A !B !C)", FormatToExpression.FORMATTER_SHORTER.format(e));
}
use of de.neemann.digital.analyse.expression.Expression in project Digital by hneemann.
the class FormatToExpressionTest method testFormatXOr.
public void testFormatXOr() throws Exception {
ArrayList<Expression> e = new Parser("let sum=(A^B)^C, let c = (A B) + ((A^B) C)").parse();
assertEquals("sum = (A ⊻ B) ⊻ C", FormatToExpression.FORMATTER_UNICODE.format(e.get(0)));
assertEquals("c = (A ∧ B) ∨ ((A ⊻ B) ∧ C)", FormatToExpression.FORMATTER_UNICODE.format(e.get(1)));
assertEquals("sum = (A \\xoder B) \\xoder C", FormatToExpression.FORMATTER_LATEX.format(e.get(0)));
assertEquals("sum = (A $ B) $ C", FormatToExpression.FORMATTER_CUPL.format(e.get(0)));
assertEquals("sum = (A ^ B) ^ C", FormatToExpression.FORMATTER_JAVA.format(e.get(0)));
assertEquals("sum = (A ^ B) ^ C", FormatToExpression.FORMATTER_SHORT.format(e.get(0)));
assertEquals("sum = (A ^ B) ^ C", FormatToExpression.FORMATTER_SHORTER.format(e.get(0)));
}
use of de.neemann.digital.analyse.expression.Expression in project Digital by hneemann.
the class FormatToExpressionTest method testFormatNamesExp.
public void testFormatNamesExp() throws Exception {
Variable a = v("A");
Variable b = v("B");
Expression e = and(a, b);
NamedExpression n = new NamedExpression("U", e);
assertEquals("U = A ∧ B", FormatToExpression.FORMATTER_UNICODE.format(n));
n = new NamedExpression("V", n);
assertEquals("V = U = A ∧ B", FormatToExpression.FORMATTER_UNICODE.format(n));
}
use of de.neemann.digital.analyse.expression.Expression in project Digital by hneemann.
the class FormatToExpressionTest method testFormatExpLaTeX.
public void testFormatExpLaTeX() throws Exception {
Variable a = new Variable("A_n");
Variable b = new Variable("B_n");
Expression e = new NamedExpression("Y_n+1", and(a, not(b)));
assertEquals("Y_{n+1} = A_{n} \\und \\nicht{B_{n}}", FormatToExpression.FORMATTER_LATEX.format(e));
}
use of de.neemann.digital.analyse.expression.Expression in project Digital by hneemann.
the class IndependentCheckerTest method testSimple.
public void testSimple() {
Expression ex = and(a, b, c);
ContextFiller cf = new ContextFiller(a, b, c, d);
BoolTableExpression bte = new BoolTableExpression(ex, cf);
IndependentChecker ic = new IndependentChecker(bte);
assertEquals(4, ic.getVars());
assertFalse(ic.isIndependentFrom(0));
assertFalse(ic.isIndependentFrom(1));
assertFalse(ic.isIndependentFrom(2));
assertTrue(ic.isIndependentFrom(3));
}
Aggregations