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

61 lines
1.4 KiB
Java
Raw Normal View History

package function.builtin.predicate;
2017-01-27 11:37:11 -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.BadArgumentTypeException;
import function.ArgumentValidator.TooFewArgumentsException;
import testutil.SymbolAndFunctionCleaner;
public class NUMERIC_EQUALTest extends SymbolAndFunctionCleaner {
@Test
public void numericEqualWithOneNumber() {
String input = "(= 1)";
2017-01-27 11:37:11 -05:00
assertT(evaluateString(input));
}
@Test
public void numericEqualWithEqualNumbers() {
String input = "(= 1 1)";
2017-01-27 11:37:11 -05:00
assertT(evaluateString(input));
}
@Test
public void numericEqualWithNonEqualNumbers() {
String input = "(= 1 2)";
2017-01-27 11:37:11 -05:00
assertNil(evaluateString(input));
}
@Test
public void numericEqualWithManyEqualNumbers() {
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 numericEqualWithManyNonEqualNumbers() {
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 numericEqualWithNonNumbers() {
evaluateString("(= 'x 'x)");
}
@Test(expected = TooFewArgumentsException.class)
public void numericEqualWithTooFewArguments() {
evaluateString("(=)");
}
}