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

58 lines
1.4 KiB
Java
Raw Normal View History

package function.builtin.cons;
import static function.builtin.cons.LIST.makeList;
import static testutil.TestUtilities.*;
import org.junit.Test;
2017-03-15 13:37:39 -04:00
public class LISTTest {
@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")));
}
}