package function.builtin.cons; import static testutil.TestUtilities.*; import org.junit.Test; public class LISTTester { @Test public void testListWithNoArguments() { String input = "(list)"; assertSExpressionsMatch(evaluateString(input), parseString("nil")); } @Test public void testListWithOneArgument() { String input = "(list 1)"; assertSExpressionsMatch(evaluateString(input), parseString("(1)")); } @Test public void testListWithTwoArguments() { String input = "(list 2 3)"; assertSExpressionsMatch(evaluateString(input), parseString("(2 3)")); } @Test public void testListWithManyArguments() { String input = "(list 'm 'a 'n 'y 'a 'r 'g 's)"; assertSExpressionsMatch(evaluateString(input), parseString("(m a n y a r g s)")); } @Test public void testListWithOneListArgument() { String input = "(list '(1))"; assertSExpressionsMatch(evaluateString(input), parseString("((1))")); } @Test public void testListWithManyListArguments() { String input = "(list '(1) '(2 3) ())"; assertSExpressionsMatch(evaluateString(input), parseString("((1) (2 3) ())")); } @Test public void testMakeList() { assertSExpressionsMatch(LIST.makeList(parseString("22")), parseString("(22)")); } }