Boost logo

Boost :

From: Daryle Walker (darylew_at_[hidden])
Date: 2001-07-09 22:59:34


The BOOST_ROOT/boost/test/test_tools.hpp file gives me warnings about no
prototypes on my compiler (Metrowerks CodeWarrior Pro 5.3/Mac). I know my
compiler is old and (I guess) a lot of other compilers don't complain about
this, but I recall from being a wee lad in college (9 years ago) that people
liked the introduction of prototypes that C++ made (and was copied to C).
Now no one seems to like them besides me. I've attached a "test_tools.hpp"
file with the items rearranged to avoid prototype warnings. It also
expresses BOOST_TEST in terms of BOOST_ERROR, since there's some
commonality. Could we give it a try?

-- 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com

// test tools header -------------------------------------------------------//

// (C) Copyright Beman Dawes 2000. Permission to copy, use, modify, sell
// and distribute this software is granted provided this copyright notice
// appears in all copies. This software is provided "as is" without express or
// implied warranty, and with no claim as to its suitability for any purpose.

// See http://www.boost.org for updates, documentation, and revision history.

// Revision History
// 9 Jul 01 Rearrangements to avoid potential warnings. (Daryle Walker)
// 26 Feb 01 Numerous changes suggested during formal review. (Beman)
// 7 Feb 01 #include <boost/test/test_main.cpp> if requested. (Beman)
// 22 Jan 01 Remove all header dependencies. (Beman)
// 3 Dec 00 Remove function definitions. (Ed Brey)
// 5 Nov 00 Initial boost version (Beman Dawes)

#ifndef BOOST_TEST_TOOLS_HPP
#define BOOST_TEST_TOOLS_HPP

// Header dependencies eliminated to reduce coupling.


namespace boost
{
  // Function implementations are not inline because it is better design to
  // decouple implementation, and because space is more important than speed
  // since error functions get called relatively infrequently. Note that
  // separating implementation means that this header could be useful
  // without using the boost/test_main.cpp header for a main() function,
  // and/or a different implementation could be supplied at link time.

  void report_error( const char * msg, const char * file, int line );
  // Effects: increment test_tools_error counter, write error message to cout.

  void report_critical_error( const char * msg, const char * file, int line );
  // Effects: report_error(msg,file,line), throw test_tools_exception.
}


// Macros (gasp!) ease use of reporting functions

#define BOOST_ERROR(msg) ::boost::report_error((msg),__FILE__,__LINE__)
// Effects: call report_error().

#define BOOST_CRITICAL_ERROR(msg) ::boost::report_critical_error((msg),__FILE__,__LINE__)
// Effects: call report_critical_error().

#define BOOST_TEST(exp) ((exp) ? static_cast<void>(0) : BOOST_ERROR(#exp))
// Effects: if (!exp) call report_error().

#define BOOST_CRITICAL_TEST(exp) ((exp) ? static_cast<void>(0) : BOOST_CRITICAL_ERROR(#exp))
// Effects: if (!exp) call report_critical_error().


// For convenience, allow the user to request inclusion of lower-level layers
#ifdef BOOST_INCLUDE_MAIN
#include <boost/test/cpp_main.cpp>
#include <boost/test/test_main.cpp>
#endif


#endif // BOOST_TEST_TOOLS_HPP


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk