package function.builtin.special;

import static testutil.TestUtilities.assertSExpressionsMatch;
import static testutil.TestUtilities.evaluateString;
import static testutil.TestUtilities.parseString;
import static testutil.TypeAssertions.assertNil;

import org.junit.Test;

import testutil.SymbolAndFunctionCleaner;

public class PROGNTest extends SymbolAndFunctionCleaner {

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

    @Test
    public void beginWithSeveralArguments() {
        assertSExpressionsMatch(parseString("5"), evaluateString("(begin 1 2 3 4 5)"));
    }

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

}
