Subject: Re: [boost] Testing macros..
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2010-05-24 07:13:50
Rene Rivera wrote:
> Once upon a time I did a bunch of work towards a Boost Predef
> The goal was to have a consistent set of version and feature
> as could be determined from the predefined macros of toolsets
> <https://svn.boost.org/svn/boost/sandbox/predef/>. But the
> work stalled
> for one basic reason.. How do I write tests for such a
> library? The only
> other library that approaches the domain of this one is Boost Config
> and, AFAICT, it doesn't test the macros themselves.
First, this looks very nice.
Second, BOOST_VERSION_NUMBER(0,0,1) is an awfully verbose way to write 1, don't you think?
Third, the only way to test this I can think of is to write tests that, effectively, repeat the preprocessor work done in the configuration files, but written in a less factored way and with static assertions to verify expected values. The special cases don't seem to allow for anything automatic. For example,
# if _MSC_VER == 1400
BOOST_STATIC_ASSERT(BOOST_CXX_MSVC/100000 == 800);
# elif _MSC_VER == 1510
BOOST_STATIC_ASSERT(BOOST_CXX_MSVC/100000 == 910);
# elif ...
(I glossed over the BOOST_CXX_MSVC_BUILD values just for simplicity.)
A test file for each compiler would avoid introducing too much noise in any given file, I should think.
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP http://www.sig.com
IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk