36 lines
817 B
Java
36 lines
817 B
Java
package function.builtin;
|
|
|
|
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() {
|
|
evaluateString("(listp)");
|
|
}
|
|
|
|
@Test(expected = TooManyArgumentsException.class)
|
|
public void testListpWithTooManyArguments() {
|
|
evaluateString("(listp '() '())");
|
|
}
|
|
|
|
}
|