Boost logo

Boost Users :

Subject: Re: [Boost-users] nested template tests using boost.test BOOST_AUTO_TEST_CASE_TEMPLATE
From: johanngoetz (jgoetz_at_[hidden])
Date: 2008-10-18 00:02:37


I couldn't find linear_view anywhere in boost. Is this from an older version
of mpl? I am using boost's current svn trunk source. Anyways, looking deeper
into mpl I managed to do what I wanted with something like the following. If
anyone has a better way, please let me know. As a side note, I am starting
to understand some of the power associated with the mpl library.

#define BOOST_TEST_MODULE std_map
#define BOOST_TEST_DYN_LINK
#include <map>
#include <boost/test/unit_test.hpp>
#include <boost/test/test_case_template.hpp>
#include <boost/mpl/list.hpp>
#include <boost/mpl/map.hpp>
namespace mpl = boost::mpl;
typedef mpl::list<
        mpl::pair<short, float>,
        mpl::pair<short, double>,
        mpl::pair<short, long double>,
        mpl::pair<int, float>,
        mpl::pair<int, double>,
        mpl::pair<int, long double>
> test_int_float_types;

BOOST_AUTO_TEST_SUITE( std_map_suite )
BOOST_AUTO_TEST_CASE_TEMPLATE( int_template_case, TT, test_int_float_types )
{
        std::map<typename TT::first, typename TT::second> m;
        m.insert(std::make_pair((typename TT::first)0,(typename TT::second)0));
        BOOST_CHECK_EQUAL(m.size(), size_t(1));
}
BOOST_AUTO_TEST_SUITE_END()

-- 
View this message in context: http://www.nabble.com/nested-template-tests-using-boost.test-BOOST_AUTO_TEST_CASE_TEMPLATE-tp20036811p20044014.html
Sent from the Boost - Users mailing list archive at Nabble.com.

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