use of de.neemann.digital.analyse.expression.Variable in project Digital by hneemann.
the class FormatToExpressionTest method testFormatExp.
public void testFormatExp() throws Exception {
Variable a = v("A");
Variable b = v("B");
Expression e = and(not(or(not(a), not(b))), not(and(not(a), not(b))));
assertEquals("!(!A || !B) && !(!A && !B)", FormatToExpression.FORMATTER_JAVA.format(e));
assertEquals("\\nicht{\\nicht{A} \\oder \\nicht{B}} \\und \\nicht{\\nicht{A} \\und \\nicht{B}}", FormatToExpression.FORMATTER_LATEX.format(e));
assertEquals("NOT (NOT A OR NOT B) AND NOT (NOT A AND NOT B)", FormatToExpression.FORMATTER_DERIVE.format(e));
assertEquals("~(~A + ~B) ~(~A ~B)", FormatToExpression.FORMATTER_LOGISIM.format(e));
assertEquals("¬(¬A ∨ ¬B) ∧ ¬(¬A ∧ ¬B)", FormatToExpression.FORMATTER_UNICODE.format(e));
assertEquals("!(!A + !B) * !(!A * !B)", FormatToExpression.FORMATTER_SHORT.format(e));
assertEquals("!(!A + !B) !(!A !B)", FormatToExpression.FORMATTER_SHORTER.format(e));
}
use of de.neemann.digital.analyse.expression.Variable in project Digital by hneemann.
the class FormatToExpressionTest method testFormatExpNot.
public void testFormatExpNot() throws Exception, FormatterException {
Variable a = new Variable("A");
Expression e = not(a);
assertEquals("¬A", FormatToExpression.FORMATTER_UNICODE.format(e));
}
use of de.neemann.digital.analyse.expression.Variable in project Digital by hneemann.
the class FormatToExpressionTest method testFormatTable.
public void testFormatTable() throws Exception {
Variable a = new Variable("A");
Variable b = new Variable("B");
Expression e = and(not(or(not(a), not(b))), not(and(not(a), not(b))));
assertEquals("AB|Y\n" + "00|0\n" + "01|0\n" + "10|0\n" + "11|1\n", new FormatToTable().format(e));
}
use of de.neemann.digital.analyse.expression.Variable in project Digital by hneemann.
the class FormatToExpressionTest method testFormatLatex.
public void testFormatLatex() throws Exception {
Variable a = new Variable("A");
Variable b = new Variable("B");
Expression e = and(not(or(not(a), not(b))), not(and(not(a), not(b))));
assertEquals("\\begin{tabular}{cc|c}\n" + "$A$&$B$&$Y$\\\\\n" + "\\hline\n" + "0&0&0\\\\\n" + "0&1&0\\\\\n" + "1&0&0\\\\\n" + "1&1&1\\\\\n" + "\\end{tabular}\n", new FormatToTableLatex().format(e));
}
use of de.neemann.digital.analyse.expression.Variable 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));
}
Aggregations