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

58 lines
1.2 KiB
Java
Raw Normal View History

package function.builtin.predicate;
2017-01-27 11:37:11 -05:00
import static testutil.TestUtilities.evaluateString;
import static testutil.TypeAssertions.*;
import org.junit.Test;
import function.ArgumentValidator.*;
public class EQUALSPTester {
@Test
public void testEqualspWithOneNumber() {
String input = "(= 1)";
2017-01-27 11:37:11 -05:00
assertT(evaluateString(input));
}
@Test
public void testEqualspWithEqualNumbers() {
String input = "(= 1 1)";
2017-01-27 11:37:11 -05:00
assertT(evaluateString(input));
}
@Test
public void testEqualspWithNonEqualNumbers() {
String input = "(= 1 2)";
2017-01-27 11:37:11 -05:00
assertNil(evaluateString(input));
}
@Test
public void testEqualspWithManyEqualNumbers() {
String input = "(= 4 4 4 4 4 4 4 4 4 4)";
2017-01-27 11:37:11 -05:00
assertT(evaluateString(input));
}
@Test
public void testEqualspWithManyNonEqualNumbers() {
String input = "(= 4 4 4 4 5 4 4 4 4 4)";
2017-01-27 11:37:11 -05:00
assertNil(evaluateString(input));
}
@Test(expected = BadArgumentTypeException.class)
public void testEqualspWithNonNumbers() {
evaluateString("(= 'x 'x)");
}
@Test(expected = TooFewArgumentsException.class)
public void testEqualspWithTooFewArguments() {
evaluateString("(=)");
}
}