Search code examples
c++boost-test

Exception Error at the line BOOST_AUTO_TEST_SUITE_END()


i have a problem with the boost-test from my teacher. When i'm debugging my project i get an error at this Line:

    BOOST_AUTO_TEST_SUITE_END()

The Exception is the following:

0x7521b727 (KernelBase.dll) in homework2.exe: 0xC0020001: The string binding is invalid.

i'm using Visual Studio 2010 ultimate and Win7 Professional (with all updates) This Bug is very annoying,because i get an Zombie console Window when the exception is thrown.

sorry for my English ;)

Edit: My test Code

#define BOOST_TEST_MAIN
#define BOOST_TEST_DYN_LINK
#include <boost/test/unit_test.hpp>
#include <string>

BOOST_AUTO_TEST_SUITE( easy_stringtest)

BOOST_AUTO_TEST_CASE( length_test)
{
    std::string s("xyz");
    BOOST_CHECK(s.length() ==3);
}

BOOST_AUTO_TEST_CASE( same)
{
    std::string s("abc");

    BOOST_CHECK(s == "abc");
}


BOOST_AUTO_TEST_SUITE_END()

Edit: I have fould my fault... The IDE Option /clr was turned on, turn it off and you will have no error :D


Solution

  • I have changed my include; my teacher told me that the problem was with my binaries.

    When someone else has the same problem here is the solution:

    New Code:

    #define BOOST_TEST_MAIN
    #include <boost/test/included/unit_test.hpp>
    #include <string>
    
    BOOST_AUTO_TEST_SUITE( easy_stringtest)
    
    BOOST_AUTO_TEST_CASE( length_test)
    {
        std::string s("xyz");
        BOOST_CHECK(s.length() ==3);
    }
    
    BOOST_AUTO_TEST_CASE( same)
    {
        std::string s("abc");
    
        BOOST_CHECK(s == "abc");
    }
    
    
    BOOST_AUTO_TEST_SUITE_END()