[Cppunit-devel] RE: Mock C++
Brought to you by:
blep
From: King D. <Ki...@tc...> - 2002-08-13 19:49:33
|
> Have you guys thought about doing Mock objects for C++ ? It comes naturally > after Junit. > We probably can not reach the versatility of Java here, but we can sure do > something. I've thought about it a lot and done some work in that direction and also got input from someone else that started on it (and didn't get any farther than me). Unfortunately, there are so many things about Javaa that make it so much easier than with C++. Chief among those is reflection. With mock objects in Java just by having a member of the instance be a subclass of Verifiable it will get verified. There is no easy way to do that in C++. You end up having to do things like with CppUnit where you use complex macros to add things to be verified. I also looked at using something like OpenC++ which is sort of a preprocessor for C++ which can give you compile time reflection. I'd be happy to share what I started and what other examples I was given, but you could probably get that far yourself pretty easily. -- Dale King |