Why does CppUnit give me seg faults?
I've narrowed the seg fault down to 3 lines of code that I've commented out below. If I uncomment any of these lines I get a seg fault.
Code:
int main( int argc, char* argv[] )
{
if ( argc != 3 )
{
std::cerr << "Usage: sample <host> <port>" << std::endl;
return 1;
}
/// Create a new TestSuite & add the sample test.
CppUnit::TestSuite testSuite( "Sample Test" );
SampleTest sampleTest( argv[1], argv[2] );
// testSuite.addTest( &sampleTest );
/// Adds the test to the list of test to run
CppUnit::TextUi::TestRunner runner;
CppUnit::XmlOutputter xmlOutput( &runner.result(), std::cerr );
// runner.setOutputter( &xmlOutput );
// runner.addTest( &testSuite );
runner.run();
return 0;
}
This is the first time I've tried using CppUnit, so I'm probably not using it right...
Want to know the usage of cppunit library
Quote:
Originally Posted by
laserlight
According to an example from their
cookbook, CppUnit::TestSuite::addTest takes a pointer to a dynamically allocated test object.
EDIT:
Yeah, considering that there is a TestSuite::deleteContents member function that destroys all the tests in the suite, passing a pointer to a stack allocated object would be wrong.
Hi Laser,
I want to use CPPUNIT for C programming unit testing? where i will get complete information about its usage? i am completely new to this kind of stuff.
Thanks in advance for your help.
Regards,
Siddu