boost unit test library

alind sharma alind_sap at yahoo.com
Wed May 28 08:00:03 BST 2008


I want to use boost unit test library in kdevelop. The reason is i find boost ubnnit tst library easier to use with comprehensive utilites. but i m new to kdevelop. I want directory structure to be something like:
 there shd be two directoris inside src directory 
1) main //will contain the main code like add.h add.cpp complex.h comlex.cpp main.cpp
2) tests //will contain the test code addTest.cpp complesTest.cpp
Now here comes the problems:
1) the boost test library contains its own main. we use boost test using only macros. so can i put my main function also in the main directory's main.cpp file.
2) how to tell kdevelop to do proper linking and build process

Here i am atachin a simple program using boost unit test framework:
//==================
//file name : test.cpp
//to compile : g++ test.cpp -lboost_unit_test_frameowrk

#define BOOST_TEST_MODULE MyTest
#define BOOST_TEST_DYN_LINK
#include <boost/test/unit_test.hpp>

int add( int i, int j ) { return i+j; }

BOOST_AUTO_TEST_CASE( my_test )
{
    // seven ways to detect and report the same error:
    BOOST_CHECK( add( 2,2 ) == 4 );        // #1 continues on error

    BOOST_REQUIRE( add( 2,2 ) == 4 );      // #2 throws on error

    if( add( 2,2 ) != 4 )
      BOOST_ERROR( "Ouch..." );            // #3 continues on error

    if( add( 2,2 ) != 4 )
      BOOST_FAIL( "Ouch..." );             // #4 throws on error

    if( add( 2,2 ) != 4 ) throw "Ouch..."; // #5 throws on error

    
}

//==================
Also can anybody tell me how to search this mailing ilst .Are there any plans to integrate boost unit test frameworka as a plugin.

thanks in advance.


Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download Now! http://messenger.yahoo.com/download.php
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop/attachments/20080528/93d2f499/attachment.html>


More information about the KDevelop mailing list