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

58 lines
1.2 KiB
Java

package function.builtin.predicate;
import static testutil.TestUtilities.evaluateString;
import static testutil.TypeAssertions.*;
import org.junit.Test;
import function.ArgumentValidator.*;
public class NUMERIC_EQUALTest {
@Test
public void numericEqualWithOneNumber() {
String input = "(= 1)";
assertT(evaluateString(input));
}
@Test
public void numericEqualWithEqualNumbers() {
String input = "(= 1 1)";
assertT(evaluateString(input));
}
@Test
public void numericEqualWithNonEqualNumbers() {
String input = "(= 1 2)";
assertNil(evaluateString(input));
}
@Test
public void numericEqualWithManyEqualNumbers() {
String input = "(= 4 4 4 4 4 4 4 4 4 4)";
assertT(evaluateString(input));
}
@Test
public void numericEqualWithManyNonEqualNumbers() {
String input = "(= 4 4 4 4 5 4 4 4 4 4)";
assertNil(evaluateString(input));
}
@Test(expected = BadArgumentTypeException.class)
public void numericEqualWithNonNumbers() {
evaluateString("(= 'x 'x)");
}
@Test(expected = TooFewArgumentsException.class)
public void numericEqualWithTooFewArguments() {
evaluateString("(=)");
}
}