transcendental-lisp/test/function/builtin/LISTTester.java

57 lines
1.3 KiB
Java
Raw Normal View History

package function.builtin;
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)"));
}
}