2017-01-14 18:01:14 -05:00
|
|
|
package function.builtin.predicate;
|
2016-12-22 10:32:48 -05:00
|
|
|
|
|
|
|
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)");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|