transcendental-lisp/test/function/builtin/GREATERPTester.java

57 lines
1.3 KiB
Java

package function.builtin;
import static testutil.TestUtilities.*;
import org.junit.Test;
import function.ArgumentValidator.*;
public class GREATERPTester {
@Test
public void testGreaterpWithOneNumber_ReturnsT() {
String input = "(> 1)";
assertSExpressionsMatch(evaluateString(input), parseString("t"));
}
@Test
public void testGreaterpWithTwoNumbers_ReturnsNil() {
String input = "(> 1 2)";
assertSExpressionsMatch(evaluateString(input), parseString("nil"));
}
@Test
public void testGreaterpWithTwoNumbers_ReturnsT() {
String input = "(> 3 2)";
assertSExpressionsMatch(evaluateString(input), parseString("t"));
}
@Test
public void testGreaterpWithManyNumbers_ReturnsNil() {
String input = "(> 4 3 2 5 1)";
assertSExpressionsMatch(evaluateString(input), parseString("nil"));
}
@Test
public void testGreaterpWithManyNumbers_ReturnsT() {
String input = "(> 4 3 2 1 0)";
assertSExpressionsMatch(evaluateString(input), parseString("t"));
}
@Test(expected = BadArgumentTypeException.class)
public void testGreaterpWithNonNumbers() {
evaluateString("(> 'x 'x)");
}
@Test(expected = TooFewArgumentsException.class)
public void testGreaterpWithTooFewArguments() {
evaluateString("(>)");
}
}