Thread: RE: [Cppunit-devel] examples on webpage.
Brought to you by:
blep
From: Cremin, P. <pc...@or...> - 2003-02-13 00:00:23
|
I assume you are referring to the CppUnit Cookbook? http://cppunit.sourceforge.net/cppunit_cookbook.html#cppunit_cookbook If you take the code directly from that site I believe it will compile. Also, in the CppUnit source you downloaded look in cppunit\examples. There you will find a examples.dsw. Open that up and check out 'hierarchy classes' which has a Boardgame with CppUnit working on it. I wouldn't expect too much to be done about additional documentation. CppUnit is free, and additional docs will probable be developed by end users like me and you. Take a look at http://www.iunknown.com/Articles/fog0000000025.html For another example (gets into how to set up your project which can be a pain) Trust me though, I am a moron and I was able to get this working. Even added additional assertions and no operation test results. Good Luck, Patrick Cremin =20 -----Original Message----- From: Thomas Zander [mailto:za...@pl...]=20 Sent: Wednesday, February 12, 2003 5:23 PM To: cpp...@li... Subject: [Cppunit-devel] examples on webpage. Hi, trying to follow your examples on the website I was confused and disillusioned by the bad sourcecode you provide. I understand that your page wants to explain the concepts, but it basically lacks one thing; producing a compiling file that I can actually run... Ok, lets start my argument again; and let me get to the problem in a bit. I want to try cppunit. So the first thing I do is I find out about the assertions you provide and then I want to get a really simple test running and compiling. This part is essential and if this does not work I want to spend 0 time trying to figure out other ideas like suite etc. The page I found provided a number of sourecode samples but none had a full listing that actually compiled. And reaching the end I found a main method, but that uses a lot of concepts I never heard of; but I can't understand the concepts without seeing a running example of a test. Confused? So was I, the problem with your pages is that I can only understand then when I know what it is you explain. Please provide for _EACH_ example code a single file that contains the whole test; including main and everything. Preferrably with an example gcc (or similar) call at the top. It is sooo much easier to understand what you are saying when I have the option to see it in the context of the whole... If I can just get one file to actually compile I might start using cppunit! Many thanx! ps. a page describing the differences between junit and cppunit would also be great. --=20 Thomas Zander ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Cppunit-devel mailing list Cpp...@li... https://lists.sourceforge.net/lists/listinfo/cppunit-devel |
From: Bart W. <whi...@ll...> - 2003-02-13 00:33:13
Attachments:
testrunner.cpp
complexTestSuite.cpp
|
Actually, Thomas has a good point. The cookbook example has several problems that cause it to not compile. Read the comments within my attachments to see where the cookbook led you astray. Build like this: g++ -c testrunner.cpp g++ -c complexTestSuite.cpp g++ -o testrunner testrunner.o complexTestSuite.o -lcppunit Then just run ./testrunner You may need -L or -I flags to g++ if you installed cppunit someplace non-standard. Hope this helps. -- Bart Whiteley Computer Scientist voice: (925) 423-2249 National Atmospheric Release Advisory Center FAX: (925) 423-8274 Lawrence Livermore National Laboratory email: whi...@ll... P.O. Box 808, Livermore, CA 94551-0808 MS: L-103 |
From: Thomas Z. <za...@mi...> - 2003-02-24 21:00:25
|
On Wed, Feb 12, 2003 at 04:32:49PM -0800, Bart Whiteley wrote: > Actually, Thomas has a good point. The cookbook example > has several problems that cause it to not compile. > > Read the comments within my attachments to see where the cookbook > led you astray. Thanx! This one actually compiled :) It took some time to get a correct install; my debian version did not link. I had to compile the sources. So, I'm of in creating more testunits! btw; your testrunner: > bool wasSucessful = runner.run( "", false ); > return wasSucessful; seems wrong; wasSucessful is 1 when everything went right, but returning 0 is the 'success' return state of main. So I believe it should be if(wasSucessful) return 0; return -1; And if you want to assume the implied values of the bool (sounds dirty ;). return !wasSucessful; -- Thomas Zander |
From: Bart W. <whi...@ll...> - 2003-02-24 21:12:56
Attachments:
testrunner.cc
|
On Mon, Feb 24, 2003 at 09:58:41PM +0100, Thomas Zander wrote: > > Thanx! This one actually compiled :) > It took some time to get a correct install; my debian version did not link. > I had to compile the sources. > So, I'm of in creating more testunits! > Glad I could help. > > btw; your testrunner: > > > bool wasSucessful = runner.run( "", false ); > > return wasSucessful; > > seems wrong; wasSucessful is 1 when everything went right, but returning > 0 is the 'success' return state of main. > So I believe it should be > if(wasSucessful) return 0; > return -1; > > And if you want to assume the implied values of the bool (sounds dirty ;). > return !wasSucessful; > Correct. I was trying to stay as close to the cookbook as possible. See attachment for my real testrunner.cc. It also adds the feature of passing a command line param to run a single test suite or single unit. ./testrunner TestSuiteName or ./testrunner TestSuiteName::UnitTestName -- Bart Whiteley Computer Scientist voice: (925) 423-2249 National Atmospheric Release Advisory Center FAX: (925) 423-8274 Lawrence Livermore National Laboratory email: whi...@ll... P.O. Box 808, Livermore, CA 94551-0808 MS: L-103 |
From: Bart W. <whi...@ll...> - 2003-02-24 21:18:55
|
On Mon, Feb 24, 2003 at 01:12:31PM -0800, Bart Whiteley wrote: > > It also adds the feature > of passing a command line param to run a single test suite or > single unit. > > ./testrunner TestSuiteName > or > ./testrunner TestSuiteName::UnitTestName > Oh wait... I think that only works with current CVS, not 1.8.0. -- Bart Whiteley Computer Scientist voice: (925) 423-2249 National Atmospheric Release Advisory Center FAX: (925) 423-8274 Lawrence Livermore National Laboratory email: whi...@ll... P.O. Box 808, Livermore, CA 94551-0808 MS: L-103 |