示例#1
0
  public final void testMultiplicationBetweenIntegersSimplification() {
    Times times = new Times();
    times.left = new Number(5);
    times.left.type = IntegerType.instance;
    times.right = new Number(2);
    times.right.type = IntegerType.instance;

    expressionSimplificationTester(times, Number.class, IntegerType.instance, 10, true);
  }
示例#2
0
  private void multiplyWithOne(boolean oneOnLeft) {
    Times t = new Times();
    t.type = IntegerType.instance;
    IdExpression id = new IdExpression("mult");
    id.type = IntegerType.instance;
    if (oneOnLeft) {
      t.left = new Number(1);
      t.right = id;
    } else {
      t.right = new Number(1);
      t.left = id;
    }

    IdExpression idExp =
        (IdExpression)
            expressionSimplificationTester(t, IdExpression.class, IntegerType.instance, 0, false);

    assertEquals(idExp.id, id.id);
  }
示例#3
0
 private void multiplyToGetZero(boolean zeroOnLeft) {
   Times t = new Times();
   t.type = IntegerType.instance;
   Number n = (Number) operationWithZero(t, Number.class, zeroOnLeft, false);
   assertEquals(n.id, 0);
 }
示例#4
0
 public final void testSideEffectZeroTimesExp() {
   Times t = new Times();
   t.type = IntegerType.instance;
   operationWithZero(t, Times.class, true, true);
 }