transcendental-lisp/test/function/builtin/predicate/LISTPTester.java

36 lines
827 B
Java
Raw Normal View History

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(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 '() '())");
}
}