예제 #1
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);
  }
예제 #2
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);
 }
예제 #3
0
 public final void testSideEffectZeroTimesExp() {
   Times t = new Times();
   t.type = IntegerType.instance;
   operationWithZero(t, Times.class, true, true);
 }