test/unit_tests/erase/erase_test.cpp
BOOST_AUTO_TEST_CASE(test_erase_ifs)
{
//BOILERPLATE
    namespace ut=boost::unit_test;
    boost::onullstream    null_output;
    ut::unit_test_log.set_stream(null_output);
    ut::test_suite* test = BOOST_TEST_SUITE("");
//END BOILERPLATE

// CUSTOM CODE
    typedef boost::mpl::list< 
                    std::vector<int>, 
                    std::list<int>, 
                    std::set<int>,
                    std::deque<int>,
                    std::multiset<int>
            > test_types;
            
    typedef boost::mpl::list< 
                    std::map<int, int>, 
                    std::multimap<int, int>
            > test_key_value_types;
    test->add(BOOST_TEST_CASE_TEMPLATE(test_erase_if, test_types));
    test->add(BOOST_TEST_CASE_TEMPLATE(test_key_value_erase_if, test_key_value_types));
// END CUSTOM CODE

//BOILERPLATE
    ut::framework::run(test);
    ut::test_results const& tr = ut::results_collector.results(test->p_id);

    ut::unit_test_log.set_stream(std::cout);
    BOOST_CHECK_EQUAL(tr.p_assertions_failed, (std::size_t)0);
    BOOST_CHECK(!tr.p_aborted);
//END BOILERPLATE
}
/* We wrap the call to test->add inside of a BOOST_AUTO_TEST_CASE
   so that user can add other simple testcases without having to manage 
   the init routine manually. It's still not clear which is the lesser
   of the two evils: bolierplate here, or init routine management.
   It may become more clear with further study of boost test, or with
   experience in this style of unit testing.
*/
We wrap the call to test->add inside of a BOOST_AUTO_TEST_CASE
so that user can add other simple testcases without having to manage
the init routine manually. It's still not clear which is the lesser
of the two evils: bolierplate here, or init routine management.
It may become more clear with further study of boost test, or with
experience in this style of unit testing.
We wrap the call to test - > add inside of a BOOST_AUTO_TEST_CASE so that user can add other simple testcases without having to manage the init routine manually . It ' s still not clear which is the lesser of the two evils : bolierplate here or init routine management . It may become more clear with further study of boost test or with experience in this style of unit testing .
BOOST_AUTO_TEST_CASE(test_erase_ifs)
{
    namespace ut=boost::unit_test;
    boost::onullstream    null_output;
    ut::unit_test_log.set_stream(null_output);
    ut::test_suite* test = BOOST_TEST_SUITE("");
    typedef boost::mpl::list< 
                    std::vector<int>, 
                    std::list<int>, 
                    std::set<int>,
                    std::deque<int>,
                    std::multiset<int>
            > test_types;
    typedef boost::mpl::list< 
                    std::map<int, int>, 
                    std::multimap<int, int>
            > test_key_value_types;
    test->add(BOOST_TEST_CASE_TEMPLATE(test_erase_if, test_types));
    test->add(BOOST_TEST_CASE_TEMPLATE(test_key_value_erase_if, test_key_value_types));
    ut::framework::run(test);
    ut::test_results const& tr = ut::results_collector.results(test->p_id);
    ut::unit_test_log.set_stream(std::cout);
    BOOST_CHECK_EQUAL(tr.p_assertions_failed, (std::size_t)0);
    BOOST_CHECK(!tr.p_aborted);
}
BOOST_AUTO_TEST_CASE ( test_erase_ifs ) { namespace ut = boost :: unit_test ; boost :: onullstream null_output ; ut :: unit_test_log . set_stream ( null_output ) ; ut :: test_suite * test = BOOST_TEST_SUITE ( " " ) ; typedef boost :: mpl :: list < std :: vector < int > , std :: list < int > , std :: set < int > , std :: deque < int > , std :: multiset < int > > test_types ; typedef boost :: mpl :: list < std :: map < int , int > , std :: multimap < int , int > > test_key_value_types ; test -> add ( BOOST_TEST_CASE_TEMPLATE ( test_erase_if , test_types ) ) ; test -> add ( BOOST_TEST_CASE_TEMPLATE ( test_key_value_erase_if , test_key_value_types ) ) ; ut :: framework :: run ( test ) ; ut :: test_results const & tr = ut :: results_collector . results ( test -> p_id ) ; ut :: unit_test_log . set_stream ( std :: cout ) ; BOOST_CHECK_EQUAL ( tr . p_assertions_failed , ( std :: size_t ) 0 ) ; BOOST_CHECK ( ! tr . p_aborted ) ; }
We wrap the call to test->add inside of a BOOST_AUTO_TEST_CASE
so that user can add other simple testcases without having to manage
the init routine manually.
We wrap the call to test - > add inside of a BOOST_AUTO_TEST_CASE so that user can add other simple testcases without having to manage the init routine manually .
//BOILERPLATE //END BOILERPLATE // CUSTOM CODE // END CUSTOM CODE //BOILERPLATE //END BOILERPLATE