END_TEST


START_TEST ( test_KineticLaw_parent_create )
{
    Reaction * r = new Reaction(2, 4);
    KineticLaw* kl = r->createKineticLaw();

    fail_unless(r == kl->getParentSBMLObject());

    delete r;
}
END_TEST


START_TEST ( test_KineticLaw_parent_create_model )
{
    Model *m = new Model(2, 4);
    Reaction * r = m->createReaction();
    KineticLaw* kl = r->createKineticLaw();

    fail_unless(r == kl->getParentSBMLObject());
    fail_unless(r == r->getKineticLaw()->getParentSBMLObject());

    delete r;
}
END_TEST


START_TEST ( test_KineticLaw_Parameter_parent_create_model )
{
    Model *m = new Model(2, 4);
    Reaction *r = m->createReaction();
    KineticLaw* kl = m->createKineticLaw();
    Parameter * p = m->createKineticLawParameter();

    fail_unless(kl->getNumParameters() == 1);

    ListOfParameters *lop = kl->getListOfParameters();

    fail_unless(r == kl->getParentSBMLObject());
    fail_unless(kl == lop->getParentSBMLObject());
    fail_unless(lop == p->getParentSBMLObject());
    fail_unless(lop == kl->getParameter(0)->getParentSBMLObject());

    delete kl;
}
END_TEST


START_TEST ( test_KineticLaw_parent_NULL )
{
    Reaction * r = new Reaction(2, 4);
    KineticLaw *kl = r->createKineticLaw();
    Parameter *p = kl->createParameter();

    fail_unless(r == kl->getParentSBMLObject());
    fail_unless(r == p->getAncestorOfType(SBML_REACTION));
    fail_unless(kl == p->getAncestorOfType(SBML_KINETIC_LAW));

    KineticLaw *kl1 = kl->clone();

    fail_unless(kl1->getParentSBMLObject() == NULL);
    fail_unless(kl1->getParameter(0)->getAncestorOfType(SBML_REACTION) == NULL);
    fail_unless(kl1 == kl1->getParameter(0)->getAncestorOfType(SBML_KINETIC_LAW));

    delete r;
}