2017-01-14 18:01:14 -05:00
|
|
|
package function.builtin.predicate;
|
2017-01-13 12:52:05 -05:00
|
|
|
|
|
|
|
import static testutil.TestUtilities.*;
|
|
|
|
|
|
|
|
import org.junit.Test;
|
|
|
|
|
|
|
|
import function.ArgumentValidator.*;
|
|
|
|
|
|
|
|
public class LISTPTester {
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testListpWithList_ReturnsT() {
|
|
|
|
String input = "(listp '(1))";
|
|
|
|
|
|
|
|
assertSExpressionsMatch(evaluateString(input), parseString("T"));
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testListWithNonList_ReturnsNil() {
|
|
|
|
String input = "(listp 1)";
|
|
|
|
|
|
|
|
assertSExpressionsMatch(evaluateString(input), parseString("NIL"));
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test(expected = TooFewArgumentsException.class)
|
|
|
|
public void testListpWithTooFewArguments() {
|
2017-01-13 14:05:33 -05:00
|
|
|
evaluateString("(listp)");
|
2017-01-13 12:52:05 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test(expected = TooManyArgumentsException.class)
|
|
|
|
public void testListpWithTooManyArguments() {
|
2017-01-13 14:05:33 -05:00
|
|
|
evaluateString("(listp '() '())");
|
2017-01-13 12:52:05 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|