package function.builtin.predicate;

import static testutil.TestUtilities.evaluateString;
import static testutil.TypeAssertions.*;

import org.junit.Test;

import function.ArgumentValidator.*;

public class GREATERPTester {

    @Test
    public void testGreaterpWithOneNumber_ReturnsT() {
        String input = "(> 1)";

        assertT(evaluateString(input));
    }

    @Test
    public void testGreaterpWithTwoNumbers_ReturnsNil() {
        String input = "(> 1 2)";

        assertNil(evaluateString(input));
    }

    @Test
    public void testGreaterpWithTwoNumbers_ReturnsT() {
        String input = "(> 3 2)";

        assertT(evaluateString(input));
    }

    @Test
    public void testGreaterpWithManyNumbers_ReturnsNil() {
        String input = "(> 4 3 2 5 1)";

        assertNil(evaluateString(input));
    }

    @Test
    public void testGreaterpWithManyNumbers_ReturnsT() {
        String input = "(> 4 3 2 1 0)";

        assertT(evaluateString(input));
    }

    @Test(expected = BadArgumentTypeException.class)
    public void testGreaterpWithNonNumbers() {
        evaluateString("(> 'x 'x)");
    }

    @Test(expected = TooFewArgumentsException.class)
    public void testGreaterpWithTooFewArguments() {
        evaluateString("(>)");
    }

}
