transcendental-lisp/test/function/builtin/predicate/ATOMTest.java

41 lines
1.0 KiB
Java

package function.builtin.predicate;
import static testutil.TestUtilities.evaluateString;
import static testutil.TypeAssertions.assertNil;
import static testutil.TypeAssertions.assertT;
import org.junit.Test;
import function.ArgumentValidator.TooFewArgumentsException;
import function.ArgumentValidator.TooManyArgumentsException;
import testutil.SymbolAndFunctionCleaner;
public class ATOMTest extends SymbolAndFunctionCleaner {
@Test
public void atomIsAtom() {
assertT(evaluateString("(atom 'a)"));
}
@Test
public void atomIsAtomWithAlias() {
assertT(evaluateString("(atom? 'a)"));
}
@Test
public void listIsNotAtom() {
assertNil(evaluateString("(atom '(1 2 3))"));
}
@Test(expected = TooManyArgumentsException.class)
public void testApplyWithTooManyArguments() {
evaluateString("(atom '1 '2)");
}
@Test(expected = TooFewArgumentsException.class)
public void testApplyWithTooFewArguments() {
evaluateString("(atom)");
}
}