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

41 lines
1.0 KiB
Java
Raw Normal View History

package function.builtin.predicate;
2017-02-06 13:44:35 -05:00
import static testutil.TestUtilities.evaluateString;
2017-11-12 09:42:25 -05:00
import static testutil.TypeAssertions.assertNil;
import static testutil.TypeAssertions.assertT;
import org.junit.Test;
2017-11-12 09:42:25 -05:00
import function.ArgumentValidator.TooFewArgumentsException;
import function.ArgumentValidator.TooManyArgumentsException;
import testutil.SymbolAndFunctionCleaner;
public class ATOMTest extends SymbolAndFunctionCleaner {
@Test
2017-01-27 11:37:11 -05:00
public void atomIsAtom() {
assertT(evaluateString("(atom 'a)"));
}
2017-03-07 13:15:40 -05:00
@Test
public void atomIsAtomWithAlias() {
assertT(evaluateString("(atom? 'a)"));
}
@Test
2017-01-27 11:37:11 -05:00
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)");
}
}