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(parseString("T"), evaluateString(input));
|
|
}
|
|
|
|
@Test
|
|
public void testAtom_ReturnsFalse() {
|
|
String input = "(atom '(1 2 3))";
|
|
|
|
assertSExpressionsMatch(parseString("()"), evaluateString(input));
|
|
}
|
|
|
|
@Test(expected = TooManyArgumentsException.class)
|
|
public void testApplyWithTooManyArguments() {
|
|
evaluateString("(atom '1 '2)");
|
|
}
|
|
|
|
@Test(expected = TooFewArgumentsException.class)
|
|
public void testApplyWithTooFewArguments() {
|
|
evaluateString("(atom)");
|
|
}
|
|
|
|
}
|