Philippe Fremy | 4 Jan 23:59 2003
Picon

Problem


	Hi,

I am using cppunit on a gentoo linux 1.4 rc1 box. I got a SIGABORT signal.

gcc version is 3.2.1 

hilippe <at> werewindle ~/work/kompare/kdesdk/kompare-phil/libdiff2/unittests $ gdb 
unittests
GNU gdb 5.2.1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
(gdb) run
Starting program: 
/home/philippe/work/kompare/kdesdk/kompare-phil/libdiff2/unittests/unittests
..
Program received signal SIGABRT, Aborted.
0x40176c91 in kill () from /lib/libc.so.6
(gdb) backtrace
#0  0x40176c91 in kill () from /lib/libc.so.6
#1  0x40176a78 in raise () from /lib/libc.so.6
#2  0x4017811c in abort () from /lib/libc.so.6
#3  0x400f1dd3 in __cxxabiv1::__terminate(void (*)()) ()
   from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/libstdc++.so.5
#4  0x400f1e14 in __cxxabiv1::__unexpected(void (*)()) ()
   from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/libstdc++.so.5
(Continue reading)

Philippe Fremy | 5 Jan 00:06 2003
Picon

Reviving name of target being tested in error messages


	Hi,

in the first version of cppunit, IIRC, one could write something like that :

CPPUNIT_ASSERT_EQUALS( a, 2 )

and get an error message like 

" 'a' was expected to be 2 but was actually 3"

Now the error message is more along 

" expected: 2
  but was: 3
"

There is a loss of information, the name of what was being tested. And I like 
to have it back.

Was it removed because getting a string for this argument was dependant on a 
macro trick ?

	regards,

	Philippe

--

-- 
Free the mallocs!

(Continue reading)

Phlip | 5 Jan 07:55 2003

Re: Reviving name of target being tested in error messages

Philippe Fremy sez:
> Hi,
>
> in the first version of cppunit, IIRC, one could write something like that
> :
>
> CPPUNIT_ASSERT_EQUALS( a, 2 )
>
> and get an error message like
>
> " 'a' was expected to be 2 but was actually 3"
>
> Now the error message is more along
>
> " expected: 2
>   but was: 3
> "
>
> There is a loss of information, the name of what was being tested. And I
> like to have it back.
>
> Was it removed because getting a string for this argument was dependant on
> a macro trick ?

Just to fan some flames here, but that's not a macro "trick", it's a very 
healthy established practice called "Stringerization". There's no reason not 
to do it. I have often gone to great lengths to reproduce the trick in 
interpretive languages.

This CppUnit knock-off uses it (and puts it in the Output window of VC++):
(Continue reading)

Philippe FREMY | 6 Jan 11:47 2003

Re: mock objects for c++


