2017-01-14 18:01:14 -05:00
|
|
|
package function.builtin.predicate;
|
2016-12-29 13:32:45 -05:00
|
|
|
|
2017-01-27 11:37:11 -05:00
|
|
|
import static testutil.TestUtilities.evaluateString;
|
|
|
|
import static testutil.TypeAssertions.*;
|
2016-12-29 13:32:45 -05:00
|
|
|
|
|
|
|
import org.junit.Test;
|
|
|
|
|
|
|
|
import function.ArgumentValidator.*;
|
2017-07-19 15:23:15 -04:00
|
|
|
import testutil.SymbolAndFunctionCleaner;
|
2016-12-29 13:32:45 -05:00
|
|
|
|
2017-07-19 15:23:15 -04:00
|
|
|
public class NUMERIC_EQUALTest extends SymbolAndFunctionCleaner {
|
2016-12-29 13:32:45 -05:00
|
|
|
|
|
|
|
@Test
|
2017-02-28 11:54:19 -05:00
|
|
|
public void numericEqualWithOneNumber() {
|
2016-12-29 13:32:45 -05:00
|
|
|
String input = "(= 1)";
|
|
|
|
|
2017-01-27 11:37:11 -05:00
|
|
|
assertT(evaluateString(input));
|
2016-12-29 13:32:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
2017-02-28 11:54:19 -05:00
|
|
|
public void numericEqualWithEqualNumbers() {
|
2016-12-29 13:32:45 -05:00
|
|
|
String input = "(= 1 1)";
|
|
|
|
|
2017-01-27 11:37:11 -05:00
|
|
|
assertT(evaluateString(input));
|
2016-12-29 13:32:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
2017-02-28 11:54:19 -05:00
|
|
|
public void numericEqualWithNonEqualNumbers() {
|
2016-12-29 13:32:45 -05:00
|
|
|
String input = "(= 1 2)";
|
|
|
|
|
2017-01-27 11:37:11 -05:00
|
|
|
assertNil(evaluateString(input));
|
2016-12-29 13:32:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
2017-02-28 11:54:19 -05:00
|
|
|
public void numericEqualWithManyEqualNumbers() {
|
2016-12-29 13:32:45 -05:00
|
|
|
String input = "(= 4 4 4 4 4 4 4 4 4 4)";
|
|
|
|
|
2017-01-27 11:37:11 -05:00
|
|
|
assertT(evaluateString(input));
|
2016-12-29 13:32:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
2017-02-28 11:54:19 -05:00
|
|
|
public void numericEqualWithManyNonEqualNumbers() {
|
2016-12-29 13:32:45 -05:00
|
|
|
String input = "(= 4 4 4 4 5 4 4 4 4 4)";
|
|
|
|
|
2017-01-27 11:37:11 -05:00
|
|
|
assertNil(evaluateString(input));
|
2016-12-29 13:32:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test(expected = BadArgumentTypeException.class)
|
2017-02-28 11:54:19 -05:00
|
|
|
public void numericEqualWithNonNumbers() {
|
2016-12-29 13:32:45 -05:00
|
|
|
evaluateString("(= 'x 'x)");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test(expected = TooFewArgumentsException.class)
|
2017-02-28 11:54:19 -05:00
|
|
|
public void numericEqualWithTooFewArguments() {
|
2016-12-29 13:32:45 -05:00
|
|
|
evaluateString("(=)");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|