use of de.neemann.digital.analyse.parser.Parser in project Digital by hneemann.
the class KarnaughMapTest method testSimple2_singleAnd.
public void testSimple2_singleAnd() throws IOException, ParseException, KarnaughException {
Expression exp = new Parser("A B").parse().get(0);
KarnaughMap c = new KarnaughMap(Variable.vars(2), exp);
assertEquals(1, c.size());
for (KarnaughMap.Cover co : c) assertEquals(1, co.getSize());
}
use of de.neemann.digital.analyse.parser.Parser in project Digital by hneemann.
the class KarnaughMapTest method testSimple3.
public void testSimple3() throws IOException, ParseException, KarnaughException {
Expression exp = new Parser("(A ¬C) ∨ (¬A ¬B) ∨ (B C)").parse().get(0);
KarnaughMap c = new KarnaughMap(Variable.vars(3), exp);
assertEquals(3, c.size());
for (KarnaughMap.Cover co : c) assertEquals(2, co.getSize());
}
use of de.neemann.digital.analyse.parser.Parser in project Digital by hneemann.
the class KarnaughMapTest method testSimple2.
public void testSimple2() throws IOException, ParseException, KarnaughException {
Expression exp = new Parser("(A ¬B) ∨ (¬A B)").parse().get(0);
KarnaughMap c = new KarnaughMap(Variable.vars(2), exp);
assertEquals(2, c.size());
for (KarnaughMap.Cover co : c) assertEquals(1, co.getSize());
}
use of de.neemann.digital.analyse.parser.Parser in project Digital by hneemann.
the class ExpressionListenerJKTest method testSimple.
public void testSimple() throws IOException, ParseException, FormatterException, ExpressionException {
ExpressionListenerOptimizeJKTest.TestEL exp = new ExpressionListenerOptimizeJKTest.TestEL();
ExpressionListener elojk = new ExpressionListenerJK(exp);
Expression e1 = new Parser("(Sn*A)+(!Sn*B)").parse().get(0);
elojk.resultFound("Sn+1", e1);
elojk.close();
assertEquals(3, exp.getList().size());
assertEquals(e1, exp.getList().get(0));
assertEquals("B", exp.getList().get(1).toString());
assertEquals("not(A)", exp.getList().get(2).toString());
}
use of de.neemann.digital.analyse.parser.Parser in project Digital by hneemann.
the class ExpressionListenerOptimizeJKTest method testSimpleSwap.
public void testSimpleSwap() throws IOException, ParseException, FormatterException, ExpressionException {
TestEL exp = new TestEL();
ExpressionListener elojk = new ExpressionListenerOptimizeJK(exp);
Expression e1, e2;
elojk.resultFound("Sn+1", e2 = new Parser("(Sn*A)+(!C*B)").parse().get(0));
elojk.resultFound("Sn+1", e1 = new Parser("(Sn*A)+(!Sn*B)").parse().get(0));
elojk.close();
assertEquals(1, exp.getList().size());
assertEquals(e1, exp.getList().get(0));
}
Aggregations