40 lines
969 B
Java
40 lines
969 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() {
|
|
String input = "(listp)";
|
|
|
|
assertSExpressionsMatch(evaluateString(input), parseString("NIL"));
|
|
}
|
|
|
|
@Test(expected = TooManyArgumentsException.class)
|
|
public void testListpWithTooManyArguments() {
|
|
String input = "(listp '() '())";
|
|
|
|
assertSExpressionsMatch(evaluateString(input), parseString("NIL"));
|
|
}
|
|
|
|
}
|