Boost logo

Boost Users :

From: Plonka Christian (christian.plonka_at_[hidden])
Date: 2008-01-15 03:55:57


Hi,

I'm planning to change from CppUnit to Boost.Test for unit testing since
it is now possible to integrate unit tests also in a DLL. Nevertheless I
do encounter some problems here.

The code is (I guess you'll recognize it):

//----------------------------------------------------------------------

---
#define BOOST_TEST_DYN_LINK
#include <boost/test/unit_test.hpp>
using namespace boost::unit_test;
BOOST_AUTO_TEST_CASE( test1 )
// void test1()
{
    int i = 0;
    BOOST_CHECK_EQUAL( i, 2 );
}
BOOST_AUTO_TEST_CASE( test2 )
{
    BOOST_CHECKPOINT("About to force division by zero!");
    int i = 1, j = 0;
    i = i / j;
}
extern "C" {
__declspec(dllexport) bool
init_unit_test()
{
    printf("Initializing\n");
    framework::master_test_suite().p_name.value = "Test runner test";
    // framework::master_test_suite().add( BOOST_TEST_CASE( &test1 ) ); 
    return true;
}
}
//----------------------------------------------------------------------
---
I the sample (test_runner_test.dll) it works fine but when I use it in
my DLL I get:
C:\Projekte\Test\NetControl\bin>console_test_runner --test NetCtrld.dll
Initializing
Test setup error: test tree is empty
I also tried the commented version using master_test_suite().add()
without any change.
Any hint what I can try or how I can debug this?
Thanks,
Christian

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net