transcendental-lisp/test/function/builtin/predicate/NUMERIC_GREATERTest.java

61 lines
1.4 KiB
Java

package function.builtin.predicate;
import static testutil.TestUtilities.evaluateString;
import static testutil.TypeAssertions.assertNil;
import static testutil.TypeAssertions.assertT;
import org.junit.Test;
import function.ArgumentValidator.BadArgumentTypeException;
import function.ArgumentValidator.TooFewArgumentsException;
import testutil.SymbolAndFunctionCleaner;
public class NUMERIC_GREATERTest extends SymbolAndFunctionCleaner {
@Test
public void greaterThanWithOneNumber_ReturnsT() {
String input = "(> 1)";
assertT(evaluateString(input));
}
@Test
public void greaterThanWithTwoNumbers_ReturnsNil() {
String input = "(> 1 2)";
assertNil(evaluateString(input));
}
@Test
public void greaterThanWithTwoNumbers_ReturnsT() {
String input = "(> 3 2)";
assertT(evaluateString(input));
}
@Test
public void greaterThanWithManyNumbers_ReturnsNil() {
String input = "(> 4 3 2 5 1)";
assertNil(evaluateString(input));
}
@Test
public void greaterThanWithManyNumbers() {
String input = "(> 4 3 2 1 0)";
assertT(evaluateString(input));
}
@Test(expected = BadArgumentTypeException.class)
public void greaterThanWithNonNumbers() {
evaluateString("(> 'x 'x)");
}
@Test(expected = TooFewArgumentsException.class)
public void greaterThanWithTooFewArguments() {
evaluateString("(>)");
}
}