def METHOD_NAME(n, m, p, with_E, with_R, with_S, trans, solver):
    skip_if_missing_solver(solver)
    if with_S and (solver.startswith('pymess') or solver == 'lrradi'):
        pytest.xfail('solver not implemented')
    if not with_E:
        A = conv_diff_1d_fd(n, 1, 1)
        E = None
    else:
        A, E = conv_diff_1d_fem(n, 1, 1)
    B = np.random.randn(n, m)
    C = np.random.randn(p, n)
    D = np.random.randn(p, m)
    if not trans:
        R0 = np.random.randn(p, p)
        R = D.dot(D.T) + R0.dot(R0.T) if with_R else None
        S = 1e-1 * D @ B.T if with_S else None
    else:
        R0 = np.random.randn(m, m)
        R = D.T.dot(D) + R0.dot(R0.T) if with_R else None
        S = 1e-1 * C.T @ D if with_S else None
    Aop = NumpyMatrixOperator(A)
    Eop = NumpyMatrixOperator(E) if with_E else None
    Bva = Aop.source.from_numpy(B.T)
    Cva = Aop.source.from_numpy(C)
    Sva = Aop.source.from_numpy((S if not trans else S.T)) if with_S else None
    Zva = solve_ricc_lrcf(Aop, Eop, Bva, Cva, R, Sva, trans=trans, options=solver)
    assert len(Zva) <= n
    Z = Zva.to_numpy().T
    assert relative_residual(A, E, B, C, R, S, Z, trans) < 1e-8