Re: [Cppunit-devel] Test result output (was: news features...)
Brought to you by:
blep
From: Baptiste L. <gai...@fr...> - 2001-10-05 17:02:40
|
Quoting Duane Murphy <dua...@ma...>: > --- At Fri, 5 Oct 2001 17:26:56 +0200, Baptiste Lepilleur wrote: > > >> > >> There is a problem with missing itoa() (not only) on Linux, gcc > >> version > >> 2.95.2. I have attached a fix. > > > > Thanks, I'll include that this evening. The baka I am completly > forgot to > >check if itoa was ANSI (aren't an ANSI equivalent anyway ?) (the question was 'aren't there'...) > > itoa() is most certainly not ANSI and there is no ANSI equivalent. Yup, was specific VC++ (at least that what the doc said when looked afterward). > > >- return ::itoa( value, buffer, 10 ); > >+ ::sprintf( buffer, "%d", value ); > > While this replacement is ANSI, its not really in keeping with the > rest > of the code style. The rest of the code is largely C++ standard > library. > Therefore the replacement should be something like the toString() > function in assertionTraits<>. Yes. I asked for an equivalent because OStringStream is the "heavy" canon. > Maybe that function should be brought out entirely and converted to a > toString template function instead: > > template <T> > std::string toString( const T& x ) > { > OStringStream ost; > ost << x; > return ost.str(); > } That would solve the local code duplication. Though I'm not sure if it is the right solution. I'm still playing the idea, but I'm considering introducing a CppUnit::String class. It would have helper for those comon conversion and supports both Unicode and ANSI in its interface (but would store everything as Unicode). This would make CppUnit full Unicode (at least for failure message). But the idea is still unclear about the interface of that string class... Baptiste. --- Baptiste Lepilleur <gai...@fr...> http://gaiacrtn.free.fr/index.html Language: English, French |