Re: [Cppunit-devel] CppUnitW 1.2 merge
Brought to you by:
blep
From: Baptiste L. <bl...@cl...> - 2001-05-03 19:33:57
|
> I've merged most of CppUnitW 1.2, with some exceptions: Thanks, this is excellent !!! > > * TestFactoryRegistry used auto_ptr. I had to change that to ordinary > pointers: auto_ptr's cannot be used inside STL containers (see for > example: http://gcc.gnu.org/onlinedocs/libstdc++/20_util/howto.html ). > With MSVC++ it may work (by accident), but with g++ is doesn't even > compile. For now, I've only changed pointer types and not done anything > about the memory management: very likely it will leak now. Please have a > look at it. Thanks for pointing that out. I aware of this limitation (and even with VC++ your going into trouble if you're using sort(). It's also one of the reason auto_ptr had such an hard time getting into stl). I did this as a quick hack to test the thing and completly forgot to clean it up. I'll send a patch tomorrow I hope to fix the leaks. Though there is still some problem when doing: TestFactoryRegistry::getRegistry().registerFactory( "Functionnal tests", TestFactoryRegistry::getRegistry( "Functionnal" ) ); Since the registry owns the factories, it will be destroyed twice (owned by getRegistry( aName ) and registerFactory() ). I'm still turning this around to see how I can fix that. > > * I've put the typeinfo stuff in TestSuite and TestFactoryRegistry > inside "#ifdef USE_TYPEINFO ". RTTI is still rather new and may not be I would rather use CU_USE_TYPEINFO or something like that (CU_NO_TYPEINFO would be easier for us since we wouldn't need to declare it in each project). Prefixes are a great help when you have tens of precompiler define and you need to figure out which library they are related to (and with VC++ you a 40 chars edit field to see them all :-( ). > supported properly on all platforms. Since it's only used to create > TestSuites with names direved from a class name, I did not not feel > dependence of the core library on RTTI was justified. Also deriving the I agree with that. since it has been available with VC++ for years (it was there in VC++ 5.0), I though it was a rather comon feature by now. Well I guessed wrong... ;-( > class name through type_info is an unreliable method. Once again the C++ > comittee managed to kill a useful feature: not only may the string > returned by type_info.name() differ from compiler to compiler (e.g. g++ > returns some really ugly mangled name), but differ with different runs > of the program as well. Of course this renders the whole method useful. Yukk! Do raw_name() and name() return the same thing (raw_name is not supposed to be human readable, but name() is supposed to be....) ? > If someone can explain why the comittee has done this, please do! Damn. I though this one bit was at least well specified. I guess the use will mainly be for VC++ user. I'll add another constructor to TestSuiteBuilder so the suite name can be specified by hand. > > * Changed TestSuite.getTests() to return a const ref. Well, I find the original one easier to use, but I won't arg about that. > > * Moved TestFactoryRegistry.cpp from src/cppunit/extensions to > src/cppunit. It is part of the main library anyway and is much easier to > configure automake for it. I'll need to fix the VC++ project. Will be in the patch to. > > Please give it a try and let me know where I messed up. So did I... TestAssert.cpp is missing. There is also a few minor things (include path in TestRegistry.cpp, typo in TestRunnerModel.cpp). I'll put those in the patch. Other than that it works just fine. Hopefully, I make the patch tomorrow and we'll soon have a working version ! Thanks a lot Baastian. Baptiste. --- Baptiste Lepilleur <gai...@fr...> http://gaiacrtn.free.fr/index.html Author of The Text Reformatter, a tool for fanfiction readers and writers. Language: English, French (Well, I'm French). |