use of com.sri.ai.grinder.theory.tuple.rewriter.TupleSetSimplifier in project aic-expresso by aic-sri-international.
the class TupleRewriterTest method testTupleSetSimplification.
@Test
public void testTupleSetSimplification() {
Simplifier tupleSetSimplifier = new TupleSetSimplifier();
Assert.assertEquals(parse("(e,b,c)"), tupleSetSimplifier.apply(parse("set((a,b,c),1,e)"), context));
Assert.assertEquals(parse("(a,e,c)"), tupleSetSimplifier.apply(parse("set((a,b,c),2,e)"), context));
Assert.assertEquals(parse("(a,b,e)"), tupleSetSimplifier.apply(parse("set((a,b,c),3,e)"), context));
Assert.assertEquals(parse("tuple(e)"), tupleSetSimplifier.apply(parse("set(tuple(a),I,e)"), context));
Assert.assertEquals(parse("if I = 1 then (e,b) else (a,e)"), tupleSetSimplifier.apply(parse("set((a,b),I,e)"), context));
Assert.assertEquals(parse("if I = 1 then (e,b,c) else if I = 2 then (a,e,c) else (a,b,e)"), tupleSetSimplifier.apply(parse("set((a,b,c),I,e)"), context));
Expression expr = parse("set(I, (a,b,c), e)");
Assert.assertTrue(expr == tupleSetSimplifier.apply(expr, context));
}
Aggregations