package function.builtin.cons; import static function.builtin.cons.LIST.makeList; import static testutil.TestUtilities.*; import org.junit.Test; public class LISTTester { @Test public void listWithNoArguments() { String input = "(list)"; assertSExpressionsMatch(parseString("nil"), evaluateString(input)); } @Test public void listWithOneArgument() { String input = "(list 1)"; assertSExpressionsMatch(parseString("(1)"), evaluateString(input)); } @Test public void listWithTwoArguments() { String input = "(list 2 3)"; assertSExpressionsMatch(parseString("(2 3)"), evaluateString(input)); } @Test public void listWithManyArguments() { String input = "(list 'm 'a 'n 'y 'a 'r 'g 's)"; assertSExpressionsMatch(parseString("(m a n y a r g s)"), evaluateString(input)); } @Test public void listWithOneListArgument() { String input = "(list '(1))"; assertSExpressionsMatch(parseString("((1))"), evaluateString(input)); } @Test public void listWithManyListArguments() { String input = "(list '(1) '(2 3) ())"; assertSExpressionsMatch(parseString("((1) (2 3) ())"), evaluateString(input)); } @Test public void staticMakeList() { assertSExpressionsMatch(parseString("(22)"), makeList(parseString("22"))); } }