
import cdb.relativity.abstract as rel

def test01():
    __cdbkernel__=create_scope()
    \partial{#}::PartialDerivative;
    ex = rel.riemann_from_christoffel($Q$, $\gamma$)
    exl = lhs(ex)
    exr = rhs(ex)
    tstl := Q^{\rho}_{\sigma\mu\nu} - @(exl);
    assert(tstl==0)
    print("Test 01a passed")
    tstr := \partial_{\mu}{\gamma^{\rho}_{\nu\sigma}} -\partial_{\nu}{\gamma^{\rho}_{\mu\sigma}} + \gamma^{\rho}_{\mu\lambda} \gamma^{\lambda}_{\nu\sigma} - \gamma^{\rho}_{\nu\lambda} \gamma^{\lambda}_{\mu\sigma} - @(exr);
    assert(tstr==0)
    print("Test 01b passed")

test01()

def test02():
    __cdbkernel__=create_scope()
    import cdb.core.manip as manip
    {I,J}::Indices(position=fixed);
    \delta{#}::Derivative;
    ex:= A = B C;
    lhs= manip.get_lhs(ex)
    rhs= manip.get_rhs(ex)        
    ex2:= \delta_{I}{ @(lhs) } = \delta_{I}{ @(rhs) };
    tst:= (\delta_{I}{A} = \delta_{I}{B C}) - @(ex2);
    assert tst == $0=0$
    print("Test 02 passed")

test02()


