2017-01-14 18:01:14 -05:00
|
|
|
package function.builtin.predicate;
|
2017-01-13 12:52:05 -05:00
|
|
|
|
2017-01-27 11:37:11 -05:00
|
|
|
import static testutil.TestUtilities.evaluateString;
|
2017-11-12 09:42:25 -05:00
|
|
|
import static testutil.TypeAssertions.assertNil;
|
|
|
|
import static testutil.TypeAssertions.assertT;
|
2017-01-13 12:52:05 -05:00
|
|
|
|
|
|
|
import org.junit.Test;
|
|
|
|
|
2017-11-12 09:42:25 -05:00
|
|
|
import function.ArgumentValidator.TooFewArgumentsException;
|
|
|
|
import function.ArgumentValidator.TooManyArgumentsException;
|
2017-07-19 15:23:15 -04:00
|
|
|
import testutil.SymbolAndFunctionCleaner;
|
2017-01-13 12:52:05 -05:00
|
|
|
|
2017-07-19 15:23:15 -04:00
|
|
|
public class LISTPTest extends SymbolAndFunctionCleaner {
|
2017-01-13 12:52:05 -05:00
|
|
|
|
|
|
|
@Test
|
2017-02-28 11:54:19 -05:00
|
|
|
public void listpWithList() {
|
2017-01-27 11:37:11 -05:00
|
|
|
assertT(evaluateString("(listp '(1))"));
|
2017-01-13 12:52:05 -05:00
|
|
|
}
|
|
|
|
|
2017-03-07 13:15:40 -05:00
|
|
|
@Test
|
|
|
|
public void listpWithListAndAlias() {
|
|
|
|
assertT(evaluateString("(list? '(1))"));
|
|
|
|
}
|
|
|
|
|
2017-01-13 12:52:05 -05:00
|
|
|
@Test
|
2017-02-28 11:54:19 -05:00
|
|
|
public void listpWithNonList() {
|
2017-01-27 11:37:11 -05:00
|
|
|
assertNil(evaluateString("(listp 1)"));
|
2017-01-13 12:52:05 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test(expected = TooFewArgumentsException.class)
|
2017-02-28 11:54:19 -05:00
|
|
|
public void listpWithTooFewArguments() {
|
2017-01-13 14:05:33 -05:00
|
|
|
evaluateString("(listp)");
|
2017-01-13 12:52:05 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test(expected = TooManyArgumentsException.class)
|
2017-02-28 11:54:19 -05:00
|
|
|
public void listpWithTooManyArguments() {
|
2017-01-13 14:05:33 -05:00
|
|
|
evaluateString("(listp '() '())");
|
2017-01-13 12:52:05 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|