57 lines
1.3 KiB
Java
57 lines
1.3 KiB
Java
package function.builtin.predicate;
|
|
|
|
import static testutil.TestUtilities.*;
|
|
|
|
import org.junit.Test;
|
|
|
|
import function.ArgumentValidator.*;
|
|
|
|
public class EQUALSPTester {
|
|
|
|
@Test
|
|
public void testEqualspWithOneNumber() {
|
|
String input = "(= 1)";
|
|
|
|
assertSExpressionsMatch(parseString("t"), evaluateString(input));
|
|
}
|
|
|
|
@Test
|
|
public void testEqualspWithEqualNumbers() {
|
|
String input = "(= 1 1)";
|
|
|
|
assertSExpressionsMatch(parseString("t"), evaluateString(input));
|
|
}
|
|
|
|
@Test
|
|
public void testEqualspWithNonEqualNumbers() {
|
|
String input = "(= 1 2)";
|
|
|
|
assertSExpressionsMatch(parseString("nil"), evaluateString(input));
|
|
}
|
|
|
|
@Test
|
|
public void testEqualspWithManyEqualNumbers() {
|
|
String input = "(= 4 4 4 4 4 4 4 4 4 4)";
|
|
|
|
assertSExpressionsMatch(parseString("t"), evaluateString(input));
|
|
}
|
|
|
|
@Test
|
|
public void testEqualspWithManyNonEqualNumbers() {
|
|
String input = "(= 4 4 4 4 5 4 4 4 4 4)";
|
|
|
|
assertSExpressionsMatch(parseString("nil"), evaluateString(input));
|
|
}
|
|
|
|
@Test(expected = BadArgumentTypeException.class)
|
|
public void testEqualspWithNonNumbers() {
|
|
evaluateString("(= 'x 'x)");
|
|
}
|
|
|
|
@Test(expected = TooFewArgumentsException.class)
|
|
public void testEqualspWithTooFewArguments() {
|
|
evaluateString("(=)");
|
|
}
|
|
|
|
}
|