65 CPPUNIT_ASSERT(pDataModel->
getModel() != NULL);
67 CPPUNIT_ASSERT(pDocument == NULL);
68 std::string sbmlString;
77 CPPUNIT_ASSERT(
false);
80 CPPUNIT_ASSERT(!sbmlString.empty());
83 CPPUNIT_ASSERT(pDocument != NULL);
84 const Model* pModel = pDocument->getModel();
85 CPPUNIT_ASSERT(pModel != NULL);
86 CPPUNIT_ASSERT(pModel->getListOfParameters()->size() == 2);
87 const Parameter *pP1 = NULL, *pP2 = NULL;
88 pP1 = pModel->getParameter(0);
89 CPPUNIT_ASSERT(pP1 != NULL);
91 if (pP1->getName() != std::string(
"K"))
94 pP1 = pModel->getParameter(1);
98 pP2 = pModel->getParameter(1);
101 CPPUNIT_ASSERT(pP2->getName() == std::string(
"reaction_k1"));
102 CPPUNIT_ASSERT(pP2->getConstant() ==
true);
103 CPPUNIT_ASSERT(fabs((pP2->getValue() - 0.1) / 0.1) < 1e-6);
104 CPPUNIT_ASSERT(pP1->getName() == std::string(
"K"));
105 CPPUNIT_ASSERT(pP1->getConstant() ==
false);
106 CPPUNIT_ASSERT(fabs((pP1->getValue() - 0.1) / 0.1) < 1e-6);
108 CPPUNIT_ASSERT(pModel->getListOfRules()->size() == 1);
109 const Rule* pRule = pModel->getRule(0);
110 CPPUNIT_ASSERT(pRule != NULL);
111 const AssignmentRule* pAssignmentRule =
dynamic_cast<const AssignmentRule*
>(pRule);
112 CPPUNIT_ASSERT(pAssignmentRule != NULL);
113 CPPUNIT_ASSERT(pAssignmentRule->getVariable() == pP1->getId());
114 const ASTNode* pMath = pAssignmentRule->getMath();
115 CPPUNIT_ASSERT(pMath != NULL);
116 CPPUNIT_ASSERT(pMath->getType() == AST_NAME);
117 CPPUNIT_ASSERT(pMath->getName() == std::string(pP2->getId()));
119 CPPUNIT_ASSERT(pModel->getListOfReactions()->size() == 1);
120 const Reaction* pReaction = pModel->getReaction(0);
121 CPPUNIT_ASSERT(pReaction != NULL);
122 CPPUNIT_ASSERT(pReaction->getListOfReactants()->size() == 1);
123 CPPUNIT_ASSERT(pReaction->getListOfProducts()->size() == 1);
124 CPPUNIT_ASSERT(pReaction->getListOfModifiers()->size() == 0);
125 const KineticLaw* pKLaw = pReaction->getKineticLaw();
126 CPPUNIT_ASSERT(pKLaw != NULL);
127 CPPUNIT_ASSERT(pKLaw->getListOfParameters()->size() == 0);
128 const SpeciesReference* pSpeciesReference = pReaction->getReactant(0);
129 CPPUNIT_ASSERT(pSpeciesReference != NULL);
130 CPPUNIT_ASSERT(pModel->getListOfCompartments()->size() == 1);
131 const Compartment* pCompartment = pModel->getCompartment(0);
132 CPPUNIT_ASSERT(pCompartment != NULL);
133 pMath = pKLaw->getMath();
134 CPPUNIT_ASSERT(pMath != NULL);
137 CPPUNIT_ASSERT(pMath->getType() == AST_TIMES);
138 std::vector<std::string> ids;
139 CPPUNIT_ASSERT(pMath->getNumChildren() == 2 || pMath->getNumChildren() == 3);
141 if (pMath->getNumChildren() == 3)
143 CPPUNIT_ASSERT(pMath->getChild(0)->getType() == AST_NAME);
144 CPPUNIT_ASSERT(pMath->getChild(1)->getType() == AST_NAME);
145 CPPUNIT_ASSERT(pMath->getChild(2)->getType() == AST_NAME);
146 ids.push_back(pMath->getChild(0)->getName());
147 ids.push_back(pMath->getChild(1)->getName());
148 ids.push_back(pMath->getChild(2)->getName());
152 if (pMath->getChild(0)->getType() == AST_NAME)
154 ids.push_back(pMath->getChild(0)->getName());
155 pMath = pMath->getChild(1);
159 CPPUNIT_ASSERT(pMath->getChild(1)->getType() == AST_NAME);
160 ids.push_back(pMath->getChild(1)->getName());
161 pMath = pMath->getChild(0);
164 CPPUNIT_ASSERT(pMath->getType() == AST_TIMES);
165 CPPUNIT_ASSERT(pMath->getNumChildren() == 2);
166 CPPUNIT_ASSERT(pMath->getChild(0)->getType() == AST_NAME);
167 CPPUNIT_ASSERT(pMath->getChild(1)->getType() == AST_NAME);
168 ids.push_back(pMath->getChild(0)->getName());
169 ids.push_back(pMath->getChild(1)->getName());
172 CPPUNIT_ASSERT(ids.size() == 3);
173 CPPUNIT_ASSERT(std::find(ids.begin(), ids.end(), std::string(pCompartment->getId())) != ids.end());
174 CPPUNIT_ASSERT(std::find(ids.begin(), ids.end(), std::string(pP2->getId())) != ids.end());
175 CPPUNIT_ASSERT(std::find(ids.begin(), ids.end(), std::string(pSpeciesReference->getSpecies())) != ids.end());
SBMLDocument * getCurrentSBMLDocument()
std::string exportSBMLToString(CProcessReport *pExportHandler, int sbmlLevel, int sbmlVersion)
bool load_cps_model_from_stream(std::istream &is, CCopasiDataModel &dataModel)
static const char * MODEL_STRING1
static CCopasiDataModel * pCOPASIDATAMODEL