Search in sources :

Example 11 with Parser

use of de.neemann.digital.analyse.parser.Parser 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)));
}
Also used : Expression(de.neemann.digital.analyse.expression.Expression) NamedExpression(de.neemann.digital.analyse.expression.NamedExpression) Parser(de.neemann.digital.analyse.parser.Parser)

Aggregations

Expression (de.neemann.digital.analyse.expression.Expression)11 Parser (de.neemann.digital.analyse.parser.Parser)11 NamedExpression (de.neemann.digital.analyse.expression.NamedExpression)1 CircuitBuilder (de.neemann.digital.builder.circuit.CircuitBuilder)1 Model (de.neemann.digital.core.Model)1 Circuit (de.neemann.digital.draw.elements.Circuit)1 ElementLibrary (de.neemann.digital.draw.library.ElementLibrary)1 ModelCreator (de.neemann.digital.draw.model.ModelCreator)1 ShapeFactory (de.neemann.digital.draw.shapes.ShapeFactory)1