cppunit-devel Mailing List for CppUnit - C++ port of JUnit (Page 44)
Brought to you by:
blep
You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
(21) |
May
(96) |
Jun
(109) |
Jul
(42) |
Aug
(6) |
Sep
(106) |
Oct
(60) |
Nov
(20) |
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(7) |
Feb
(11) |
Mar
(49) |
Apr
(124) |
May
(30) |
Jun
(37) |
Jul
(53) |
Aug
(33) |
Sep
(21) |
Oct
(22) |
Nov
(19) |
Dec
(15) |
2003 |
Jan
(34) |
Feb
(25) |
Mar
(11) |
Apr
(12) |
May
(16) |
Jun
(24) |
Jul
(23) |
Aug
(23) |
Sep
(42) |
Oct
(7) |
Nov
(32) |
Dec
(33) |
2004 |
Jan
(41) |
Feb
(41) |
Mar
(24) |
Apr
(25) |
May
(18) |
Jun
(13) |
Jul
(11) |
Aug
(15) |
Sep
(22) |
Oct
(10) |
Nov
(15) |
Dec
(9) |
2005 |
Jan
(4) |
Feb
(15) |
Mar
(11) |
Apr
(16) |
May
(29) |
Jun
(17) |
Jul
(27) |
Aug
(12) |
Sep
(9) |
Oct
(10) |
Nov
(5) |
Dec
(6) |
2006 |
Jan
(2) |
Feb
(6) |
Mar
(7) |
Apr
(2) |
May
(1) |
Jun
(5) |
Jul
(8) |
Aug
(6) |
Sep
(10) |
Oct
(11) |
Nov
(15) |
Dec
(2) |
2007 |
Jan
(12) |
Feb
(22) |
Mar
(10) |
Apr
(7) |
May
(1) |
Jun
(8) |
Jul
(4) |
Aug
(1) |
Sep
(2) |
Oct
(1) |
Nov
|
Dec
|
2008 |
Jan
|
Feb
(7) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(7) |
Dec
|
2010 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Urai, Y. <yu...@co...> - 2002-02-26 11:02:48
|
Sorry that I couldn't help you. The symptom you described was exactly the same one I had when I accidentally forgot to enable RTTI. I have no further idea. Let's wait and see the other response. Yuichi > -----Original Message----- > From: 石 旭 [mailto:sek...@ka...] > Sent: Tuesday, February 26, 2002 7:57 PM > To: Urai, Yuichi > Subject: Re: [Cppunit-devel] pls help me. > > > thank you for reply. but i enabled RTTI in project, and set the other > configuration as the you said. > > linda > ------------ > 石 旭 <sek...@ka...> > > Best regards (*^o^*)_p > |
From: Urai, Y. <yu...@co...> - 2002-02-26 10:41:21
|
I think it's just because you forgot to enable RTTI. Pls check Project Settings/C++/C++ Language. Make sure RTTI is enabled for both debug and release build. Good luck ! Yuichi Urai Cognex K.K. > -----Original Message----- > From: 石 旭 [mailto:sek...@ka...] > Sent: Tuesday, February 26, 2002 7:33 PM > To: cpp...@li... > Subject: [Cppunit-devel] pls help me. > > > how are you! > i am trying to using TestRunner in my MFC exe prgram based on Dialog. > it can be complied and linked succeeded, but while i press "Browse"on > the TestRunner Dialog, the "Debug Assertion Failed" error message box > appeared , if i choose "ignore", the message of "the > unsupported funtion > is be executed." > so i can not execute TestRunner in my program ! > but i test TestRunner in other program which is simple, the TestRunner > was executed successfully . > does anyone know the reason? > > linda > ------------ > <sek...@ka...> > > Best regards (*^o^*)_p > > > _______________________________________________ > Cppunit-devel mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppunit-devel > |
From: <sek...@ka...> - 2002-02-26 10:33:41
|
how are you! i am trying to using TestRunner in my MFC exe prgram based on Dialog. it can be complied and linked succeeded, but while i press "Browse"on the TestRunner Dialog, the "Debug Assertion Failed" error message box appeared , if i choose "ignore", the message of "the unsupported funtion is be executed." so i can not execute TestRunner in my program ! but i test TestRunner in other program which is simple, the TestRunner was executed successfully . does anyone know the reason? linda ------------ <sek...@ka...> Best regards (*^o^*)_p |
From: <Pet...@in...> - 2002-02-21 17:58:20
|
hello, has any one tried to use Cppunit with epoc any version ? |
From: Alexandre C. <ac...@in...> - 2002-02-21 17:00:02
|
Hi,=20 I'am using the TestPluginRunner, and it works fine (just a little PB wit = reload, but nevermind). There is only one thing that I'am doing because the tool does not = provides it:=20 this is an help button on the TestHierarchy Panel related to the = selected test in the tree! Am I the only one ? Best regards Alex. |
From: Sean Cook<se...@no...> - 2002-02-13 02:01:44
|
Hello: When I compile cppunit I get an error. MY SYSTEM INFORMATION: hostname = santana uname -m = sun4u uname -r = 5.6 uname -s = SunOS uname -v = Generic_105181-26 /bin/arch = sun4 /usr/bin/arch -k = sun4u /usr/convex/getsysinfo = unknown hostinfo = unknown /bin/machine = unknown /usr/bin/oslevel = unknown /bin/universe = unknown PATH = /home/scook/bin:/usr/local/bin:/usr/ccs/bin:/opt/SUNWspro/bin:/usr/bin:/usr/ ucb:/etc:/usr/atria/bin:/usr/atria/etc. (santana)[scook]> CC -V CC: WorkShop Compilers 4.2 16 Jun 1998 C++ 4.2 patch 104631-07 THE PROBLEM: (santana)[scook]> make Making all in src make[1]: Entering directory `/home/scook/cppunit-1.6.2/src' Making all in cppunit make[2]: Entering directory `/home/scook/cppunit-1.6.2/src/cppunit' source='NotEqualException.cpp' object='NotEqualException.lo' libtool=yes \ depfile='.deps/NotEqualException.Plo' tmpdepfile='.deps/NotEqualException.TPlo' \ depmode=none /bin/sh ../../config/depcomp \ /bin/sh ../../libtool --mode=compile CC -DHAVE_CONFIG_H -I. -I. -I../../config -I../../include -I../../include -g -c -o NotEqualException.lo `test -f NotEqualException.cpp || echo './'`NotEqualException.cpp CC -DHAVE_CONFIG_H -I. -I. -I../../config -I../../include -I../../include -g -c NotEqualException.cpp -KPIC -DPIC -o .libs/NotEqualException.o "../../include/cppunit/Exception.h", line 4: Error: Could not open include file <exception>. "../../include/cppunit/Exception.h", line 5: Error: Could not open include file <string>. "../../include/cppunit/Exception.h", line 7: Error: Type name expected instead of "namespace". "../../include/cppunit/Exception.h", line 28: Error: std is not defined. "../../include/cppunit/Exception.h", line 28: Error: string must be initialized. "../../include/cppunit/Exception.h", line 28: Error: "," expected instead of "m_type". "../../include/cppunit/Exception.h", line 29: Error: Unexpected "}". "../../include/cppunit/Exception.h", line 32: Error: Type name expected instead of "Exception". "../../include/cppunit/Exception.h", line 33: Error: UNKNOWNLINENUMBER is not defined. "../../include/cppunit/Exception.h", line 34: Error: std is not defined. "../../include/cppunit/Exception.h", line 34: Error: Multiple declaration for string. "../../include/cppunit/Exception.h", line 34: Error: "," expected instead of "fileName". "../../include/cppunit/Exception.h", line 35: Error: ")" expected instead of "&". "../../include/cppunit/Exception.h", line 37: Error: "virtual" is not allowed here. "../../include/cppunit/Exception.h", line 37: Error: Type name expected instead of "Exception". "../../include/cppunit/Exception.h", line 37: Error: Illegal number of arguments for <destructor>(). "../../include/cppunit/Exception.h", line 39: Error: Type name expected instead of "Exception". "../../include/cppunit/Exception.h", line 41: Error: The function "what() const" cannot be declared const. "../../include/cppunit/Exception.h", line 43: Error: Multiple declaration for lineNumber. "../../include/cppunit/Exception.h", line 44: Error: std is not defined. "../../include/cppunit/Exception.h", line 46: Error: std is not defined. "../../include/cppunit/Exception.h", line 46: Error: UNKNOWNFILENAME must be initialized. "../../include/cppunit/Exception.h", line 47: Error: UNKNOWNLINENUMBER must be initialized. "../../include/cppunit/Exception.h", line 49: Error: "virtual" is not allowed here. "../../include/cppunit/Exception.h", line 49: Error: Type name expected instead of "Exception". Compilation aborted, too many messages. make[2]: *** [NotEqualException.lo] Error 1 make[2]: Leaving directory `/home/scook/cppunit-1.6.2/src/cppunit' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/scook/cppunit-1.6.2/src' make: *** [all-recursive] Error 1 Any suggestions? Cheers, Sean |
From: Max I. <ma...@ma...> - 2002-02-04 13:07:54
|
Hi. The cppunit textrunner outputs only number of tests run. Is it possible to run it more verbosely, at least display number of asserts failed/passed? -- BOFH excuse #62: need to wrap system in aluminum foil to fix problem |
From: Maxwell, J. (M. GEMS-IT) <Joh...@me...> - 2002-02-01 05:04:42
|
Gentlefolk: Dunno if this is a frequently answered question, but I've tracked it down, so I thought I'd post, just in case it isn't old news: Short form: The test fails because assignment of CppUnit::Exception objects is broken. Long form: In CppUnit::Exception::operator=, there's a call to SuperClass::operator=(). Under VC++, that doesn't do anything useful, and it *does* change the type of the object to the SuperClass. That is, after the SuperClass::operator= call this's vtable pointer now points to the vtable for exception, instead of the vtable for CppUnit::Exception. So the assignment operator is broken, and the test correctly detects it and complains. The more interesting question, and I'm not language lawyer enough to answer it definitively, is whether VC++'s exception class's behavior is broken or not. I'd tend to say yes, just based on general anti-MS prejudice, but on the other hand, IIRC, that library was produced by PJ Plauger's Dinkum Software... and I have a fair degree of respect for that man I haven't devoted much effort to researching the correct answer, but a #ifdef _MSC_VER / #endif pair wrapped around that call to SuperClass::operator=() provides symptomic relief of pain. cc me on replies if you want me to see them; I don't subscribe to this list. Use either Joh...@me... (work) or jm...@to... (home). -John. ________________________________________ > The information contained in this transmission is confidential and > proprietary to General Electric Medical Systems. This information is > for use strictly by the intended party. Retransmission of this > correspondence to third parties without the permission of GEMS is > strictly prohibited. If you believe you are not the intended party > for this transmission, you are requested to print this correspondence > and return by U.S. Mail to: GE Medical Systems Information Technologies John Maxwell Software Engineer Voice: (410) 573-6296 FAX: (410) 573-6307 mailto:Joh...@me... snail-mail: 445 Defense Highway, Annapolis MD 21401 Visit us on the Internet: http://www.gemedicalsystems.com |
From: John L W. <jo...@sy...> - 2002-01-30 15:03:11
|
Hi.=20 I've sucessfully compiled my code with g++ in cygwin. When I try to = link the code in cygwin I only get errors. See below. g++ -LC:/cppunit-1.6.2/src/cppunit/.libs -lcppunit MessageHandle.o = MessageEngine.o Client.o TestAll.o TestMessageHandle.o -otests collect2: ld terminated with signal 11 [Segmentation fault] TestAll.o: In function `_tfQ27CppUnit10TestResult': /cygdrive/c/synapp/cvs-lbs/synapp/proj/agilent/c:/cppunit-1.6.2/include/c= ppunit/ TestResult.h(.text$__tfQ27CppUnit10TestResult+0x0): multiple definition = of `CppUnit::TestResult type_info function' C:/cppunit-1.6.2/src/cppunit/.libs/libcppunit.dll.a(.text+0x1ea4c):/cygdr= ive/c/c ppunit-1.6.2/src/cppunit/../../include/cppunit/TestResult.h: first = defined here TestAll.o: In function `_tfQ27CppUnit10TestResult': /cygdrive/c/synapp/cvs-lbs/synapp/proj/agilent/c:/cppunit-1.6.2/include/c= ppunit/ TestResult.h(.text$__tfQ27CppUnit4Test+0x0): multiple definition of = `CppUnit::Te st type_info function' C:/cppunit-1.6.2/src/cppunit/.libs/libcppunit.dll.a(.text+0x1ec44):/usr/i= nclude/ g++-3/std/bastring.h: first defined here TestAll.o: In function `_tfQ27CppUnit10TestResult': /cygdrive/c/synapp/cvs-lbs/synapp/proj/agilent/c:/cppunit-1.6.2/include/c= ppunit/ TestResult.h(.text$__tfQ27CppUnit14TextTestResult+0x0): multiple = definition of ` CppUnit::TextTestResult type_info function' C:/cppunit-1.6.2/src/cppunit/.libs/libcppunit.dll.a(.text+0x1eb58):/cygdr= ive/c/c ppunit-1.6.2/src/cppunit/../../include/cppunit/TestResult.h: first = defined here TestAll.o: In function `_tfQ27CppUnit10TestResult': /cygdrive/c/synapp/cvs-lbs/synapp/proj/agilent/c:/cppunit-1.6.2/include/c= ppunit/ TestResult.h(.text$__tfQ27CppUnit9TestSuite+0x0): multiple definition of = `CppUni t::TestSuite type_info function' |
From: Summerwill, B. <BSu...@eu...> - 2002-01-24 11:41:53
|
I'm getting an MSVC++ level 4 warning everywhere I use the OStringStream class. Here's one example ... CppUnitExtensions\XMLResults.cpp(67) : warning C4701: local variable 'Stream' may be used without having been initialized static std::string GetExceptionLineNumber(CppUnit::Exception* pException) { const long StoredValue = pException->lineNumber(); if (CppUnit::Exception::UNKNOWNLINENUMBER == StoredValue) { return "Unknown"; } CppUnit::OStringStream Stream; <== This is the line the warning refers to Stream << StoredValue; return Stream.str(); } I can only assume it's due to some compiler confusion about the typedef'd std::ostringstream constructor. It's a one-liner to fix (see below). I would imagine this to be a fairly safe change (unless client code is making use of the non-default constructor). It would be similar to the std::ostrstream subclass in the same file. In Portability.h ---------------- #if CPPUNIT_HAVE_SSTREAM # include <sstream> namespace CppUnit { - typedef std::ostringstream OStringStream; + class OStringStream : public std::ostringstream {}; } #else #if CPPUNIT_HAVE_CLASS_STRSTREAM Cheers, Bob Summerwill |
From: Gary G. <gr...@at...> - 2002-01-22 17:32:51
|
You might want to check out the log4cpp library, also on sourceforge, and also originally based on a Java log library log4j. It allows for a hierarchy of log categories to which log messages can be sent of varying levels, then the levels and categories for which log messages are actually recorded, and where, can be configured elsewhere. It has all the features you mentioned wanting, so it would seem natural to extend cppunit to use log4cpp to create a log category hierarchy parallel to the testcase hierarchy. Each test can log messages to its particular category, and those messages could be logged to a file or to stdout according to a runtime configuration. Like you, I also wanted some kind of logging in the tests, so I modified the TestCase API to allow the setup(), runtest(), and teardown() methods which accept a Test pointer. The test methods then log messages directly to the Test object. If Test were modified to support log4cpp as I mentioned above, then I think you'd have a nice logging counterpart to cppunit. I use log4cpp in my projects as well as cppunit, and I've wanted to contribute changes to cppunit to use log4cpp directly, but I haven't had time yet. You can get details (and source) for my modified cppunit here: http://www.atd.ucar.edu/~granger See especially the Changes doc: http://www.atd.ucar.edu/~granger/UnixCppUnit/doc/changes.html gary |
From: John C. <joh...@ta...> - 2002-01-21 21:36:23
|
While I'm on the subject, I feel that there should be a logging class. I often 'cout << ' things as I go a long, which mucks up the pretty ...'s Yes, I know UnitTest's are automagic things that happen in the dark of the night and know one should ever need to look at the logs. But when the nifty automagic unit test fails, one can often immediately see why if there was a nifty log file somewhere, and hence debug the problem faster. There should be a nifty way of recording things as the test goes along.... Something like.... DEBUG( "My pretty log message " << myObject.ToString()); which results in... Some meaningful and informative header giving run date, build date, and hopefully useful CVS $Tag$ info. filename.c:120:[MyClass::MyFunction] My pretty log message Pretty Object Where DEBUG is a mix of preprocessor and a invocation of a logging utility.... #define DEBUG(msg) do {\ CppUnit::Log::Instance()->PrintHeader(__FILE__,__LINE__,__PRETTY_FUNCTION__) \ << msg << endl; \ } while(0) I'm planning on doing something like that, I have most of the code lying around anyway. What would be the best way of doing it in a manner most likely to gain your acceptance? John Carter Phone : (64)(3) 358 6639 Tait Electronics Fax : (64)(3) 359 4632 PO Box 1645 Christchurch Email : joh...@ta... New Zealand Zeitgeist shutting down for corrective maintenance, please log off. |
From: John C. <joh...@ta...> - 2002-01-21 21:01:48
|
I'm using CppUnit-1.6.2 under the GNU gcc compiler and I would like to inject one or two slight gcc'isms into it. In CPPUNIT_ASSERT macros I would like to use the __PRETTY_FUNCTION__ keyword, this allows one to immediately see which function had the assert failure, and more importantantly which instantiation of a template test function had the failure. (Very useful if you are using templates and CppUnit to enforce Bug Compatibility between two implementations...) In the TextTestResult I would like to reformat the error messages to look (at least to emacs) like gcc compiler error messages. This would enable an Emacs user to put the cursor over the offended assert failure, hit enter and Emacs would bring up that file at that source line. What is the favoured manner of making such environment specific changes to CppUnit? Preprocessor conditionals? #if __GNUC__ Do this #else Do that #endif Autoconf enable/disable feature? configure --enable-pretty-function --enable-emacs-support What is the favoured manner of receiving such changes? --As a request, you will do it. --No yuck, don't want that feature, only C++ pure as the driven snowy standard please! --As a patch on 1.6.2. --As a patch on latest CVS version. --Here is access to the CVS tree, do it yourself. Thanks, John Carter Phone : (64)(3) 358 6639 Tait Electronics Fax : (64)(3) 359 4632 PO Box 1645 Christchurch Email : joh...@ta... New Zealand Zeitgeist shutting down for corrective maintenance, please log off. |
From: FUKUDA F. <ff...@nt...> - 2002-01-18 01:36:32
|
CppUnit::XmlOutputter prints <?xml...?> at the beginning. and it's encoding(charset) is fixed as 'ISO-8859-1' however assertion message is NOT always English # yes, I am a Japanese :-) I understand it will be too heavy to support various of encodings. so, as alternative: class XmlOutputter { ... std::string m_encoding; public: XmlOutputter( TestResult *result, std::ostream &stream, const char* encoding="ISO-8859-1" ) : m_result( result ), m_stream( stream ), m_encoding(encoding) {} void XmlOutputter::writeProlog() { m_stream << "<?xml version=\"1.0\" encoding='" << m_encoding << "' standalone='yes' ?>" << std::endl; } ... }; ... how about this? -----:-----:-----:-----:-----:-----:-----:-----:-----:----- FUKUDA (episteme) Fumiki -- magical, but never a magic... |
From: Kirwan, A. <AK...@CA...> - 2002-01-17 02:32:01
|
Hi guys, =20 I'm writing to you on the off chance that you haven't yet figured out = why the test fails. I recently downloaded the suite, and hated the fact = that it didn't run all the tests when it should have. I mean, what = confidence can you have in the thing when the first time you try it = doesn't work properly? Anyway, I've been able to discover that for some = reason probably only known to MS, the checkIsSame method calls the base = class std::exception.what instead of CppUnit::Exception.what, which is = overridden. The hack that I am using for now in to rename what to What. = Hope that this info is of use to you. =20 Regards, =20 Anthony Kirwan. |
From: Phil V. <ph...@us...> - 2001-12-31 20:42:36
|
I'm just starting to learn about CppUnit and think it's going to be very useful for our project. I'm obviously a newbie here, so please set me straight as needed. As I started to use CppUnit, I struggled a bit because the current CppUnit Cookbook didn't quite explain enough for me. I decided to take a stab at rewriting the cookbook, based on a couple of the documents I found on JUnit (which helped me understand CppUnit better). My rewrite is very Linux-centric -- it would be great if someone could update it with some Windows instructions, since it seems like there's lots of CppUnit developers using Windows. I also put together some sample code with explanations and build instructions for Linux. One of the best features of a test framework like CppUnit is the ability to integrate the tests into the standard build process. As I looked through the example code, and the original cookbook, I was confused why TextTestRunner::run returned a void instead of int. By returning an int, my test program can give an indication to the 'make' program whether any of the tests failed. In other words, I wanted to be able to write a test program like this. int main(int argc, char **argv) { CppUnit::TextTestRunner runner; runner.addTest (MoneyTest::suite()); return runner.run(); // returns non-zero if any test failed } That way, when I run 'make check', the make actually fails if the test program returns a non-zero value. The test failure is reported in the output either way, but the non-zero return value brings make to a halt just like a compile error. Perhaps there was another way to do this, but I found it pretty easy to just change TextTestRunner to do what I want. Please let me know if I could have had similar results without changing the CppUnit source. I'm attaching a tarball (39k) that includes my rewrite of the cookbook (with sample code), and the patch to CppUnit 1.6.2 to have TextTestRunner::run return an int. - Phil |
From: Baptiste L. <bl...@cl...> - 2001-12-13 22:08:27
|
Some interesting ideas I am looking atHow about changing the original design a little bit: class Verifiable { virtual void verify() = 0; }; class Expectation : public Verifiable { ... }; // A new base class for all object that contains expectation // C++ allows mutliple inheritance, so we can use a base class // for all object that contains Expectation class VerifiableObject : public Verifiable { public: void addVerifiable( Verifiable * pVerifiable ) { m_verifiables.push_back( pVerifiable ); } void verify() { for ( int index = 0; index < m_veriables.size(); ++index ) m_verifiables[index]->verify(); } private: std::deque<Verifiable *> m_verifiables; } // Our expectation register themself to an object in the constructor class ExpectationCounter : public Expectation { public: ExpectationCounter( VerifiableObject *object, std::string message ) { object->addVerifiable( this ); ... } }; class MyMockObject : public VerifiableObject { public: MyMockObject() { m_computeCalls = new ExpectationCounter( this, "compute calls" ) } ... }; What do you think ? It looks a lot simpler for me, though not has beautiful as the java design, it should work. Baptiste. ----- Original Message ----- From: King Dale To: 'cpp...@li...' Sent: Friday, November 30, 2001 4:44 PM Subject: [Cppunit-devel] Some interesting ideas I am looking at First, I recently discovered the idea of MockObjects (www.mockobjects.com) which is sort of a framework for creating stub-like objects (mock objects are not the same as a stub) upon which you can set expectations and they will verify themself. For instance you could create a mock ostream object and tell it what you expect to be written to it and if something else is written then it will fail. Before discovering the idea, I already did something like this, but it was all hand written as opposed to using a ready-made framework. There are mockobjects for Java that work with Junit, but none for C++ so I started some work on creating a C++ equivalent. [...] --- Baptiste Lepilleur <gai...@fr...> http://gaiacrtn.free.fr/ |
From: Boopathy <mur...@na...> - 2001-12-11 06:19:19
|
=20 Sir, I am new-bee to this cppUnit testing tool. I am unable to run this unit = due to some installation problem. I did run a 'make check' while installation. It was OK. I am trying to run a examples given within the tool. For every Program It is giving error that "Undefined reference to = ....(Here all methods and header files)". For example:=20 /tmp/cczBZhq5.o(.text+0x4b8): undefined reference to = `CppUnit::Exception::UNKNOWNLINENUMBER' like this... I think there may be problem in class path definition. After = Installation of I didn't changed any path. Still I am able to run C++ = programs properly in same directory. I Installed tool with default settings only. I am using GNU Compiler . I am using pentiam processor with redhat linux = 6.1 My 'gcc -v' output is:=20 gcc version:(Output of gcc -v) Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)=20 Please give me required path settings for this tool.=20 Thanks a lot. I am eagerly waiting for ur reply. |
From: Arlo B. <arl...@ho...> - 2001-12-08 00:46:01
|
I don't know whether anyone else has observed the same problem, so I don't know whether this is a problem with the framework, or with my use of it. Here's what I'm seeing: I have several tests for classes that operate on an event-based method, using separate threads. They expect the item using them to also perform message handling. Obviously, the thread that is running a test is not about to perform message handling (some 500 messages during a single test run). Thus, I create a utility class that operates with the test class. It contains its own thread & message loop, and performs the direct communication with the class being tested. The test case creates a script, and the assistant class runs the script and notifies the test case if it doesn't go exactly as scripted (right messages at right times, plus usual asserts). The test case waits for the assistant to end, then checks for assertions and exits. There may be more than one assistant - one of my tests is of a networking subsystem, so it sets up a series of virtual machines, each listening on a different port, then gives each a script indicating what messages it should sent to and expect from where. They all use the box's IP address, and actually route traffic across our LAN and back to the test. However, this has allowed me to see a problem. It appears that the MFC GUI test runner w/ auto-registered tests causes their fixture setup functions to be executed when the dialog first appears - before the user selects a test and runs it. In my case, that means that my process suddenly spawns fifty or more threads, even though no single test requires more than 6. We're just getting started on this project, and we're already facing resource starvation because of the tests! Has anyone else observed that the fixture setup functions get called early? Was it a problem with their use of the library, or is there a bug in CppUnit? Arlo |
From: Arlo B. <arl...@ho...> - 2001-12-08 00:31:21
|
I was looking over the forums, in search of others seeing similar issues to what I'm seeing (didn't find any). I saw this thread and figured I'd respond, as I ran into it myself last month and solved it adequately. I use a two part solution. First, for dynamic libraries: I use a method very similar to a standard plugin. Define some function that your company will always use to to export unit tests. Bundle each set of unit tests with the link unit that contains the things they are testing. Use the auto-registration features to make them register themselves within that link unit. Now just have the standard export function look at the library's internal registry & get the tests, and return them. Then, you simply have your main executable walk the directory(s) in which you place these files (I build the whole series of projects with a common "unit testing" directory into which all output files are placed). Dynamically load each dll found, and attempt to dynamically find the export function. If you fail to find the export function, then this module doesn't have tests, so you can unload it. Otherwise, keep it around. Once you've walked the entire directory tree & loaded all the libraries with tests, you run the test runner and let the user select what he wants to test (this also has the advantage of automagically setting up the test tree such that one level contains the filenames for each linking unit, and selecting one runs all tests in that unit only). After tests are done, the libraries are dynamically unloaded. Static link libraries can't be handled in this fashion. However, I find it perfectly palatable for the module that uses a static link library to know that it is. Thus, I simply place all of my autoregistrations for a static link library into their own file (not inline in the CPP for that one test). Then, I add this cpp to the project for any project that uses the static link library. Now, those tests will be added to the auto-register tests for the main project. In my case, the using project is another DLL, which exports the tests using the above method. If anyone is interested, I can send source. It's about 5 files, so I'll not send them unless there's interest. Arlo |
From: Douglas de la T. <res...@gt...> - 2001-12-05 09:35:08
|
If I comment out the call to the base class assignment operator, the = tests pass under VC++ 6.0. Not sure what the parent class is doing, but = it appears that if the parent is called, then the "Unknown exception" is = returned for the string. If not, the expected string is returned. Not = sure exactly why, but it might offer a clue to why the test fails on = VC++ 6.0. -Doug /// Perform an assignment Exception&=20 Exception::operator=3D( const Exception& other ) {=20 // exception::operator=3D (other); // note! this line removed on = VC++6.0 gives expected behavior if (&other !=3D this)=20 { m_message =3D other.m_message;=20 m_lineNumber =3D other.m_lineNumber; m_fileName =3D other.m_fileName; } return *this;=20 } |
From: King D. <Ki...@tc...> - 2001-11-30 15:45:53
|
First, I recently discovered the idea of MockObjects (www.mockobjects.com) which is sort of a framework for creating stub-like objects (mock objects are not the same as a stub) upon which you can set expectations and they will verify themself. For instance you could create a mock ostream object and tell it what you expect to be written to it and if something else is written then it will fail. Before discovering the idea, I already did something like this, but it was all hand written as opposed to using a ready-made framework. There are mockobjects for Java that work with Junit, but none for C++ so I started some work on creating a C++ equivalent. However, just as with cppunit things would be a whole lot nicer if C++ had reflection like Java does. While doing some research, I stumbled across something called OpenC++ (http://www.csg.is.titech.ac.jp/~chiba/openc++.html). It is kind of hard to explain what exactly OpenC++ is (the documentation does a very lousy job), but it is sort of translating preprocessor for C++ that lets you add your own language extensions. It reads in your source files and various meta classes that you write and spits out C++ code. You have full access to the parse tree of the source code and can modify it and do reflection. You could think of it as a much smarter version of the preprocessor, but that would hardly be doing it justice. I know my explanation does not do it justice, but consider an example related to CppUnit. Instead of all the mucking about with preprocessor macros and templates like CPPUNIT_TEST_SUITE stuff, you could actually define a language extension using for example class and method modifiers (testsuite and testcase in the example): class testsuite FooBarTests { public: testcase void testFoo(); testcase void testBar(); }; And this could generate the suite method adding all test cases to it, getting their names from their declarations. An alternative syntax idea could be to use a user defined access modifier class testsuite FooBarTests { public: testcases: void testFoo(); void testBar(); }; Or the testsuite metaclass could do like junit and simply add all methods with a signature of void testXXX() as test cases. There are many possibilities. This would also be helpful in something that is a big problem right now with CppUnit, how to use decorators with the macros. Currently you can't and there isn't a good solution particularly with the notion that decorated tests have a variable number of parameters. But imagine doing: class testsuite FooBarTests { public: testcase decorator( RepeatedTest, 5 ) void testFoo(); testcase void testBar(); }; This would decorate the testFoo case, by wrapping it with a RepeatedTest test decorator with a parameter of 5. (Of course test decorators need to get their test ownership issues fixed). It would be a lot cleaner, and avoid duplication of names as macro parameters. This would be helpful with MockObjects, because in the Java version you can create a mock object and it uses reflection to just examine the class of the object and iterate through all fields looking for ones that implement the Expectation interface and calls their verify method. All it took to add an expectation was to add the field to the class. Of course in straight C++ it is not so simple. I could try to do something like what CppUnit does with the CPPUNIT_TEST_SUITE stuff which requires declaring things twice. But I think a better idea is to use OpenC++ and extend the language to add mockobjects that would generate code that called verify on all members that implement the Expectation interface. I just thought I would solicit any thoughts on the subject from the group. Note, I am going on vacation tomorrow so it will be a week or so before I get back with anyone. |
From: Steve M. R. <ste...@vi...> - 2001-11-29 16:03:42
|
On Thu, Nov 29, 2001 at 09:55:04AM -0500, Yongyi Ye wrote: > kunlun [345] make check > Making check in src > make[1]: Entering directory `/home/yye/unitcpp/source/cppunit-1.6.2/src' > Making check in cppunit > make[2]: Entering directory `/home/yye/unitcpp/source/cppunit-1.6.2/src/cppunit' > source='NotEqualException.cpp' object='NotEqualException.lo' libtool=yes \ > depfile='.deps/NotEqualException.Plo' tmpdepfile='.deps/NotEqualException.TPlo' > \ > depmode=gcc /bin/sh ../../config/depcomp \ > /bin/sh ../../libtool --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I../../config > -I../../include -I../../include -U_OSF_SOURCE -g -O2 -c -o > NotEqualException.lo `test -f NotEqualException.cpp || echo > './'`NotEqualException.cpp > g++ -DHAVE_CONFIG_H -I. -I. -I../../config -I../../include -I../../include > -U_OSF_SOURCE -g -O2 -c NotEqualException.cpp > -Wp,-MD,.deps/NotEqualException.TPlo -fPIC -DPIC -o .libs/NotEqualException.o > ../../include/cppunit/Exception.h:7: sorry, not implemented: namespace ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Namespace is not implemented??? You won't get anywhere without namespace support in the compiler! What version (g++ --version) of compiler do you have? I've built cppunit using GCC 2.95.x and GCC 3.x on IRIX and linux and NetBSD. -Steve -- by Rocket to the Moon, by Airplane to the Rocket, by Taxi to the Airport, by Frontdoor to the Taxi, by throwing back the blanket and laying down the legs ... - They Might Be Giants |
From: Yongyi Ye <yy...@en...> - 2001-11-29 15:22:39
|
Hello: When I compiled the cppunit I got an error. My system info: uname -m = sun4u uname -r = 5.6 uname -s = SunOS uname -v = Generic_105181-23 /usr/bin/uname -p = sparc /bin/uname -X = System = SunOS /bin/arch = sun4 /usr/bin/arch -k = sun4u /usr/convex/getsysinfo = unknown hostinfo = unknown /bin/machine = unknown /usr/bin/oslevel = unknown /bin/universe = unknown PATH = /apps/gnu/sun4.sunos.5/bin/make:/apps/gnu/sun4.sunos.5/bin/install:/apps/rationa l/rose/bin:/apps/gnu/arch/bin/make:/apps/doors/bin:/apps/Modsim/modsim3-2.2/bin: /home/yye/jbuilder35/bin:/home/yye/jbuilder35/jdk1.2.2/bin:/opt/SUNWgnu/bin:/usr /dt/bin:/usr/openwin/bin:/opt/SUNWspci/bin:/apps/workshop/bin:/usr/openwin/bin:/ usr/openwin/bin/xview:/apps/local/arch/exec/head:/usr/sbin:/bin:/usr/bin:/usr/cc s/bin:/usr/5bin:/usr/ucb:.:/home/yye:/home/yye/bin:/apps/local/arch/exec/tail THE ERROR MESSAGE: kunlun [344] make chack make: *** No rule to make target `chack'. Stop. kunlun [345] make check Making check in src make[1]: Entering directory `/home/yye/unitcpp/source/cppunit-1.6.2/src' Making check in cppunit make[2]: Entering directory `/home/yye/unitcpp/source/cppunit-1.6.2/src/cppunit' source='NotEqualException.cpp' object='NotEqualException.lo' libtool=yes \ depfile='.deps/NotEqualException.Plo' tmpdepfile='.deps/NotEqualException.TPlo' \ depmode=gcc /bin/sh ../../config/depcomp \ /bin/sh ../../libtool --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I../../config -I../../include -I../../include -U_OSF_SOURCE -g -O2 -c -o NotEqualException.lo `test -f NotEqualException.cpp || echo './'`NotEqualException.cpp g++ -DHAVE_CONFIG_H -I. -I. -I../../config -I../../include -I../../include -U_OSF_SOURCE -g -O2 -c NotEqualException.cpp -Wp,-MD,.deps/NotEqualException.TPlo -fPIC -DPIC -o .libs/NotEqualException.o ../../include/cppunit/Exception.h:7: sorry, not implemented: namespace In file included from ../../include/cppunit/NotEqualException.h:4, from NotEqualException.cpp:1: ../../include/cppunit/Exception.h:15: confused by earlier errors, bailing out make[2]: *** [NotEqualException.lo] Error 1 make[2]: Leaving directory `/home/yye/unitcpp/source/cppunit-1.6.2/src/cppunit' make[1]: *** [check-recursive] Error 1 make[1]: Leaving directory `/home/yye/unitcpp/source/cppunit-1.6.2/src' make: *** [check-recursive] Error 1 Could you help me? What should do about this? Thank you! |
From: Martin F. <mar...@gm...> - 2001-11-20 23:13:17
|
Hi! I can tell the cause of the problem with the failed "ExceptionTest.testAssignment" test in CppUnit test suite using VC++, which you metioned in your FAQ document of cppunit-1.6.2. The exception assignment operator is internally implemented as something like this: (Unfortunatelly I couldn't find the source could in the MSVCRT files, so I had to look at the assembler code with the debugger.) exception& std::exception::operator=(const exception& other) { if (&other != this) { this->~exception(); exception(other); } return *this; } While calling the destructor the virtual function pointer ist overwritten with that of the base class. This is the cause, why afterwards calling what() calls std::exception::what(), not CppUnit::Exception::what(), like expected. There seem to be two solutions. One would be to overwrite the without calling the destructor: exception& std::exception::operator=(const exception& other) { if (&other != this) { // this->~exception(); exception(other); } return *this; } But this way we get the warning message:" warning C4273: '=' : inconsistent dll linkage. dllexport assumed." I think the best way is not to call std::exeption::operator=() at all: Exception& Exception::operator=( const Exception& other ) { //SuperClass::operator= (other); if (&other != this) { m_message = other.m_message; m_lineNumber = other.m_lineNumber; m_fileName = other.m_fileName; } return *this; } It isn't necesarry anyway, because you dont't use any members variables of std::excpetion. There is also a solution for sucessfully using the list control style LVS_EX_FULLROWSELECT in TestRunnerDlg.cpp: ListView_SetExtendedListViewStyleEx(m_listCtrl, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT); This way it works like expected. LVS_EX_FULLROWSELECT isn't a traditional attribut one can set using GWL_EXSTYLE. But something special to COMCTL32.DLL. I've another suggestment: You should add the "const" attribute to the functions Exception::lineNumber() and Exception::fileName(). So you can use constant references in: ExceptionTest::checkIsSame(CppUnit::Exception &e, const CppUnit::Exception &other) I frist heared of your project yesterday. It seems very interesting for me. May be I will use it in my next project to see if really can make live easier... :-) cu, Martin Fuchs |