36 lines
809 B
Java
36 lines
809 B
Java
package function.builtin.predicate;
|
|
|
|
import static testutil.TestUtilities.*;
|
|
|
|
import org.junit.Test;
|
|
|
|
import function.ArgumentValidator.*;
|
|
|
|
public class ATOMTester {
|
|
|
|
@Test
|
|
public void testAtom_ReturnsTrue() {
|
|
String input = "(atom 'a)";
|
|
|
|
assertSExpressionsMatch(evaluateString(input), parseString("T"));
|
|
}
|
|
|
|
@Test
|
|
public void testAtom_ReturnsFalse() {
|
|
String input = "(atom '(1 2 3))";
|
|
|
|
assertSExpressionsMatch(evaluateString(input), parseString("()"));
|
|
}
|
|
|
|
@Test(expected = TooManyArgumentsException.class)
|
|
public void testApplyWithTooManyArguments() {
|
|
evaluateString("(atom '1 '2)");
|
|
}
|
|
|
|
@Test(expected = TooFewArgumentsException.class)
|
|
public void testApplyWithTooFewArguments() {
|
|
evaluateString("(atom)");
|
|
}
|
|
|
|
}
|