2017-01-14 18:01:14 -05:00
|
|
|
package function.builtin.predicate;
|
2017-01-04 13:57:16 -05:00
|
|
|
|
2017-01-27 11:37:11 -05:00
|
|
|
import static testutil.TestUtilities.evaluateString;
|
|
|
|
import static testutil.TypeAssertions.*;
|
2017-01-04 13:57:16 -05:00
|
|
|
|
|
|
|
import org.junit.Test;
|
|
|
|
|
|
|
|
import function.ArgumentValidator.*;
|
|
|
|
|
2017-03-15 13:37:39 -04:00
|
|
|
public class NUMERIC_GREATERTest {
|
2017-01-04 13:57:16 -05:00
|
|
|
|
2017-01-05 18:00:21 -05:00
|
|
|
@Test
|
2017-02-28 11:54:19 -05:00
|
|
|
public void greaterThanWithOneNumber_ReturnsT() {
|
2017-01-05 18:00:21 -05:00
|
|
|
String input = "(> 1)";
|
|
|
|
|
2017-01-27 11:37:11 -05:00
|
|
|
assertT(evaluateString(input));
|
2017-01-05 18:00:21 -05:00
|
|
|
}
|
|
|
|
|
2017-01-04 13:57:16 -05:00
|
|
|
@Test
|
2017-02-28 11:54:19 -05:00
|
|
|
public void greaterThanWithTwoNumbers_ReturnsNil() {
|
2017-01-04 13:57:16 -05:00
|
|
|
String input = "(> 1 2)";
|
|
|
|
|
2017-01-27 11:37:11 -05:00
|
|
|
assertNil(evaluateString(input));
|
2017-01-04 13:57:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
2017-02-28 11:54:19 -05:00
|
|
|
public void greaterThanWithTwoNumbers_ReturnsT() {
|
2017-01-04 13:57:16 -05:00
|
|
|
String input = "(> 3 2)";
|
|
|
|
|
2017-01-27 11:37:11 -05:00
|
|
|
assertT(evaluateString(input));
|
2017-01-04 13:57:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
2017-02-28 11:54:19 -05:00
|
|
|
public void greaterThanWithManyNumbers_ReturnsNil() {
|
2017-01-04 13:57:16 -05:00
|
|
|
String input = "(> 4 3 2 5 1)";
|
|
|
|
|
2017-01-27 11:37:11 -05:00
|
|
|
assertNil(evaluateString(input));
|
2017-01-04 13:57:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
2017-02-28 11:54:19 -05:00
|
|
|
public void greaterThanWithManyNumbers() {
|
2017-01-04 13:57:16 -05:00
|
|
|
String input = "(> 4 3 2 1 0)";
|
|
|
|
|
2017-01-27 11:37:11 -05:00
|
|
|
assertT(evaluateString(input));
|
2017-01-04 13:57:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test(expected = BadArgumentTypeException.class)
|
2017-02-28 11:54:19 -05:00
|
|
|
public void greaterThanWithNonNumbers() {
|
2017-01-04 13:57:16 -05:00
|
|
|
evaluateString("(> 'x 'x)");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test(expected = TooFewArgumentsException.class)
|
2017-02-28 11:54:19 -05:00
|
|
|
public void greaterThanWithTooFewArguments() {
|
2017-01-05 18:00:21 -05:00
|
|
|
evaluateString("(>)");
|
2017-01-04 13:57:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|