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

57 lines
1.3 KiB
Java

package function.builtin.cons;
import static testutil.TestUtilities.*;
import org.junit.Test;
public class LISTTester {
@Test
public void testListWithNoArguments() {
String input = "(list)";
assertSExpressionsMatch(parseString("nil"), evaluateString(input));
}
@Test
public void testListWithOneArgument() {
String input = "(list 1)";
assertSExpressionsMatch(parseString("(1)"), evaluateString(input));
}
@Test
public void testListWithTwoArguments() {
String input = "(list 2 3)";
assertSExpressionsMatch(parseString("(2 3)"), evaluateString(input));
}
@Test
public void testListWithManyArguments() {
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 testListWithOneListArgument() {
String input = "(list '(1))";
assertSExpressionsMatch(parseString("((1))"), evaluateString(input));
}
@Test
public void testListWithManyListArguments() {
String input = "(list '(1) '(2 3) ())";
assertSExpressionsMatch(parseString("((1) (2 3) ())"), evaluateString(input));
}
@Test
public void testMakeList() {
assertSExpressionsMatch(parseString("(22)"), LIST.makeList(parseString("22")));
}
}