001 import org.junit.Test;
002
003 import sexp.SExp;
004 import sexp.SExpParseException;
005 import sexp.SExpParser;
006 import sexp.SList;
007 import static org.junit.Assert.*;
008
009
010 public class SExpUtilTest {
011 @Test public void appendTest() throws SExpParseException {
012 assertEquals(make("(a b c d e f)"),
013 SExpUtil.append((SList) make("(a b c)"), (SList) make("(d e f)")));
014 }
015
016 @Test public void flattenTest() throws SExpParseException {
017 assertEquals(make("(a b c d e f)"),
018 SExpUtil.flatten((SList) make("(a ((b c) d e) f)")));
019
020 }
021
022 SExp make(String s) throws SExpParseException {
023 return new SExpParser().parse(s);
024 }
025 }