> I thought you might be interested to know that I have started last week a
port
> of "Mock Objects for Java" (http://www.mockobjects.com) to C++.

You can read the previous threads on the subject:

http://sourceforge.net/mailarchive/forum.php?thread_id=987792&forum_id=6698

http://sourceforge.net/mailarchive/forum.php?thread_id=1007108&forum_id=6698

Although I haven't used it yet, I think easymock is easier to use than
mockobjects.

What do you think of the issues raised in the threads I list ?

	regards,

	Philippe

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Ross Burton | 6 Jan 16:00 2003

CppUnit RPM .spec file updates

Hi,

We needed to build a RPM of CppUnit to distribute around the office, but
the .spec file is a little simple and does not use the groovy macros for
clever installs (thus files appear in the wrong location on RH7x/RH8).

Attached is a new .spec.in file (based on the file from cppunit-1.8.0)
which works a lot better for me. Assuming the 1.9.x changes didn't
radically re-arrange the installed files it should work fine.

Regards,
Ross
--

-- 
Ross Burton                     Software Engineer
OneEighty Software Ltd          Tel: +44 20 8680 8712
Cygnet House                    Fax: +44 20 8680 8453
12-14 Sydenham Road             r.burton@...
Croydon, Surrey CR9 2ET, UK     http://www.180sw.com./
====================================================================
Under the Regulation of Investigatory Powers (RIP) Act 2000 together
with any and all Regulations in force pursuant to the Act OneEighty
Software Ltd reserves the right to monitor any or all incoming or
outgoing communications as provided for under the Act
%define  RELEASE 1
%define  rel     %{?CUSTOM_RELEASE} %{!?CUSTOM_RELEASE:%RELEASE}

Name:  <at> PACKAGE <at> 
Version:  <at> VERSION <at> 
(Continue reading)

Baptiste Lepilleur | 7 Jan 10:38 2003
Picon

Re: Bug or misunderstanding?

----- Original Message -----
From: "Duane Murphy" <duanemurphy@...>
To: <Sebastian.Unger@...>; "CppUnit Developers"
<cppunit-devel@...>
Sent: Friday, December 20, 2002 12:00 AM
Subject: Re: [Cppunit-devel] Bug or misunderstanding?

> --- At Fri, 20 Dec 2002 11:45:45 +1300,
> Sebastian.Unger@... wrote:
>
> >Hi,
> >
> >I'm just starting on a new project and we are going to use CppUnit as a
> >framework for our tests. Right now I'm working on the UI part of the
> >application and so I started out with creating a Fixture that contains a
> >UserInterface object as a member and has a static suite() function just
as
> >described in the CookBook. The suite creates two (for now) TestCallers
and
> >pass in test methods of the fixture. I expected one Fixture (and therefor
> >one UserInterface) to be created and that all the testmethods are called
on
> >this one object (framed by calles to setUp() and tearDown() which reset
the
> >UI object to a
> >known state.)
> >
> >However, it turned out that for each TestCaller instantiated one Fixture
> >was instantiated and the testmethods were each called on a different
> >Fixture object. This resulted in multiple UI objects to be created and
(Continue reading)

ritesh | 7 Jan 12:33 2003

How to get output in Xml!!

Hi
     I am learning CppUnit. I have learnt with Gui and command line output.
How to get out put in Xml.

Please tell me if any cookbook is available.

Thanks & Regards

- Ritesh Mittal

-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
Philippe FREMY | 7 Jan 14:09 2003

Testrunner interface


	Hi,

I want to write my custom test outputter with the following characteristics:
1. the name of the test being run is printed
2. the full failure is reported during the test run
3. a percentage of the number of test failed is printed at the end.

1 & 2 can be done using TestResultCollecter or using a custom TestListener
3 can be done using TestResult or an Outputter

But how do I glue this together ? TestRunner should be my interface.

But it turns out that TestRunner does have enough methods to customise the
progress reporter. So I have to inherit from TestRunner to do what I want.
This is a pity because internally, TestRunner has everything I need.

For the next version of cppunit, I suggest to add a few methods, that would
behave basically like setOutputter: provide a sensible text default but
allow for customisation. I need:
setTestProgressListener( TestListener );
and probably 
setTestResultCollecter( TestResultCollecter );

This won't break binary compatibility. Do you want the patches ?

	regards,

	Philippe

(Continue reading)

Duane Murphy | 8 Jan 17:35 2003
Picon

Re: Bug or misunderstanding?

--- At Tue, 7 Jan 2003 10:38:34 +0100, Baptiste Lepilleur wrote:

>>
>> Others that work on CppUnit can speak up for why it is this way. I have
>> long considered this a bug. CppUnit likes calling new() :-). They
>> instiate a new Fixture() for each test case. You will have to work around
>> it somehow.
>
>This is a normal behavior. It provides maximum isolation between each test
>case of the fixture. As far as I know JUnit behave the same way.

There is a chance I missed something, but from my brief review of the
JUnit code and especially the JUnit articles and examples I have read, it
appeared to me that the point of the Fixture was indeed to manage the a
set of tests and not a single test. If it was meant to manage a single
test that what is the point of setUp() and tearDown()? I could just as
easily do these in a constructor or a destructor.

>> CppUnit likes calling new() :-).
>
>What do you mean ?

I find the use of new() to be a liability. It is the leading cause of
memory leaks and object lifetime errors. I have in fact had bugs with
CppUnit where the lifetime of an object was indeed shorter that I had
expected. 

I avoid pointers and unmanaged memory as much as possible. I use
references and shared pointers (from boost) for all of my memory
management. This makes the code safer, more stable, and easier to read
(Continue reading)

Eugene Zozulya | 10 Jan 16:01 2003

How to check the test result in the tearDown()

Hi all,
Is any way to know the test result in the tearDown() except using the flags?
The following doesn't work (might be stupid, but I've tried...):

// cppunit-1.9.10
class MyTest: public CppUnit::TestFixture
{
  CPPUNIT_TEST_SUITE( MyTest );
  CPPUNIT_TEST( MyTestCase );
  CPPUNIT_TEST_SUITE_END();

public:
    virtual void setUp();
    virtual void tearDown();
    void MyTestCase();

private:
    fstream m_OutFile;
    CPPUNIT_NS::TestResultCollector *m_pResult;
}

CategMapTest::MyTest()
{
    m_OutFile.open("MyTest.out", ios::out | ios::app);
    m_pResult = new CPPUNIT_NS::TestResultCollector();
    CPPUNIT_NS::TestResult().addListener( m_pResult );
}

CategMapTest::~MyTest()
{
(Continue reading)


Gmane