diff options
author | Baptiste Lepilleur <gaiacrtn@free.fr> | 2005-07-09 14:01:24 +0000 |
---|---|---|
committer | Baptiste Lepilleur <gaiacrtn@free.fr> | 2005-07-09 14:01:24 +0000 |
commit | cc896a6ecff4ef37ec7783b5cf5595990b5848c4 (patch) | |
tree | ed3ddb30b7f96b6b1370154e5e3b370b1d009f6a /doc | |
parent | 4f9eb6fa36b587a501e30f05baa0107a0a22fa6e (diff) | |
download | cppunit-cc896a6ecff4ef37ec7783b5cf5595990b5848c4.tar.gz |
doc/money.dox: fixed bad usage of CPPUNIT_ASSERT_EQUALS.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/Money.dox | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/doc/Money.dox b/doc/Money.dox index e083a9f..d35e8e8 100644 --- a/doc/Money.dox +++ b/doc/Money.dox @@ -385,7 +385,7 @@ MoneyTest::testEqual() CPPUNIT_ASSERT( money123FF == money123FF ); // == CPPUNIT_ASSERT( money12FF != money123FF ); // != amount CPPUNIT_ASSERT( money123USD != money123FF ); // != currency - CPPUNIT_ASSERT( money12USD != money123FF ); // != currency and != amount + CPPUNIT_ASSERT( money12USD != money123FF ); // != currency and != amount }\endcode Let's implements \c operator \c == and \c operator \c != in Money.h: @@ -439,8 +439,8 @@ MoneyTest::testAdd() money += money12FF; // Check - CPPUNIT_ASSERT_EQUAL( expectedMoney == money.getAmount() ); // += works - CPPUNIT_ASSERT( &money == &(money += money12FF) ); // += returns ref. on 'this'. + CPPUNIT_ASSERT( expectedMoney == money ); // add works + CPPUNIT_ASSERT( &money == &(money += money12FF) ); // add returns ref. on 'this'. }\endcode While writing that test case, you ask yourself, what is the result of @@ -537,6 +537,7 @@ public: Compile. Our test finaly passes! TODO: +- How to use CPPUNIT_ASSERT_EQUALS with Money - Copy constructor/Assignment operator - Introducing fixtures - ? |