36 lines
827 B
Java
36 lines
827 B
Java
package function.builtin.predicate;
|
|
|
|
import static testutil.TestUtilities.*;
|
|
|
|
import org.junit.Test;
|
|
|
|
import function.ArgumentValidator.*;
|
|
|
|
public class LISTPTester {
|
|
|
|
@Test
|
|
public void testListpWithList_ReturnsT() {
|
|
String input = "(listp '(1))";
|
|
|
|
assertSExpressionsMatch(parseString("T"), evaluateString(input));
|
|
}
|
|
|
|
@Test
|
|
public void testListWithNonList_ReturnsNil() {
|
|
String input = "(listp 1)";
|
|
|
|
assertSExpressionsMatch(parseString("NIL"), evaluateString(input));
|
|
}
|
|
|
|
@Test(expected = TooFewArgumentsException.class)
|
|
public void testListpWithTooFewArguments() {
|
|
evaluateString("(listp)");
|
|
}
|
|
|
|
@Test(expected = TooManyArgumentsException.class)
|
|
public void testListpWithTooManyArguments() {
|
|
evaluateString("(listp '() '())");
|
|
}
|
|
|
|
}
|