package testutil; import static org.junit.Assert.*; import sexpression.*; public final class TypeAssertions { public static void assertList(SExpression sExpression) { assertFalse(sExpression.isAtom()); assertTrue(sExpression.isCons()); assertFalse(sExpression.isFunction()); assertTrue(sExpression.isList()); assertFalse(sExpression.isNull()); assertFalse(sExpression.isNumber()); assertFalse(sExpression.isString()); assertFalse(sExpression.isSymbol()); } public static void assertNil(SExpression sExpression) { assertEquals(Nil.getInstance(), sExpression); assertTrue(sExpression.isAtom()); assertFalse(sExpression.isCons()); assertFalse(sExpression.isFunction()); assertTrue(sExpression.isList()); assertTrue(sExpression.isNull()); assertFalse(sExpression.isNumber()); assertFalse(sExpression.isString()); assertTrue(sExpression.isSymbol()); } public static void assertNumber(SExpression sExpression) { assertTrue(sExpression.isAtom()); assertFalse(sExpression.isCons()); assertFalse(sExpression.isFunction()); assertFalse(sExpression.isList()); assertFalse(sExpression.isNull()); assertTrue(sExpression.isNumber()); assertFalse(sExpression.isString()); assertFalse(sExpression.isSymbol()); } public static void assertString(SExpression sExpression) { assertTrue(sExpression.isAtom()); assertFalse(sExpression.isCons()); assertFalse(sExpression.isFunction()); assertFalse(sExpression.isList()); assertFalse(sExpression.isNull()); assertFalse(sExpression.isNumber()); assertTrue(sExpression.isString()); assertFalse(sExpression.isSymbol()); } public static void assertSymbol(SExpression sExpression) { assertTrue(sExpression.isAtom()); assertFalse(sExpression.isCons()); assertFalse(sExpression.isFunction()); assertFalse(sExpression.isList()); assertFalse(sExpression.isNull()); assertFalse(sExpression.isNumber()); assertFalse(sExpression.isString()); assertTrue(sExpression.isSymbol()); } public static void assertT(SExpression sExpression) { assertEquals(Symbol.T, sExpression); } }