}
@Test(dependsOnMethods = { "testVariables" })
public void testRationalExpressions() {
Expression evaluated;
RationalNumber oneHalf = new LongRationalNumber(1, 2);
RationalNumber oneThird = new LongRationalNumber(1, 3);
Expression sum = new Addition(oneHalf, oneThird);
evaluated = sum.evaluate();
System.out.printf("%s = %s%n", sum, evaluated);
assertEquals(evaluated, new LongRationalNumber(5, 6));
Expression difference = new Subtraction(oneHalf, oneThird);
evaluated = difference.evaluate();
System.out.printf("%s = %s%n", difference, evaluated);
assertEquals(evaluated, new LongRationalNumber(1, 6));
RationalNumber sixEighth = new LongRationalNumber(6, 8);
evaluated = sixEighth.evaluate();
System.out.printf("%s = %s%n", sixEighth, evaluated);
assertEquals(evaluated, new LongRationalNumber(3, 4));
difference = new Subtraction(new LongRationalNumber(2, 3), new LongRationalNumber(1, 6));
evaluated = difference.evaluate();
System.out.printf("%s = %s%n", difference, evaluated);
assertEquals(evaluated, new LongRationalNumber(1, 2));
Expression product = new Multiplication(new LongRationalNumber(2, 3), new LongRationalNumber(9, 2));
ElementOf isNatural = new ElementOf(product, N);
evaluated = isNatural.evaluate();
System.out.printf("%s = %s : %s%n", product.evaluate(), isNatural, evaluated);
assertEquals(evaluated, TruthValue.True);