@Test
public void testErrors() {

    // test lexer errors
    {
        ExpressionException e = assertThrows(ExpressionException.class,
            () -> compile("#"));
        assertEquals(0, e.getPosition(), "Error position");
    }
    // test parser errors
    {
        ExpressionException e = assertThrows(ExpressionException.class,
            () -> compile("x"));
        assertEquals(0, e.getPosition(), "Error position");
    }
    {
        ExpressionException e = assertThrows(ExpressionException.class,
            () -> compile("x()"));
        assertEquals(0, e.getPosition(), "Error position");
    }
    {
        // verify that you must return a value
        ExpressionException e = assertThrows(ExpressionException.class,
            () -> compile("return"));
        assertEquals(6, e.getPosition(), "Error position");
    }
    assertThrows(ExpressionException.class,
        () -> compile("("));
    assertThrows(ExpressionException.class,
        () -> compile("x("));
    // test overloader errors
    {
        ExpressionException e = assertThrows(ExpressionException.class,
            () -> compile("atan2(1)"));
        assertEquals(0, e.getPosition(), "Error position");
    }
    {
        ExpressionException e = assertThrows(ExpressionException.class,
            () -> compile("atan2(1, 2, 3)"));
        assertEquals(0, e.getPosition(), "Error position");
    }
    {
        ExpressionException e = assertThrows(ExpressionException.class,
            () -> compile("rotate(1, 2, 3)"));
        assertEquals(7, e.getPosition(), "Error position");
    }
}