Boost logo

Boost Users :

From: n.torrey.pines_at_[hidden]
Date: 2007-03-03 04:33:47


Playing with Boost.Test on VC++8, I encountered something odd. This
little program:

#define BOOST_AUTO_TEST_MAIN
#include <boost/test/auto_unit_test.hpp>

int factorial(int n) {
        if(n < 1) return 1;
        return n * factorial(n-1);
}

BOOST_AUTO_TEST_CASE( factorial_test ) {
    BOOST_CHECK( factorial(10000) == 3 );
}

Produces this output:

------- begin output ------
Running 1 test case...
Press any key to continue . . .
-------- end output ------

 (this is debug mode, linked against
libboost_unit_test_framework-vc80-mt-gd.lib):

Changing "10000" to "1000" effects the correct behavior (error report).

This might be related to some stack overflow issues, so if you can not
reproduce this, you may want to try even greater arguments to
"factorial".

Is this a bug, or am I using the library incorrectly?


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