18 #include "test_node_conversion.hpp"
33 void test_node_conversion::setUp()
38 void test_node_conversion::tearDown()
43 void test_node_conversion::test_0001()
45 std::string expr(
"A+G+D+E");
51 CPPUNIT_ASSERT(pFraction != NULL);
54 CPPUNIT_ASSERT(pSum.getFractions().size() == 0);
55 CPPUNIT_ASSERT(pSum.getProducts().size() == 4);
58 CPPUNIT_ASSERT(pOperator != NULL);
62 if (dynamic_cast<CEvaluationNodeOperator*>(pOperator->
getChild()))
73 CPPUNIT_ASSERT(pOperator != NULL);
74 CPPUNIT_ASSERT(pVariable != NULL);
76 if (dynamic_cast<CEvaluationNodeOperator*>(pOperator->
getChild()))
87 CPPUNIT_ASSERT(pOperator != NULL);
88 CPPUNIT_ASSERT(pVariable != NULL);
90 CPPUNIT_ASSERT(pVariable != NULL);
92 CPPUNIT_ASSERT(pVariable != NULL);
97 void test_node_conversion::test_0002()
99 std::string expr(
"A*D+B*C");
105 CPPUNIT_ASSERT(pFraction != NULL);
108 CPPUNIT_ASSERT(pSum.getFractions().size() == 0);
109 CPPUNIT_ASSERT(pSum.getProducts().size() == 2);
112 CPPUNIT_ASSERT(pOperator != NULL);
115 CPPUNIT_ASSERT(pOperator != NULL);
118 CPPUNIT_ASSERT(pVariable != NULL);
120 CPPUNIT_ASSERT(pVariable != NULL);
122 CPPUNIT_ASSERT(pOperator != NULL);
125 CPPUNIT_ASSERT(pVariable != NULL);
127 CPPUNIT_ASSERT(pVariable != NULL);
132 void test_node_conversion::test_0003()
134 std::string expr(
"1.0*3.0+1.0*5.0");
140 CPPUNIT_ASSERT(pFraction != NULL);
142 std::string s = pFraction->
toString();
146 void test_node_conversion::test_0004()
148 std::string expr(
"5.0^1.0*7.0^1.0");
154 CPPUNIT_ASSERT(pFraction != NULL);
156 std::string s = pFraction->
toString();
160 void test_node_conversion::test_0005()
162 std::string expr(
"A*(1/B)");
168 CPPUNIT_ASSERT(pFraction != NULL);
170 std::string s = pFraction->
toString();
CNormalSum & getNumerator()
CCopasiNode< Data > * getSibling()
const Type & getType() const
CEvaluationNode * convertToCEvaluationNode(const CNormalFraction &fraction)
static Type subType(const Type &type)
bool checkDenominatorOne() const
virtual std::string toString() const
CNormalFraction * createNormalRepresentation(const CEvaluationNode *node)
static void init(int argc, char *argv[], const bool &withGui=false)
CCopasiNode< Data > * getChild()
CEvaluationNode * getRoot()
virtual bool setInfix(const std::string &infix)