Boost logo

Boost :

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
> library.
> The goal was to have a consistent set of version and feature
> definitions
> as could be determined from the predefined macros of toolsets
> <>. 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,

#ifdef _MSC_VER
# if _MSC_VER == 1400
# elif _MSC_VER == 1510
# elif ...
# endif

(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

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, gregod at, cpdaniel at, john at