// (4)に相当するテスト void FractionTest::compare_fractions(void){ Fraction fr1(6, 4); Fraction fr2(3, 2); Fraction fr3(2, 1); CPPUNIT_ASSERT_MESSAGE("6/4 == 3/2 should be judged true", fr1 == fr2); CPPUNIT_ASSERT_MESSAGE("6/4 != 2/1 should be judged true", !(fr1 == fr3)); }
void FeedbackResponseTest::testShouldReturnCorrectAverageResponse() { FeedbackResponse fr1 ( 0, 5, 5, 0 ); QVERIFY ( fr1.averageRounded() == 1 ); FeedbackResponse fr2 ( 0, 5, 0, 0 ); QVERIFY ( fr2.averageRounded() == 0 ); FeedbackResponse fr3 ( 0, 0, 0, 5 ); QVERIFY ( fr3.averageRounded() == 3 ); FeedbackResponse fr4 ( 3, 2, 5, 11 ); QVERIFY ( fr4.averageRounded() == 2 ); }
PyObject *_PY_fr3(PyObject *self, PyObject *args, PyObject *kwds) {int ok; PyObject *_lo; int _la1; short _rv; char *kw_list[] = {"a1", NULL}; /* local variable initializations */ _la1 = 0; ok = PyArg_ParseTupleAndKeywords(args, kwds, "i:fr3_p", kw_list, &_la1); if (ok == FALSE) return(NULL); _rv = fr3(_la1); _lo = PY_build_object("fr3", G_SHORT_I, 0, &_rv, 0); return(_lo);}
// (5)に相当するテスト void FractionTest::divide_fractions(void){ Fraction fr1(6, 4); Fraction fr3(2, 1); Fraction fr4(3, 4); CPPUNIT_ASSERT(fr4 == fr1 / fr3); }