Passion is like genius; a miracle.

Blog on Software, Statistics, and Quant

boost unit test


#include <string>
#include <boost/test/unit_test.hpp>
#include <boost/test/included/unit_test_framework.hpp>

using namespace std;
using namespace boost::unit_test;

void force_division_by_zero()
    BOOST_CHECKPOINT("About to force division by zero!");
    int i = 1, j = 0;
    i = i / j;

init_unit_test_suite(int, char**)
    test_suite* test = BOOST_TEST_SUITE("Unit test example2");

    test->add(BOOST_TEST_CASE(&force_division_by_zero), 1);

    return test;


Leave a Reply

Your email address will not be published. Required fields are marked *