Update of /cvsroot/cppunit/cppunit/examples/money
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32735/examples/money
Modified Files:
Money.h MoneyTest.cpp
Log Message:
* removed most warning when compiling with vc++ 6sp6.
* added assert equal usage
Index: Money.h
===================================================================
RCS file: /cvsroot/cppunit/cppunit/examples/money/Money.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Money.h 7 May 2003 21:13:38 -0000 1.3
--- Money.h 13 Oct 2005 21:25:39 -0000 1.4
***************
*** 5,8 ****
--- 5,9 ----
#include <string>
#include <stdexcept>
+ #include <cppunit/portability/Stream.h> // or <iostream> if portability is not an issue
class IncompatibleMoneyError : public std::runtime_error
***************
*** 59,61 ****
--- 60,73 ----
};
+
+ // 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
Index: MoneyTest.cpp
===================================================================
RCS file: /cvsroot/cppunit/cppunit/examples/money/MoneyTest.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** MoneyTest.cpp 21 Apr 2002 12:50:44 -0000 1.2
--- MoneyTest.cpp 13 Oct 2005 21:25:39 -0000 1.3
***************
*** 2,5 ****
--- 2,6 ----
#include "StdAfx.h"
+ #include <cppunit/config/SourcePrefix.h>
#include "Money.h"
#include "MoneyTest.h"
***************
*** 66,70 ****
// Check
! CPPUNIT_ASSERT( expectedMoney == money ); // add works
CPPUNIT_ASSERT( &money == &(money += money12FF) ); // add returns ref. on 'this'.
}
--- 67,71 ----
// Check
! CPPUNIT_ASSERT_EQUAL( expectedMoney, money ); // add works
CPPUNIT_ASSERT( &money == &(money += money12FF) ); // add returns ref. on 'this'.
}
|