2017-02-27 15:36:17 -05:00
|
|
|
package function.builtin.special;
|
|
|
|
|
2017-11-12 09:42:25 -05:00
|
|
|
import static testutil.TestUtilities.assertSExpressionsMatch;
|
|
|
|
import static testutil.TestUtilities.evaluateString;
|
|
|
|
import static testutil.TestUtilities.parseString;
|
2017-02-27 15:36:17 -05:00
|
|
|
import static testutil.TypeAssertions.assertNil;
|
|
|
|
|
|
|
|
import org.junit.Test;
|
|
|
|
|
2017-07-19 15:23:15 -04:00
|
|
|
import testutil.SymbolAndFunctionCleaner;
|
|
|
|
|
|
|
|
public class PROGNTest extends SymbolAndFunctionCleaner {
|
2017-02-27 15:36:17 -05:00
|
|
|
|
|
|
|
@Test
|
|
|
|
public void prognWithNoArguments() {
|
|
|
|
assertNil(evaluateString("(progn)"));
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void prognWithOneArgument() {
|
|
|
|
assertSExpressionsMatch(parseString("1"), evaluateString("(progn 1)"));
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void prognWithSeveralArguments() {
|
|
|
|
assertSExpressionsMatch(parseString("5"), evaluateString("(progn 1 2 3 4 5)"));
|
|
|
|
}
|
|
|
|
|
2017-03-07 13:15:40 -05:00
|
|
|
@Test
|
|
|
|
public void beginWithSeveralArguments() {
|
|
|
|
assertSExpressionsMatch(parseString("5"), evaluateString("(begin 1 2 3 4 5)"));
|
|
|
|
}
|
|
|
|
|
2017-02-27 15:36:17 -05:00
|
|
|
@Test
|
|
|
|
public void prognEvaluatesArgument() {
|
|
|
|
assertSExpressionsMatch(parseString("1"), evaluateString("(progn (car '(1 2 3)))"));
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void prognWithDifferentArgumentTypes() {
|
|
|
|
assertSExpressionsMatch(parseString("pear"), evaluateString("(progn t nil '(1 2) 'pear)"));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|