package function.builtin.math; import static testutil.TestUtilities.*; import org.junit.Test; import function.ArgumentValidator.*; public class DIVIDETester { @Test public void testDivideWithOne() { String input = "(/ 1)"; assertSExpressionsMatch(evaluateString(input), parseString("1")); } @Test public void testDivideWithTwo() { String input = "(/ 2)"; assertSExpressionsMatch(evaluateString(input), parseString("0")); } @Test public void testDivideTwoNumbers() { String input = "(/ 24 3)"; assertSExpressionsMatch(evaluateString(input), parseString("8")); } @Test public void testDivideSeveralNumbers() { String input = "(/ 256 2 2 8)"; assertSExpressionsMatch(evaluateString(input), parseString("8")); } @Test public void testDivideTwoNumbersWithRemainder() { String input = "(/ 9 2)"; assertSExpressionsMatch(evaluateString(input), parseString("4")); } @Test public void testDivideSeveralNumbersWithRemainder() { String input = "(/ 19 2 5)"; assertSExpressionsMatch(evaluateString(input), parseString("1")); } @Test(expected = BadArgumentTypeException.class) public void testDivideWithNonNumber() { evaluateString("(/ 'x)"); } @Test(expected = TooFewArgumentsException.class) public void testDivideWithTooFewArguments() { evaluateString("(/)"); } }