Example #1
0
void test000087::test_import_reaction_flux_reference_1()
{
  try
    {
      CPPUNIT_ASSERT(pCOPASIDATAMODEL->importSBMLFromString(test000087::MODEL_STRING1));
    }
  catch (...)
    {
      // there should be an exception (MCSBML + 81)
      unsigned int i, iMax = CCopasiMessage::size();
      CCopasiMessage message;
      bool found81 = false;

      for (i = 0; i < iMax; ++i)
        {
          message = CCopasiMessage::getLastMessage();

          if (message.getNumber() == MCSBML + 81)
            {
              found81 = true;
              break;
            }
        }

      CPPUNIT_ASSERT(found81 == true);
      return;
    }

  // we should never get here
  CPPUNIT_ASSERT(false);
}
Example #2
0
void test000088::test_import_initialassignment_without_expression()
{
    bool result = pCOPASIDATAMODEL->importSBMLFromString(test000088::MODEL_STRING2);
    CPPUNIT_ASSERT(result == true);
    // check if we have the correct warning message on the stack
    // there should be a warning (MCSBML + 58)
    unsigned int i, iMax = CCopasiMessage::size();
    CCopasiMessage message;
    bool found58 = false;

    for (i = 0; i < iMax; ++i)
    {
        message = CCopasiMessage::getLastMessage();

        if (message.getNumber() == MCSBML + 58)
        {
            found58 = true;
            break;
        }
    }

    CPPUNIT_ASSERT(found58 == true);
    // check if the model contains one parameter and that this parameter does not
    // have an expression
    const CModel* pModel = pCOPASIDATAMODEL->getModel();
    CPPUNIT_ASSERT(pModel !=  NULL);
    CPPUNIT_ASSERT(pModel->getModelValues().size() == 1);
    const CModelValue* pMV = pModel->getModelValues()[0];
    CPPUNIT_ASSERT(pMV != NULL);
    CPPUNIT_ASSERT(pMV->getInitialExpression().empty());
    // since the parameter does not set an initial value, it's value should be 1.0
    CPPUNIT_ASSERT(fabs(pMV->getInitialValue() - 1.0) < 1e-6);
}