diff options
| author | Baptiste Lepilleur <gaiacrtn@free.fr> | 2005-10-13 20:25:39 +0000 |
|---|---|---|
| committer | Baptiste Lepilleur <gaiacrtn@free.fr> | 2005-10-13 20:25:39 +0000 |
| commit | 94f55eaeccfcc054780f542ef4744e978f16a4e9 (patch) | |
| tree | 679b3133d455308b11c02145ec4ff3ab4e53f0a3 | |
| parent | 6488278b8a805164ed5825e74d71c674e3621cfe (diff) | |
| download | cppunit-94f55eaeccfcc054780f542ef4744e978f16a4e9.tar.gz | |
Removed most warning when compiling with vc++ 6sp6.
removed most warning when compiling with vc++ 6sp6.
* added assert equal usage
| -rw-r--r-- | ChangeLog | 3 | ||||
| -rw-r--r-- | examples/money/Money.h | 12 | ||||
| -rw-r--r-- | examples/money/MoneyTest.cpp | 3 |
3 files changed, 17 insertions, 1 deletions
@@ -2,6 +2,9 @@ * include/cppunit/config/SourcePrefix.h: added, prefix added at begining of sources to remove warning. Removed most warning when compiling with VC++ 6sp6. + * examples/money/Money.h: + * examples/money/MoneyTest.cpp: added assert equal usage. + 2005-07-30 Baptiste Lepilleur <gaiacrtn@free.fr> * include/cppunit/config/config-msvc6.h: auto-detect if RTTI are enabled diff --git a/examples/money/Money.h b/examples/money/Money.h index 309e3a1..720f05a 100644 --- a/examples/money/Money.h +++ b/examples/money/Money.h @@ -4,6 +4,7 @@ #include <string> #include <stdexcept> +#include <cppunit/portability/Stream.h> // or <iostream> if portability is not an issue class IncompatibleMoneyError : public std::runtime_error { @@ -58,4 +59,15 @@ private: std::string m_currency; }; + +// The function below could be prototyped as: +// inline std::ostream &operator <<( std::ostream &os, const Money &value ) +// If you know that you will never compile on a platform without std::ostream +// (such as embedded vc++ 4.0; though even that platform you can use STLPort) +inline CPPUNIT_NS::OStream &operator <<( CPPUNIT_NS::OStream &os, const Money &value ) +{ + return os << "Money< value =" << value.getAmount() << "; currency = " << value.getCurrency() << ">"; +} + + #endif diff --git a/examples/money/MoneyTest.cpp b/examples/money/MoneyTest.cpp index bdebbc5..70e5986 100644 --- a/examples/money/MoneyTest.cpp +++ b/examples/money/MoneyTest.cpp @@ -1,6 +1,7 @@ // MoneyTest.cpp #include "StdAfx.h" +#include <cppunit/config/SourcePrefix.h> #include "Money.h" #include "MoneyTest.h" @@ -65,7 +66,7 @@ MoneyTest::testAdd() money += money12FF; // Check - CPPUNIT_ASSERT( expectedMoney == money ); // add works + CPPUNIT_ASSERT_EQUAL( expectedMoney, money ); // add works CPPUNIT_ASSERT( &money == &(money += money12FF) ); // add returns ref. on 'this'. } |
