Squashed 'third_party/boostorg/assert/' content from commit 4bd93cd
Change-Id: I7f6cb35310fc8236af3a608fd27ff62c3817fdb9
git-subtree-dir: third_party/boostorg/assert
git-subtree-split: 4bd93cd4141b5d48e090495551e3bce931321f62
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..3e84d7c
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,96 @@
+* text=auto !eol svneol=native#text/plain
+*.gitattributes text svneol=native#text/plain
+
+# Scriptish formats
+*.bat text svneol=native#text/plain
+*.bsh text svneol=native#text/x-beanshell
+*.cgi text svneol=native#text/plain
+*.cmd text svneol=native#text/plain
+*.js text svneol=native#text/javascript
+*.php text svneol=native#text/x-php
+*.pl text svneol=native#text/x-perl
+*.pm text svneol=native#text/x-perl
+*.py text svneol=native#text/x-python
+*.sh eol=lf svneol=LF#text/x-sh
+configure eol=lf svneol=LF#text/x-sh
+
+# Image formats
+*.bmp binary svneol=unset#image/bmp
+*.gif binary svneol=unset#image/gif
+*.ico binary svneol=unset#image/ico
+*.jpeg binary svneol=unset#image/jpeg
+*.jpg binary svneol=unset#image/jpeg
+*.png binary svneol=unset#image/png
+*.tif binary svneol=unset#image/tiff
+*.tiff binary svneol=unset#image/tiff
+*.svg text svneol=native#image/svg%2Bxml
+
+# Data formats
+*.pdf binary svneol=unset#application/pdf
+*.avi binary svneol=unset#video/avi
+*.doc binary svneol=unset#application/msword
+*.dsp text svneol=crlf#text/plain
+*.dsw text svneol=crlf#text/plain
+*.eps binary svneol=unset#application/postscript
+*.gz binary svneol=unset#application/gzip
+*.mov binary svneol=unset#video/quicktime
+*.mp3 binary svneol=unset#audio/mpeg
+*.ppt binary svneol=unset#application/vnd.ms-powerpoint
+*.ps binary svneol=unset#application/postscript
+*.psd binary svneol=unset#application/photoshop
+*.rdf binary svneol=unset#text/rdf
+*.rss text svneol=unset#text/xml
+*.rtf binary svneol=unset#text/rtf
+*.sln text svneol=native#text/plain
+*.swf binary svneol=unset#application/x-shockwave-flash
+*.tgz binary svneol=unset#application/gzip
+*.vcproj text svneol=native#text/xml
+*.vcxproj text svneol=native#text/xml
+*.vsprops text svneol=native#text/xml
+*.wav binary svneol=unset#audio/wav
+*.xls binary svneol=unset#application/vnd.ms-excel
+*.zip binary svneol=unset#application/zip
+
+# Text formats
+.htaccess text svneol=native#text/plain
+*.bbk text svneol=native#text/xml
+*.cmake text svneol=native#text/plain
+*.css text svneol=native#text/css
+*.dtd text svneol=native#text/xml
+*.htm text svneol=native#text/html
+*.html text svneol=native#text/html
+*.ini text svneol=native#text/plain
+*.log text svneol=native#text/plain
+*.mak text svneol=native#text/plain
+*.qbk text svneol=native#text/plain
+*.rst text svneol=native#text/plain
+*.sql text svneol=native#text/x-sql
+*.txt text svneol=native#text/plain
+*.xhtml text svneol=native#text/xhtml%2Bxml
+*.xml text svneol=native#text/xml
+*.xsd text svneol=native#text/xml
+*.xsl text svneol=native#text/xml
+*.xslt text svneol=native#text/xml
+*.xul text svneol=native#text/xul
+*.yml text svneol=native#text/plain
+boost-no-inspect text svneol=native#text/plain
+CHANGES text svneol=native#text/plain
+COPYING text svneol=native#text/plain
+INSTALL text svneol=native#text/plain
+Jamfile text svneol=native#text/plain
+Jamroot text svneol=native#text/plain
+Jamfile.v2 text svneol=native#text/plain
+Jamrules text svneol=native#text/plain
+Makefile* text svneol=native#text/plain
+README text svneol=native#text/plain
+TODO text svneol=native#text/plain
+
+# Code formats
+*.c text svneol=native#text/plain
+*.cpp text svneol=native#text/plain
+*.h text svneol=native#text/plain
+*.hpp text svneol=native#text/plain
+*.ipp text svneol=native#text/plain
+*.tpp text svneol=native#text/plain
+*.jam text svneol=native#text/plain
+*.java text svneol=native#text/plain
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..2b1e13f
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,54 @@
+# Copyright 2016, 2017 Peter Dimov
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
+
+language: cpp
+
+sudo: false
+
+branches:
+ only:
+ - master
+ - develop
+ - /feature\/.*/
+
+env:
+ matrix:
+ - BOGUS_JOB=true
+
+matrix:
+
+ exclude:
+ - env: BOGUS_JOB=true
+
+ include:
+ - os: linux
+ compiler: g++
+ env: TOOLSET=gcc CXXSTD=03,11
+
+ - os: linux
+ compiler: clang++
+ env: TOOLSET=clang CXXSTD=03,11,14,1z
+
+ - os: osx
+ compiler: clang++
+ env: TOOLSET=clang CXXSTD=03,11,14,1z
+
+install:
+ - BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
+ - cd ..
+ - git clone -b $BOOST_BRANCH https://github.com/boostorg/boost.git boost-root
+ - cd boost-root
+ - git submodule update --init tools/build
+ - git submodule update --init libs/config
+ - git submodule update --init libs/core
+ - cp -r $TRAVIS_BUILD_DIR/* libs/assert
+ - ./bootstrap.sh
+ - ./b2 headers
+
+script:
+ - ./b2 libs/assert/test toolset=$TOOLSET cxxstd=$CXXSTD
+
+notifications:
+ email:
+ on_success: always
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..645b7bb
--- /dev/null
+++ b/README.md
@@ -0,0 +1,14 @@
+# Boost.Assert
+
+The Boost.Assert library, part of the collection of [Boost C++ Libraries](http://github.com/boostorg),
+provides several configurable diagnostic macros similar in behavior and purpose to the standard macro
+`assert` from `<cassert>`.
+
+## Documentation
+
+See the documentation of [BOOST_ASSERT](doc/assert.adoc) and
+[BOOST_CURRENT_FUNCTION](doc/current_function.adoc) for more information.
+
+## License
+
+Distributed under the [Boost Software License, Version 1.0](http://boost.org/LICENSE_1_0.txt).
diff --git a/appveyor.yml b/appveyor.yml
new file mode 100644
index 0000000..5a75678
--- /dev/null
+++ b/appveyor.yml
@@ -0,0 +1,29 @@
+# Copyright 2016 Peter Dimov
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
+
+version: 1.0.{build}-{branch}
+
+shallow_clone: true
+
+branches:
+ only:
+ - master
+ - develop
+
+install:
+ - cd ..
+ - git clone -b %APPVEYOR_REPO_BRANCH% https://github.com/boostorg/boost.git boost-root
+ - cd boost-root
+ - git submodule init libs/config
+ - git submodule init libs/core
+ - git submodule init tools/build
+ - git submodule update
+ - xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\assert
+ - bootstrap
+ - b2 headers
+
+build: off
+
+test_script:
+ - b2 libs/assert/test toolset=msvc-9.0,msvc-10.0,msvc-11.0,msvc-14.0
diff --git a/doc/.gitignore b/doc/.gitignore
new file mode 100644
index 0000000..0972e2d
--- /dev/null
+++ b/doc/.gitignore
@@ -0,0 +1,2 @@
+/html/
+/pdf/
diff --git a/doc/Jamfile b/doc/Jamfile
new file mode 100644
index 0000000..d4a4802
--- /dev/null
+++ b/doc/Jamfile
@@ -0,0 +1,29 @@
+# Copyright 2017 Peter Dimov
+#
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+project doc/assert ;
+
+import asciidoctor ;
+# import boostbook ;
+
+html assert.html : index.adoc ;
+
+# docbook assert.docbook : index.adoc ;
+# boostbook assert.html : assert.docbook : <format>onehtml ;
+
+install html_ : assert.html : <location>html ;
+
+pdf assert.pdf : index.adoc ;
+explicit assert.pdf ;
+
+install pdf_ : assert.pdf : <location>pdf ;
+explicit pdf_ ;
+
+###############################################################################
+alias boostdoc ;
+explicit boostdoc ;
+alias boostrelease : html_ ;
+explicit boostrelease ;
diff --git a/doc/assert.adoc b/doc/assert.adoc
new file mode 100644
index 0000000..5a7347c
--- /dev/null
+++ b/doc/assert.adoc
@@ -0,0 +1,165 @@
+////
+Copyright 2002, 2007, 2014, 2017 Peter Dimov
+Copyright 2011 Beman Dawes
+Copyright 2015 Ion Gaztañaga
+
+Distributed under the Boost Software License, Version 1.0.
+
+See accompanying file LICENSE_1_0.txt or copy at
+http://www.boost.org/LICENSE_1_0.txt
+////
+
+# Assertion Macros, <boost/assert.hpp>
+:toc:
+:toc-title:
+:idprefix:
+
+## BOOST_ASSERT
+
+The header `<boost/assert.hpp>` defines the macro `BOOST_ASSERT`,
+which is similar to the standard `assert` macro defined in `<cassert>`.
+The macro is intended to be used in both Boost libraries and user
+code.
+
+* By default, `BOOST_ASSERT(expr)` expands to `assert(expr)`.
+
+* If the macro `BOOST_DISABLE_ASSERTS` is defined when `<boost/assert.hpp>`
+ is included, `BOOST_ASSERT(expr)` expands to `((void)0)`, regardless of whether
+ the macro `NDEBUG` is defined. This allows users to selectively disable `BOOST_ASSERT` without
+ affecting the definition of the standard `assert`.
+
+* If the macro `BOOST_ENABLE_ASSERT_HANDLER` is defined when `<boost/assert.hpp>`
+is included, `BOOST_ASSERT(expr)` expands to
++
+```
+(BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed(#expr,
+ BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
+```
++
+That is, it evaluates `expr` and if it's false, calls
+`::boost::assertion_failed(#expr, <<current_function.adoc#boost_current_function,BOOST_CURRENT_FUNCTION>>, \\__FILE__, \\__LINE__)`.
+This is true regardless of whether `NDEBUG` is defined.
++
+`boost::assertion_failed` is declared in `<boost/assert.hpp>` as
++
+```
+namespace boost
+{
+ void assertion_failed(char const * expr, char const * function,
+ char const * file, long line);
+}
+```
++
+but it is never defined. The user is expected to supply an appropriate definition.
+
+* If the macro `BOOST_ENABLE_ASSERT_DEBUG_HANDLER` is defined when `<boost/assert.hpp>`
+is included, `BOOST_ASSERT(expr)` expands to `((void)0)` when `NDEBUG` is
+defined. Otherwise the behavior is as if `BOOST_ENABLE_ASSERT_HANDLER` has been defined.
+
+As is the case with `<cassert>`, `<boost/assert.hpp>`
+can be included multiple times in a single translation unit. `BOOST_ASSERT`
+will be redefined each time as specified above.
+
+## BOOST_ASSERT_MSG
+
+The macro `BOOST_ASSERT_MSG` is similar to `BOOST_ASSERT`, but it takes an additional argument,
+a character literal, supplying an error message.
+
+* By default, `BOOST_ASSERT_MSG(expr,msg)` expands to `assert\((expr)&&(msg))`.
+
+* If the macro `BOOST_DISABLE_ASSERTS` is defined when `<boost/assert.hpp>`
+is included, `BOOST_ASSERT_MSG(expr,msg)` expands to `((void)0)`, regardless of whether
+the macro `NDEBUG` is defined.
+
+* If the macro `BOOST_ENABLE_ASSERT_HANDLER` is defined when `<boost/assert.hpp>`
+is included, `BOOST_ASSERT_MSG(expr,msg)` expands to
++
+```
+(BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed_msg(#expr,
+ msg, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
+```
++
+This is true regardless of whether `NDEBUG` is defined.
++
+`boost::assertion_failed_msg` is declared in `<boost/assert.hpp>` as
++
+```
+namespace boost
+{
+ void assertion_failed_msg(char const * expr, char const * msg,
+ char const * function, char const * file, long line);
+}
+```
++
+but it is never defined. The user is expected to supply an appropriate definition.
+
+* If the macro `BOOST_ENABLE_ASSERT_DEBUG_HANDLER` is defined when `<boost/assert.hpp>`
+is included, `BOOST_ASSERT_MSG(expr)` expands to `((void)0)` when `NDEBUG` is
+defined. Otherwise the behavior is as if `BOOST_ENABLE_ASSERT_HANDLER` has been defined.
+
+As is the case with `<cassert>`, `<boost/assert.hpp>`
+can be included multiple times in a single translation unit. `BOOST_ASSERT_MSG`
+will be redefined each time as specified above.
+
+## BOOST_VERIFY
+
+The macro `BOOST_VERIFY` has the same behavior as `BOOST_ASSERT`, except that
+the expression that is passed to `BOOST_VERIFY` is always
+evaluated. This is useful when the asserted expression has desirable side
+effects; it can also help suppress warnings about unused variables when the
+only use of the variable is inside an assertion.
+
+* If the macro `BOOST_DISABLE_ASSERTS` is defined when `<boost/assert.hpp>`
+ is included, `BOOST_VERIFY(expr)` expands to `\((void)(expr))`.
+
+* If the macro `BOOST_ENABLE_ASSERT_HANDLER` is defined when `<boost/assert.hpp>`
+ is included, `BOOST_VERIFY(expr)` expands to `BOOST_ASSERT(expr)`.
+
+* Otherwise, `BOOST_VERIFY(expr)` expands to `\((void)(expr))` when `NDEBUG` is
+ defined, to `BOOST_ASSERT(expr)` when it's not.
+
+## BOOST_VERIFY_MSG
+
+The macro `BOOST_VERIFY_MSG` is similar to `BOOST_VERIFY`, with an additional parameter, an error message.
+
+* If the macro `BOOST_DISABLE_ASSERTS` is defined when `<boost/assert.hpp>`
+ is included, `BOOST_VERIFY_MSG(expr,msg)` expands to `\((void)(expr))`.
+
+* If the macro `BOOST_ENABLE_ASSERT_HANDLER` is defined when `<boost/assert.hpp>`
+ is included, `BOOST_VERIFY_MSG(expr,msg)` expands to `BOOST_ASSERT_MSG(expr,msg)`.
+
+* Otherwise, `BOOST_VERIFY_MSG(expr,msg)` expands to `\((void)(expr))` when `NDEBUG` is
+ defined, to `BOOST_ASSERT_MSG(expr,msg)` when it's not.
+
+## BOOST_ASSERT_IS_VOID
+
+The macro `BOOST_ASSERT_IS_VOID` is defined when `BOOST_ASSERT` and `BOOST_ASSERT_MSG` are expanded to `((void)0)`.
+Its purpose is to avoid compiling and potentially running code that is only intended to prepare data to be used in the assertion.
+
+```
+void MyContainer::erase(iterator i)
+{
+// Some sanity checks, data must be ordered
+#ifndef BOOST_ASSERT_IS_VOID
+
+ if(i != c.begin()) {
+ iterator prev = i;
+ --prev;
+ BOOST_ASSERT(*prev < *i);
+ }
+ else if(i != c.end()) {
+ iterator next = i;
+ ++next;
+ BOOST_ASSERT(*i < *next);
+ }
+
+#endif
+
+ this->erase_impl(i);
+}
+```
+
+* By default, `BOOST_ASSERT_IS_VOID` is defined if `NDEBUG` is defined.
+* If the macro `BOOST_DISABLE_ASSERTS` is defined, `BOOST_ASSERT_IS_VOID` is always defined.
+* If the macro `BOOST_ENABLE_ASSERT_HANDLER` is defined, `BOOST_ASSERT_IS_VOID` is never defined.
+* If the macro `BOOST_ENABLE_ASSERT_DEBUG_HANDLER` is defined, then `BOOST_ASSERT_IS_VOID` is defined when `NDEBUG` is defined.
diff --git a/doc/current_function.adoc b/doc/current_function.adoc
new file mode 100644
index 0000000..9235c1a
--- /dev/null
+++ b/doc/current_function.adoc
@@ -0,0 +1,30 @@
+////
+Copyright 2002, 2017 Peter Dimov
+
+Distributed under the Boost Software License, Version 1.0.
+
+See accompanying file LICENSE_1_0.txt or copy at
+http://www.boost.org/LICENSE_1_0.txt
+////
+
+# Current Function Macro, <boost/current_function.hpp>
+:toc:
+:toc-title:
+:idprefix:
+
+## BOOST_CURRENT_FUNCTION
+
+The header `<boost/current_function.hpp>` defines a single macro, `BOOST_CURRENT_FUNCTION`,
+similar to the C99 predefined identifier `\\__func__`.
+
+`BOOST_CURRENT_FUNCTION` expands to a string literal containing
+the (fully qualified, if possible) name of the enclosing function. If there is
+no enclosing function, the behavior is unspecified.
+
+Some compilers do not provide a way to obtain the name of the current enclosing
+function. On such compilers, or when the macro `BOOST_DISABLE_CURRENT_FUNCTION`
+is defined, `BOOST_CURRENT_FUNCTION` expands to `"(unknown)"`.
+
+`BOOST_DISABLE_CURRENT_FUNCTION` addresses a use case in which the programmer
+wishes to eliminate the string literals produced by `BOOST_CURRENT_FUNCTION` from
+the final executable for security reasons.
diff --git a/doc/index-docinfo-footer.html b/doc/index-docinfo-footer.html
new file mode 100644
index 0000000..b27346f
--- /dev/null
+++ b/doc/index-docinfo-footer.html
@@ -0,0 +1,5 @@
+<style>
+
+*:not(pre)>code { background: none; color: #600000; }
+
+</style>
diff --git a/doc/index.adoc b/doc/index.adoc
new file mode 100644
index 0000000..6e5026e
--- /dev/null
+++ b/doc/index.adoc
@@ -0,0 +1,35 @@
+////
+Copyright 2017 Peter Dimov
+
+Distributed under the Boost Software License, Version 1.0.
+
+See accompanying file LICENSE_1_0.txt or copy at
+http://www.boost.org/LICENSE_1_0.txt
+////
+
+# Boost.Assert
+Peter Dimov
+:toc: left
+:idprefix:
+:docinfo: private-footer
+
+The Boost.Assert library provides several configurable diagnostic macros
+similar in behavior and purpose to the standard macro `assert` from `<cassert>`.
+
+:leveloffset: +1
+
+include::assert.adoc[]
+
+include::current_function.adoc[]
+
+:leveloffset: -1
+
+[appendix]
+## Copyright and License
+
+This documentation is
+
+* Copyright 2002, 2007, 2014, 2017 Peter Dimov
+* Copyright 2011 Beman Dawes
+* Copyright 2015 Ion Gaztañaga
+* Distributed under the http://www.boost.org/LICENSE_1_0.txt[Boost Software License, Version 1.0].
diff --git a/include/boost/assert.hpp b/include/boost/assert.hpp
new file mode 100644
index 0000000..9650d7a
--- /dev/null
+++ b/include/boost/assert.hpp
@@ -0,0 +1,85 @@
+//
+// boost/assert.hpp - BOOST_ASSERT(expr)
+// BOOST_ASSERT_MSG(expr, msg)
+// BOOST_VERIFY(expr)
+// BOOST_VERIFY_MSG(expr, msg)
+// BOOST_ASSERT_IS_VOID
+//
+// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
+// Copyright (c) 2007, 2014 Peter Dimov
+// Copyright (c) Beman Dawes 2011
+// Copyright (c) 2015 Ion Gaztanaga
+//
+// Distributed under the Boost Software License, Version 1.0.
+// See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt
+//
+// Note: There are no include guards. This is intentional.
+//
+// See http://www.boost.org/libs/assert/assert.html for documentation.
+//
+
+//
+// Stop inspect complaining about use of 'assert':
+//
+// boostinspect:naassert_macro
+//
+
+//
+// BOOST_ASSERT, BOOST_ASSERT_MSG, BOOST_ASSERT_IS_VOID
+//
+
+#undef BOOST_ASSERT
+#undef BOOST_ASSERT_MSG
+#undef BOOST_ASSERT_IS_VOID
+
+#if defined(BOOST_DISABLE_ASSERTS) || ( defined(BOOST_ENABLE_ASSERT_DEBUG_HANDLER) && defined(NDEBUG) )
+
+# define BOOST_ASSERT(expr) ((void)0)
+# define BOOST_ASSERT_MSG(expr, msg) ((void)0)
+# define BOOST_ASSERT_IS_VOID
+
+#elif defined(BOOST_ENABLE_ASSERT_HANDLER) || ( defined(BOOST_ENABLE_ASSERT_DEBUG_HANDLER) && !defined(NDEBUG) )
+
+#include <boost/config.hpp> // for BOOST_LIKELY
+#include <boost/current_function.hpp>
+
+namespace boost
+{
+ void assertion_failed(char const * expr, char const * function, char const * file, long line); // user defined
+ void assertion_failed_msg(char const * expr, char const * msg, char const * function, char const * file, long line); // user defined
+} // namespace boost
+
+#define BOOST_ASSERT(expr) (BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
+#define BOOST_ASSERT_MSG(expr, msg) (BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed_msg(#expr, msg, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
+
+#else
+
+# include <assert.h> // .h to support old libraries w/o <cassert> - effect is the same
+
+# define BOOST_ASSERT(expr) assert(expr)
+# define BOOST_ASSERT_MSG(expr, msg) assert((expr)&&(msg))
+#if defined(NDEBUG)
+# define BOOST_ASSERT_IS_VOID
+#endif
+
+#endif
+
+//
+// BOOST_VERIFY, BOOST_VERIFY_MSG
+//
+
+#undef BOOST_VERIFY
+#undef BOOST_VERIFY_MSG
+
+#if defined(BOOST_DISABLE_ASSERTS) || ( !defined(BOOST_ENABLE_ASSERT_HANDLER) && defined(NDEBUG) )
+
+# define BOOST_VERIFY(expr) ((void)(expr))
+# define BOOST_VERIFY_MSG(expr, msg) ((void)(expr))
+
+#else
+
+# define BOOST_VERIFY(expr) BOOST_ASSERT(expr)
+# define BOOST_VERIFY_MSG(expr, msg) BOOST_ASSERT_MSG(expr,msg)
+
+#endif
diff --git a/include/boost/current_function.hpp b/include/boost/current_function.hpp
new file mode 100644
index 0000000..86955cb
--- /dev/null
+++ b/include/boost/current_function.hpp
@@ -0,0 +1,75 @@
+#ifndef BOOST_CURRENT_FUNCTION_HPP_INCLUDED
+#define BOOST_CURRENT_FUNCTION_HPP_INCLUDED
+
+// MS compatible compilers support #pragma once
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+//
+// boost/current_function.hpp - BOOST_CURRENT_FUNCTION
+//
+// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
+//
+// Distributed under the Boost Software License, Version 1.0.
+// See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt
+//
+// http://www.boost.org/libs/assert/current_function.html
+//
+
+namespace boost
+{
+
+namespace detail
+{
+
+inline void current_function_helper()
+{
+
+#if defined( BOOST_DISABLE_CURRENT_FUNCTION )
+
+# define BOOST_CURRENT_FUNCTION "(unknown)"
+
+#elif defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) || (defined(__ICC) && (__ICC >= 600)) || defined(__ghs__)
+
+# define BOOST_CURRENT_FUNCTION __PRETTY_FUNCTION__
+
+#elif defined(__DMC__) && (__DMC__ >= 0x810)
+
+# define BOOST_CURRENT_FUNCTION __PRETTY_FUNCTION__
+
+#elif defined(__FUNCSIG__)
+
+# define BOOST_CURRENT_FUNCTION __FUNCSIG__
+
+#elif (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 600)) || (defined(__IBMCPP__) && (__IBMCPP__ >= 500))
+
+# define BOOST_CURRENT_FUNCTION __FUNCTION__
+
+#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x550)
+
+# define BOOST_CURRENT_FUNCTION __FUNC__
+
+#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)
+
+# define BOOST_CURRENT_FUNCTION __func__
+
+#elif defined(__cplusplus) && (__cplusplus >= 201103)
+
+# define BOOST_CURRENT_FUNCTION __func__
+
+#else
+
+# define BOOST_CURRENT_FUNCTION "(unknown)"
+
+#endif
+
+}
+
+} // namespace detail
+
+} // namespace boost
+
+#endif // #ifndef BOOST_CURRENT_FUNCTION_HPP_INCLUDED
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..a3c843e
--- /dev/null
+++ b/index.html
@@ -0,0 +1,15 @@
+<html>
+<head>
+<meta http-equiv="refresh" content="0; URL=doc/html/assert.html">
+</head>
+<body>
+Automatic redirection failed, please go to
+<a href="doc/html/assert.html">doc/html/assert.html</a>.
+</body>
+</html>
+<!--
+ © Copyright Beman Dawes, 2001
+ Distributed under the Boost Software License, Version 1.0.
+ See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt
+-->
diff --git a/meta/libraries.json b/meta/libraries.json
new file mode 100644
index 0000000..8337796
--- /dev/null
+++ b/meta/libraries.json
@@ -0,0 +1,14 @@
+{
+ "key": "assert",
+ "name": "Assert",
+ "authors": [
+ "Peter Dimov"
+ ],
+ "maintainers": [
+ "Peter Dimov <pdimov -at- pdimov.com>"
+ ],
+ "description": "Customizable assert macros.",
+ "category": [
+ "Correctness"
+ ]
+}
diff --git a/test/Jamfile.v2 b/test/Jamfile.v2
new file mode 100644
index 0000000..0b46665
--- /dev/null
+++ b/test/Jamfile.v2
@@ -0,0 +1,26 @@
+# Boost.Assert Library test Jamfile
+#
+# Copyright (c) 2014, 2017 Peter Dimov
+#
+# Distributed under the Boost Software License, Version 1.0.
+# See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt
+
+# bring in rules for testing
+import testing ;
+
+run assert_test.cpp ;
+run current_function_test.cpp : : : <test-info>always_show_run_output ;
+run verify_test.cpp ;
+run assert_is_void_test.cpp ;
+
+# expansion tests are in exp/ so that there is a backslash in the path on Windows
+run exp/assert_exp_test.cpp ;
+run exp/assert_msg_exp_test.cpp ;
+run exp/verify_exp_test.cpp ;
+run exp/verify_msg_exp_test.cpp ;
+run assert_test2.cpp ;
+run assert_msg_test2.cpp ;
+
+# quick test (for CI)
+run quick.cpp ;
diff --git a/test/assert_is_void_test.cpp b/test/assert_is_void_test.cpp
new file mode 100644
index 0000000..5e64a68
--- /dev/null
+++ b/test/assert_is_void_test.cpp
@@ -0,0 +1,108 @@
+//
+// assert_is_void_test.cpp - tests BOOST_ASSERT_IS_VOID
+//
+// Copyright (c) 2015 Ion Gaztanaga
+//
+// Distributed under the Boost Software License, Version 1.0.
+// See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt
+//
+
+#include <boost/config.hpp>
+
+// default case, !NDEBUG
+// BOOST_ASSERT(x) -> assert(x)
+
+#undef NDEBUG
+#include <boost/assert.hpp>
+
+#ifdef BOOST_ASSERT_IS_VOID
+#error "BOOST_ASSERT should NOT be void if NDEBUG is not defined"
+#endif
+
+// default case, NDEBUG
+// BOOST_ASSERT(x) -> assert(x)
+
+#define NDEBUG
+#include <boost/assert.hpp>
+
+#ifndef BOOST_ASSERT_IS_VOID
+#error "Error: BOOST_ASSERT should be void in NDEBUG"
+#endif
+
+// BOOST_DISABLE_ASSERTS, !NDEBUG
+// BOOST_ASSERT(x) -> ((void)0)
+
+#define BOOST_DISABLE_ASSERTS
+
+#undef NDEBUG
+#include <boost/assert.hpp>
+
+#ifndef BOOST_ASSERT_IS_VOID
+#error "Error: BOOST_ASSERT should be void with BOOST_DISABLE_ASSERTS"
+#endif
+
+// BOOST_DISABLE_ASSERTS, NDEBUG
+// BOOST_ASSERT(x) -> ((void)0)
+
+#define NDEBUG
+#include <boost/assert.hpp>
+
+#ifndef BOOST_ASSERT_IS_VOID
+#error "Error: BOOST_ASSERT should be void with BOOST_DISABLE_ASSERTS and NDEBUG"
+#endif
+
+#undef BOOST_DISABLE_ASSERTS
+
+// BOOST_ENABLE_ASSERT_HANDLER, !NDEBUG
+// BOOST_ASSERT(expr) -> (BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
+
+#define BOOST_ENABLE_ASSERT_HANDLER
+
+#undef NDEBUG
+#include <boost/assert.hpp>
+
+#ifdef BOOST_ASSERT_IS_VOID
+#error "Error: BOOST_ASSERT should NOT be void with BOOST_ENABLE_ASSERT_HANDLER"
+#endif
+
+// BOOST_ENABLE_ASSERT_HANDLER, NDEBUG
+// BOOST_ASSERT(expr) -> (BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
+
+#define NDEBUG
+#include <boost/assert.hpp>
+
+#ifdef BOOST_ASSERT_IS_VOID
+#error "Error: BOOST_ASSERT should NOT be void with BOOST_ENABLE_ASSERT_HANDLER"
+#endif
+
+#undef BOOST_ENABLE_ASSERT_HANDLER
+
+// BOOST_ENABLE_ASSERT_DEBUG_HANDLER, !NDEBUG
+// same as BOOST_ENABLE_ASSERT_HANDLER
+
+#define BOOST_ENABLE_ASSERT_DEBUG_HANDLER
+
+#undef NDEBUG
+#include <boost/assert.hpp>
+
+#ifdef BOOST_ASSERT_IS_VOID
+#error "Error: BOOST_ASSERT should NOT be void with BOOST_ENABLE_ASSERT_DEBUG_HANDLER and !NDEBUG"
+#endif
+
+// BOOST_ENABLE_ASSERT_DEBUG_HANDLER, NDEBUG
+// BOOST_ASSERT(x) -> ((void)0)
+
+#define NDEBUG
+#include <boost/assert.hpp>
+
+#ifndef BOOST_ASSERT_IS_VOID
+#error "Error: BOOST_ASSERT should be void with BOOST_ENABLE_ASSERT_DEBUG_HANDLER and NDEBUG"
+#endif
+
+#undef BOOST_ENABLE_ASSERT_DEBUG_HANDLER
+
+int main()
+{
+ return 0;
+}
diff --git a/test/assert_msg_test2.cpp b/test/assert_msg_test2.cpp
new file mode 100644
index 0000000..9d8f8da
--- /dev/null
+++ b/test/assert_msg_test2.cpp
@@ -0,0 +1,114 @@
+//
+// assert_msg_test2.cpp - a test for BOOST_ASSERT_MSG and NDEBUG
+//
+// Copyright (c) 2014 Peter Dimov
+//
+// Distributed under the Boost Software License, Version 1.0.
+// See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt
+//
+
+#include <boost/detail/lightweight_test.hpp>
+#include <stdio.h>
+
+// default case, !NDEBUG
+// BOOST_ASSERT_MSG(x) -> assert(x)
+
+#undef NDEBUG
+#include <boost/assert.hpp>
+
+void test_default()
+{
+ int x = 1;
+
+ BOOST_ASSERT_MSG( 1, "msg" );
+ BOOST_ASSERT_MSG( x, "msg" );
+ BOOST_ASSERT_MSG( x == 1, "msg" );
+}
+
+// default case, NDEBUG
+// BOOST_ASSERT_MSG(x) -> assert(x)
+
+#define NDEBUG
+#include <boost/assert.hpp>
+
+void test_default_ndebug()
+{
+ int x = 1;
+
+ BOOST_ASSERT_MSG( 1, "msg" );
+ BOOST_ASSERT_MSG( x, "msg" );
+ BOOST_ASSERT_MSG( x == 1, "msg" );
+
+ BOOST_ASSERT_MSG( 0, "msg" );
+ BOOST_ASSERT_MSG( !x, "msg" );
+ BOOST_ASSERT_MSG( x == 0, "msg" );
+}
+
+// BOOST_ENABLE_ASSERT_DEBUG_HANDLER, !NDEBUG
+// same as BOOST_ENABLE_ASSERT_HANDLER
+
+#define BOOST_ENABLE_ASSERT_DEBUG_HANDLER
+
+#undef NDEBUG
+#include <boost/assert.hpp>
+
+int handler_invoked = 0;
+
+void boost::assertion_failed_msg( char const * expr, char const * msg, char const * function, char const * file, long line )
+{
+ printf( "Expression: %s\nMessage: %s\nFunction: %s\nFile: %s\nLine: %ld\n\n", expr, msg, function, file, line );
+ ++handler_invoked;
+}
+
+void test_debug_handler()
+{
+ handler_invoked = 0;
+
+ int x = 1;
+
+ BOOST_ASSERT_MSG( 1, "msg" );
+ BOOST_ASSERT_MSG( x, "msg" );
+ BOOST_ASSERT_MSG( x == 1, "msg" );
+
+ BOOST_ASSERT_MSG( 0, "msg" );
+ BOOST_ASSERT_MSG( !x, "msg" );
+ BOOST_ASSERT_MSG( x == 0, "msg" );
+
+ BOOST_TEST( handler_invoked == 3 );
+}
+
+// BOOST_ENABLE_ASSERT_DEBUG_HANDLER, NDEBUG
+// BOOST_ASSERT_MSG(x) -> ((void)0)
+
+#define NDEBUG
+#include <boost/assert.hpp>
+
+void test_debug_handler_ndebug()
+{
+ handler_invoked = 0;
+
+ int x = 1;
+
+ BOOST_ASSERT_MSG( 1, "msg" );
+ BOOST_ASSERT_MSG( x, "msg" );
+ BOOST_ASSERT_MSG( x == 1, "msg" );
+
+ BOOST_ASSERT_MSG( 0, "msg" );
+ BOOST_ASSERT_MSG( !x, "msg" );
+ BOOST_ASSERT_MSG( x == 0, "msg" );
+
+ BOOST_TEST( handler_invoked == 0 );
+}
+
+#undef BOOST_ENABLE_ASSERT_DEBUG_HANDLER
+
+int main()
+{
+ test_default();
+ test_default_ndebug();
+ test_debug_handler();
+ test_debug_handler_ndebug();
+
+ return boost::report_errors();
+}
diff --git a/test/assert_test.cpp b/test/assert_test.cpp
new file mode 100644
index 0000000..3233828
--- /dev/null
+++ b/test/assert_test.cpp
@@ -0,0 +1,153 @@
+//
+// assert_test.cpp - a test for boost/assert.hpp
+//
+// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
+// Copyright (2) Beman Dawes 2011
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#include <boost/detail/lightweight_test.hpp>
+
+#include <boost/assert.hpp>
+
+void test_default()
+{
+ int x = 1;
+
+ BOOST_ASSERT(1);
+ BOOST_ASSERT(x);
+ BOOST_ASSERT(x == 1);
+ BOOST_ASSERT(&x);
+
+ BOOST_ASSERT_MSG(1, "msg");
+ BOOST_ASSERT_MSG(x, "msg");
+ BOOST_ASSERT_MSG(x == 1, "msg");
+ BOOST_ASSERT_MSG(&x, "msg");
+}
+
+#define BOOST_DISABLE_ASSERTS
+#include <boost/assert.hpp>
+
+void test_disabled()
+{
+ int x = 1;
+
+ BOOST_ASSERT(1);
+ BOOST_ASSERT(x);
+ BOOST_ASSERT(x == 1);
+ BOOST_ASSERT(&x);
+
+ BOOST_ASSERT_MSG(1, "msg");
+ BOOST_ASSERT_MSG(x, "msg");
+ BOOST_ASSERT_MSG(x == 1, "msg");
+ BOOST_ASSERT_MSG(&x, "msg");
+
+ BOOST_ASSERT(0);
+ BOOST_ASSERT(!x);
+ BOOST_ASSERT(x == 0);
+
+ BOOST_ASSERT_MSG(0, "msg");
+ BOOST_ASSERT_MSG(!x, "msg");
+ BOOST_ASSERT_MSG(x == 0, "msg");
+
+ void * p = 0;
+
+ BOOST_ASSERT(p);
+ BOOST_ASSERT_MSG(p, "msg");
+
+ // suppress warnings
+ p = &x;
+ p = &p;
+}
+
+#undef BOOST_DISABLE_ASSERTS
+
+#define BOOST_ENABLE_ASSERT_HANDLER
+#include <boost/assert.hpp>
+#include <boost/config.hpp>
+#include <cstdio>
+
+int handler_invoked = 0;
+int msg_handler_invoked = 0;
+
+void boost::assertion_failed(char const * expr, char const * function, char const * file, long line)
+{
+#if !defined(BOOST_NO_STDC_NAMESPACE)
+ using std::printf;
+#endif
+
+ printf("Expression: %s\nFunction: %s\nFile: %s\nLine: %ld\n\n", expr, function, file, line);
+ ++handler_invoked;
+}
+
+void boost::assertion_failed_msg(char const * expr, char const * msg, char const * function,
+ char const * file, long line)
+{
+#if !defined(BOOST_NO_STDC_NAMESPACE)
+ using std::printf;
+#endif
+
+ printf("Expression: %s Message: %s\nFunction: %s\nFile: %s\nLine: %ld\n\n",
+ expr, msg, function, file, line);
+ ++msg_handler_invoked;
+}
+
+struct X
+{
+ static void f()
+ {
+ BOOST_ASSERT(0);
+ BOOST_ASSERT_MSG(0, "msg f()");
+ }
+};
+
+void test_handler()
+{
+ int x = 1;
+
+ BOOST_ASSERT(1);
+ BOOST_ASSERT(x);
+ BOOST_ASSERT(x == 1);
+ BOOST_ASSERT(&x);
+
+ BOOST_ASSERT_MSG(1, "msg2");
+ BOOST_ASSERT_MSG(x, "msg3");
+ BOOST_ASSERT_MSG(x == 1, "msg4");
+ BOOST_ASSERT_MSG(&x, "msg5");
+
+ BOOST_ASSERT(0);
+ BOOST_ASSERT(!x);
+ BOOST_ASSERT(x == 0);
+
+ BOOST_ASSERT_MSG(0,"msg 0");
+ BOOST_ASSERT_MSG(!x, "msg !x");
+ BOOST_ASSERT_MSG(x == 0, "msg x == 0");
+
+ void * p = 0;
+
+ BOOST_ASSERT(p);
+ BOOST_ASSERT_MSG(p, "msg p");
+
+ X::f();
+
+ BOOST_ASSERT(handler_invoked == 5);
+ BOOST_TEST(handler_invoked == 5);
+
+ BOOST_ASSERT_MSG(msg_handler_invoked == 5, "msg_handler_invoked count is wrong");
+ BOOST_TEST(msg_handler_invoked == 5);
+}
+
+#undef BOOST_ENABLE_ASSERT_HANDLER
+#undef BOOST_ENABLE_ASSERT_MSG_HANDLER
+
+int main()
+{
+ test_default();
+ test_disabled();
+ test_handler();
+
+ return boost::report_errors();
+}
diff --git a/test/assert_test2.cpp b/test/assert_test2.cpp
new file mode 100644
index 0000000..5a8a37f
--- /dev/null
+++ b/test/assert_test2.cpp
@@ -0,0 +1,114 @@
+//
+// assert_test2.cpp - a test for BOOST_ASSERT and NDEBUG
+//
+// Copyright (c) 2014 Peter Dimov
+//
+// Distributed under the Boost Software License, Version 1.0.
+// See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt
+//
+
+#include <boost/detail/lightweight_test.hpp>
+#include <stdio.h>
+
+// default case, !NDEBUG
+// BOOST_ASSERT(x) -> assert(x)
+
+#undef NDEBUG
+#include <boost/assert.hpp>
+
+void test_default()
+{
+ int x = 1;
+
+ BOOST_ASSERT( 1 );
+ BOOST_ASSERT( x );
+ BOOST_ASSERT( x == 1 );
+}
+
+// default case, NDEBUG
+// BOOST_ASSERT(x) -> assert(x)
+
+#define NDEBUG
+#include <boost/assert.hpp>
+
+void test_default_ndebug()
+{
+ int x = 1;
+
+ BOOST_ASSERT( 1 );
+ BOOST_ASSERT( x );
+ BOOST_ASSERT( x == 1 );
+
+ BOOST_ASSERT( 0 );
+ BOOST_ASSERT( !x );
+ BOOST_ASSERT( x == 0 );
+}
+
+// BOOST_ENABLE_ASSERT_DEBUG_HANDLER, !NDEBUG
+// same as BOOST_ENABLE_ASSERT_HANDLER
+
+#define BOOST_ENABLE_ASSERT_DEBUG_HANDLER
+
+#undef NDEBUG
+#include <boost/assert.hpp>
+
+int handler_invoked = 0;
+
+void boost::assertion_failed( char const * expr, char const * function, char const * file, long line )
+{
+ printf( "Expression: %s\nFunction: %s\nFile: %s\nLine: %ld\n\n", expr, function, file, line );
+ ++handler_invoked;
+}
+
+void test_debug_handler()
+{
+ handler_invoked = 0;
+
+ int x = 1;
+
+ BOOST_ASSERT( 1 );
+ BOOST_ASSERT( x );
+ BOOST_ASSERT( x == 1 );
+
+ BOOST_ASSERT( 0 );
+ BOOST_ASSERT( !x );
+ BOOST_ASSERT( x == 0 );
+
+ BOOST_TEST( handler_invoked == 3 );
+}
+
+// BOOST_ENABLE_ASSERT_DEBUG_HANDLER, NDEBUG
+// BOOST_ASSERT(x) -> ((void)0)
+
+#define NDEBUG
+#include <boost/assert.hpp>
+
+void test_debug_handler_ndebug()
+{
+ handler_invoked = 0;
+
+ int x = 1;
+
+ BOOST_ASSERT( 1 );
+ BOOST_ASSERT( x );
+ BOOST_ASSERT( x == 1 );
+
+ BOOST_ASSERT( 0 );
+ BOOST_ASSERT( !x );
+ BOOST_ASSERT( x == 0 );
+
+ BOOST_TEST( handler_invoked == 0 );
+}
+
+#undef BOOST_ENABLE_ASSERT_DEBUG_HANDLER
+
+int main()
+{
+ test_default();
+ test_default_ndebug();
+ test_debug_handler();
+ test_debug_handler_ndebug();
+
+ return boost::report_errors();
+}
diff --git a/test/current_function_test.cpp b/test/current_function_test.cpp
new file mode 100644
index 0000000..1343901
--- /dev/null
+++ b/test/current_function_test.cpp
@@ -0,0 +1,40 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// current_function_test.cpp - a test for boost/current_function.hpp
+//
+// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#include <boost/current_function.hpp>
+#include <boost/config.hpp>
+#include <cstdio>
+
+void message(char const * file, long line, char const * func, char const * msg)
+{
+#if !defined(BOOST_NO_STDC_NAMESPACE)
+ using std::printf;
+#endif
+
+ printf("%s(%ld): %s in function '%s'\n", file, line, msg, func);
+}
+
+#define MESSAGE(msg) message(__FILE__, __LINE__, BOOST_CURRENT_FUNCTION, msg)
+
+int main()
+{
+ MESSAGE("assertion failed");
+
+ return 0;
+}
diff --git a/test/exp/assert_exp_test.cpp b/test/exp/assert_exp_test.cpp
new file mode 100644
index 0000000..c56cdef
--- /dev/null
+++ b/test/exp/assert_exp_test.cpp
@@ -0,0 +1,164 @@
+//
+// assert_exp_test.cpp - tests BOOST_ASSERT expansion
+//
+// Copyright (c) 2014 Peter Dimov
+//
+// Distributed under the Boost Software License, Version 1.0.
+// See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt
+//
+
+#include <boost/config.hpp>
+#include <boost/current_function.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include <string>
+
+// Each backslash in __FILE__ when passed through BOOST_STRINGIZE is doubled
+static std::string quote( std::string const & s )
+{
+ std::string r;
+ r.reserve( s.size() );
+
+ for( char const * p = s.c_str(); *p; ++p )
+ {
+ r += *p;
+ if( *p == '\\' ) r += *p;
+ }
+
+ return r;
+}
+
+// default case, !NDEBUG
+// BOOST_ASSERT(x) -> assert(x)
+
+#undef NDEBUG
+#include <boost/assert.hpp>
+#undef assert
+
+void test_default()
+{
+ std::string v1 = BOOST_STRINGIZE(BOOST_ASSERT(x1));
+ BOOST_TEST_EQ( v1, "assert(x1)" );
+}
+
+// default case, NDEBUG
+// BOOST_ASSERT(x) -> assert(x)
+
+#define NDEBUG
+#include <boost/assert.hpp>
+#undef assert
+
+void test_default_ndebug()
+{
+ std::string v2 = BOOST_STRINGIZE(BOOST_ASSERT(x2));
+ BOOST_TEST_EQ( v2, "assert(x2)" );
+}
+
+// BOOST_DISABLE_ASSERTS, !NDEBUG
+// BOOST_ASSERT(x) -> ((void)0)
+
+#define BOOST_DISABLE_ASSERTS
+
+#undef NDEBUG
+#include <boost/assert.hpp>
+
+void test_disabled()
+{
+ std::string v3 = BOOST_STRINGIZE(BOOST_ASSERT(x3));
+ BOOST_TEST_EQ( v3, "((void)0)" );
+}
+
+// BOOST_DISABLE_ASSERTS, NDEBUG
+// BOOST_ASSERT(x) -> ((void)0)
+
+#define NDEBUG
+#include <boost/assert.hpp>
+
+void test_disabled_ndebug()
+{
+ std::string v4 = BOOST_STRINGIZE(BOOST_ASSERT(x4));
+ BOOST_TEST_EQ( v4, "((void)0)" );
+}
+
+#undef BOOST_DISABLE_ASSERTS
+
+// BOOST_ENABLE_ASSERT_HANDLER, !NDEBUG
+// BOOST_ASSERT(expr) -> (BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
+
+#undef BOOST_LIKELY
+#undef BOOST_CURRENT_FUNCTION
+
+#define BOOST_ENABLE_ASSERT_HANDLER
+
+#undef NDEBUG
+#include <boost/assert.hpp>
+
+void test_handler()
+{
+ std::string v5 = BOOST_STRINGIZE(BOOST_ASSERT(x5)); std::string w5 = "(BOOST_LIKELY(!!(x5))? ((void)0): ::boost::assertion_failed(\"x5\", BOOST_CURRENT_FUNCTION, \"" + quote( __FILE__ ) + "\", " BOOST_STRINGIZE(__LINE__) "))";
+
+ char const * BOOST_CURRENT_FUNCTION = "void test_handler()";
+ BOOST_TEST_EQ( v5, w5 );
+}
+
+// BOOST_ENABLE_ASSERT_HANDLER, NDEBUG
+// BOOST_ASSERT(expr) -> (BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
+
+#define NDEBUG
+#include <boost/assert.hpp>
+
+void test_handler_ndebug()
+{
+ std::string v6 = BOOST_STRINGIZE(BOOST_ASSERT(x6)); std::string w6 = "(BOOST_LIKELY(!!(x6))? ((void)0): ::boost::assertion_failed(\"x6\", BOOST_CURRENT_FUNCTION, \"" + quote( __FILE__ ) + "\", " BOOST_STRINGIZE(__LINE__) "))";
+
+ char const * BOOST_CURRENT_FUNCTION = "void test_handler_ndebug()";
+ BOOST_TEST_EQ( v6, w6 );
+}
+
+#undef BOOST_ENABLE_ASSERT_HANDLER
+
+// BOOST_ENABLE_ASSERT_DEBUG_HANDLER, !NDEBUG
+// same as BOOST_ENABLE_ASSERT_HANDLER
+
+#define BOOST_ENABLE_ASSERT_DEBUG_HANDLER
+
+#undef NDEBUG
+#include <boost/assert.hpp>
+
+void test_debug_handler()
+{
+ std::string v7 = BOOST_STRINGIZE(BOOST_ASSERT(x7)); std::string w7 = "(BOOST_LIKELY(!!(x7))? ((void)0): ::boost::assertion_failed(\"x7\", BOOST_CURRENT_FUNCTION, \"" + quote( __FILE__ ) + "\", " BOOST_STRINGIZE(__LINE__) "))";
+
+ char const * BOOST_CURRENT_FUNCTION = "void test_debug_handler()";
+ BOOST_TEST_EQ( v7, w7 );
+}
+
+// BOOST_ENABLE_ASSERT_DEBUG_HANDLER, NDEBUG
+// BOOST_ASSERT(x) -> ((void)0)
+
+#define NDEBUG
+#include <boost/assert.hpp>
+
+void test_debug_handler_ndebug()
+{
+ std::string v8 = BOOST_STRINGIZE(BOOST_ASSERT(x8));
+
+ char const * BOOST_CURRENT_FUNCTION = "void test_debug_handler_ndebug()";
+ BOOST_TEST_EQ( v8, "((void)0)" );
+}
+
+#undef BOOST_ENABLE_ASSERT_DEBUG_HANDLER
+
+int main()
+{
+ test_default();
+ test_default_ndebug();
+ test_disabled();
+ test_disabled_ndebug();
+ test_handler();
+ test_handler_ndebug();
+ test_debug_handler();
+ test_debug_handler_ndebug();
+
+ return boost::report_errors();
+}
diff --git a/test/exp/assert_msg_exp_test.cpp b/test/exp/assert_msg_exp_test.cpp
new file mode 100644
index 0000000..faff616
--- /dev/null
+++ b/test/exp/assert_msg_exp_test.cpp
@@ -0,0 +1,164 @@
+//
+// assert_msg_exp_test.cpp - tests BOOST_ASSERT_MSG expansion
+//
+// Copyright (c) 2014 Peter Dimov
+//
+// Distributed under the Boost Software License, Version 1.0.
+// See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt
+//
+
+#include <boost/config.hpp>
+#include <boost/current_function.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include <string>
+
+// Each backslash in __FILE__ when passed through BOOST_STRINGIZE is doubled
+static std::string quote( std::string const & s )
+{
+ std::string r;
+ r.reserve( s.size() );
+
+ for( char const * p = s.c_str(); *p; ++p )
+ {
+ r += *p;
+ if( *p == '\\' ) r += *p;
+ }
+
+ return r;
+}
+
+// default case, !NDEBUG
+// BOOST_ASSERT_MSG(x,"m") -> assert((x)&&("m"))
+
+#undef NDEBUG
+#include <boost/assert.hpp>
+#undef assert
+
+void test_default()
+{
+ std::string v1 = BOOST_STRINGIZE(BOOST_ASSERT_MSG(x1, "m1"));
+ BOOST_TEST_EQ( v1, "assert((x1)&&(\"m1\"))" );
+}
+
+// default case, NDEBUG
+// BOOST_ASSERT_MSG(x,"m") -> assert((x)&&("m"))
+
+#define NDEBUG
+#include <boost/assert.hpp>
+#undef assert
+
+void test_default_ndebug()
+{
+ std::string v2 = BOOST_STRINGIZE(BOOST_ASSERT_MSG(x2, "m2"));
+ BOOST_TEST_EQ( v2, "assert((x2)&&(\"m2\"))" );
+}
+
+// BOOST_DISABLE_ASSERTS, !NDEBUG
+// BOOST_ASSERT_MSG(x,"m") -> ((void)0)
+
+#define BOOST_DISABLE_ASSERTS
+
+#undef NDEBUG
+#include <boost/assert.hpp>
+
+void test_disabled()
+{
+ std::string v3 = BOOST_STRINGIZE(BOOST_ASSERT_MSG(x3, "m3"));
+ BOOST_TEST_EQ( v3, "((void)0)" );
+}
+
+// BOOST_DISABLE_ASSERTS, NDEBUG
+// BOOST_ASSERT_MSG(x,"m") -> ((void)0)
+
+#define NDEBUG
+#include <boost/assert.hpp>
+
+void test_disabled_ndebug()
+{
+ std::string v4 = BOOST_STRINGIZE(BOOST_ASSERT_MSG(x4, "m4"));
+ BOOST_TEST_EQ( v4, "((void)0)" );
+}
+
+#undef BOOST_DISABLE_ASSERTS
+
+// BOOST_ENABLE_ASSERT_HANDLER, !NDEBUG
+// BOOST_ASSERT_MSG(expr, msg) -> (BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed_msg(#expr, msg, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
+
+#undef BOOST_LIKELY
+#undef BOOST_CURRENT_FUNCTION
+
+#define BOOST_ENABLE_ASSERT_HANDLER
+
+#undef NDEBUG
+#include <boost/assert.hpp>
+
+void test_handler()
+{
+ std::string v5 = BOOST_STRINGIZE(BOOST_ASSERT_MSG(x5, "m5")); std::string w5 = "(BOOST_LIKELY(!!(x5))? ((void)0): ::boost::assertion_failed_msg(\"x5\", \"m5\", BOOST_CURRENT_FUNCTION, \"" + quote( __FILE__ ) + "\", " BOOST_STRINGIZE(__LINE__) "))";
+
+ char const * BOOST_CURRENT_FUNCTION = "void test_handler()";
+ BOOST_TEST_EQ( v5, w5 );
+}
+
+// BOOST_ENABLE_ASSERT_HANDLER, NDEBUG
+// BOOST_ASSERT_MSG(expr, msg) -> (BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed_msg(#expr, msg, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
+
+#define NDEBUG
+#include <boost/assert.hpp>
+
+void test_handler_ndebug()
+{
+ std::string v6 = BOOST_STRINGIZE(BOOST_ASSERT_MSG(x6, "m6")); std::string w6 = "(BOOST_LIKELY(!!(x6))? ((void)0): ::boost::assertion_failed_msg(\"x6\", \"m6\", BOOST_CURRENT_FUNCTION, \"" + quote( __FILE__ ) + "\", " BOOST_STRINGIZE(__LINE__) "))";
+
+ char const * BOOST_CURRENT_FUNCTION = "void test_handler_ndebug()";
+ BOOST_TEST_EQ( v6, w6 );
+}
+
+#undef BOOST_ENABLE_ASSERT_HANDLER
+
+// BOOST_ENABLE_ASSERT_DEBUG_HANDLER, !NDEBUG
+// same as BOOST_ENABLE_ASSERT_HANDLER
+
+#define BOOST_ENABLE_ASSERT_DEBUG_HANDLER
+
+#undef NDEBUG
+#include <boost/assert.hpp>
+
+void test_debug_handler()
+{
+ std::string v7 = BOOST_STRINGIZE(BOOST_ASSERT_MSG(x7, "m7")); std::string w7 = "(BOOST_LIKELY(!!(x7))? ((void)0): ::boost::assertion_failed_msg(\"x7\", \"m7\", BOOST_CURRENT_FUNCTION, \"" + quote( __FILE__ ) + "\", " BOOST_STRINGIZE(__LINE__) "))";
+
+ char const * BOOST_CURRENT_FUNCTION = "void test_debug_handler()";
+ BOOST_TEST_EQ( v7, w7 );
+}
+
+// BOOST_ENABLE_ASSERT_DEBUG_HANDLER, NDEBUG
+// BOOST_ASSERT_MSG(x,"m") -> ((void)0)
+
+#define NDEBUG
+#include <boost/assert.hpp>
+
+void test_debug_handler_ndebug()
+{
+ std::string v8 = BOOST_STRINGIZE(BOOST_ASSERT_MSG(x8, "m8"));
+
+ char const * BOOST_CURRENT_FUNCTION = "void test_debug_handler_ndebug()";
+ BOOST_TEST_EQ( v8, "((void)0)" );
+}
+
+#undef BOOST_ENABLE_ASSERT_DEBUG_HANDLER
+
+int main()
+{
+ test_default();
+ test_default_ndebug();
+ test_disabled();
+ test_disabled_ndebug();
+ test_handler();
+ test_handler_ndebug();
+ test_debug_handler();
+ test_debug_handler_ndebug();
+
+ return boost::report_errors();
+}
diff --git a/test/exp/verify_exp_test.cpp b/test/exp/verify_exp_test.cpp
new file mode 100644
index 0000000..844513b
--- /dev/null
+++ b/test/exp/verify_exp_test.cpp
@@ -0,0 +1,136 @@
+//
+// verify_exp_test.cpp - tests BOOST_ASSERT expansion
+//
+// Copyright (c) 2014 Peter Dimov
+//
+// Distributed under the Boost Software License, Version 1.0.
+// See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt
+//
+
+#include <boost/config.hpp>
+#include <boost/current_function.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include <string>
+
+// default case, !NDEBUG
+// BOOST_VERIFY(x) -> BOOST_ASSERT(x)
+
+#undef NDEBUG
+#include <boost/assert.hpp>
+#undef BOOST_ASSERT
+
+void test_default()
+{
+ std::string v1 = BOOST_STRINGIZE(BOOST_VERIFY(x1));
+ BOOST_TEST_EQ( v1, "BOOST_ASSERT(x1)" );
+}
+
+// default case, NDEBUG
+// BOOST_VERIFY(x) -> ((void)(x))
+
+#define NDEBUG
+#include <boost/assert.hpp>
+
+void test_default_ndebug()
+{
+ std::string v2 = BOOST_STRINGIZE(BOOST_VERIFY(x2));
+ BOOST_TEST_EQ( v2, "((void)(x2))" );
+}
+
+// BOOST_DISABLE_ASSERTS, !NDEBUG
+// BOOST_VERIFY(x) -> ((void)(x))
+
+#define BOOST_DISABLE_ASSERTS
+#undef NDEBUG
+#include <boost/assert.hpp>
+
+void test_disabled()
+{
+ std::string v3 = BOOST_STRINGIZE(BOOST_VERIFY(x3));
+ BOOST_TEST_EQ( v3, "((void)(x3))" );
+}
+
+// BOOST_DISABLE_ASSERTS, NDEBUG
+// BOOST_VERIFY(x) -> ((void)(x))
+
+#undef NDEBUG
+#include <boost/assert.hpp>
+
+void test_disabled_ndebug()
+{
+ std::string v4 = BOOST_STRINGIZE(BOOST_VERIFY(x4));
+ BOOST_TEST_EQ( v4, "((void)(x4))" );
+}
+
+#undef BOOST_DISABLE_ASSERTS
+
+// BOOST_ENABLE_ASSERT_HANDLER, !NDEBUG
+// BOOST_VERIFY(x) -> BOOST_ASSERT(x)
+
+#define BOOST_ENABLE_ASSERT_HANDLER
+
+#undef NDEBUG
+#include <boost/assert.hpp>
+#undef BOOST_ASSERT
+
+void test_handler()
+{
+ std::string v5 = BOOST_STRINGIZE(BOOST_VERIFY(x5));
+ BOOST_TEST_EQ( v5, "BOOST_ASSERT(x5)" );
+}
+
+#define NDEBUG
+#include <boost/assert.hpp>
+#undef BOOST_ASSERT
+
+void test_handler_ndebug()
+{
+ std::string v6 = BOOST_STRINGIZE(BOOST_VERIFY(x6));
+ BOOST_TEST_EQ( v6, "BOOST_ASSERT(x6)" );
+}
+
+#undef BOOST_ENABLE_ASSERT_HANDLER
+
+// BOOST_ENABLE_ASSERT_DEBUG_HANDLER, !NDEBUG
+// BOOST_VERIFY(x) -> BOOST_ASSERT(x)
+
+#define BOOST_ENABLE_ASSERT_DEBUG_HANDLER
+
+#undef NDEBUG
+#include <boost/assert.hpp>
+#undef BOOST_ASSERT
+
+void test_debug_handler()
+{
+ std::string v7 = BOOST_STRINGIZE(BOOST_VERIFY(x7));
+ BOOST_TEST_EQ( v7, "BOOST_ASSERT(x7)" );
+}
+
+// BOOST_ENABLE_ASSERT_DEBUG_HANDLER, NDEBUG
+// BOOST_VERIFY(x) -> ((void)(x))
+
+#define NDEBUG
+#include <boost/assert.hpp>
+
+void test_debug_handler_ndebug()
+{
+ std::string v8 = BOOST_STRINGIZE(BOOST_VERIFY(x8));
+ BOOST_TEST_EQ( v8, "((void)(x8))" );
+}
+
+#undef BOOST_ENABLE_ASSERT_DEBUG_HANDLER
+
+int main()
+{
+ test_default();
+ test_default_ndebug();
+ test_disabled();
+ test_disabled_ndebug();
+ test_handler();
+ test_handler_ndebug();
+ test_debug_handler();
+ test_debug_handler_ndebug();
+
+ return boost::report_errors();
+}
diff --git a/test/exp/verify_msg_exp_test.cpp b/test/exp/verify_msg_exp_test.cpp
new file mode 100644
index 0000000..02090fe
--- /dev/null
+++ b/test/exp/verify_msg_exp_test.cpp
@@ -0,0 +1,140 @@
+//
+// verify_msg_exp_test.cpp - tests BOOST_VERIFY_MSG expansion
+//
+// Copyright (c) 2014 Peter Dimov
+//
+// Distributed under the Boost Software License, Version 1.0.
+// See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt
+//
+
+#include <boost/config.hpp>
+#include <boost/current_function.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include <string>
+
+// default case, !NDEBUG
+// BOOST_VERIFY_MSG(x,"m") -> BOOST_ASSERT_MSG(x,"m")
+
+#undef NDEBUG
+#include <boost/assert.hpp>
+#undef BOOST_ASSERT_MSG
+
+void test_default()
+{
+ std::string v1 = BOOST_STRINGIZE(BOOST_VERIFY_MSG(x1, m1));
+ BOOST_TEST_EQ( v1, "BOOST_ASSERT_MSG(x1,m1)" );
+}
+
+// default case, NDEBUG
+// BOOST_VERIFY_MSG(x,"m") -> ((void)(x))
+
+#define NDEBUG
+#include <boost/assert.hpp>
+
+void test_default_ndebug()
+{
+ std::string v2 = BOOST_STRINGIZE(BOOST_VERIFY_MSG(x2, m2));
+ BOOST_TEST_EQ( v2, "((void)(x2))" );
+}
+
+// BOOST_DISABLE_ASSERTS, !NDEBUG
+// BOOST_VERIFY_MSG(x,"m") -> ((void)(x))
+
+#define BOOST_DISABLE_ASSERTS
+
+#undef NDEBUG
+#include <boost/assert.hpp>
+
+void test_disabled()
+{
+ std::string v3 = BOOST_STRINGIZE(BOOST_VERIFY_MSG(x3, "m3"));
+ BOOST_TEST_EQ( v3, "((void)(x3))" );
+}
+
+// BOOST_DISABLE_ASSERTS, NDEBUG
+// BOOST_VERIFY_MSG(x,"m") -> ((void)(x))
+
+#define NDEBUG
+#include <boost/assert.hpp>
+
+void test_disabled_ndebug()
+{
+ std::string v4 = BOOST_STRINGIZE(BOOST_VERIFY_MSG(x4, "m4"));
+ BOOST_TEST_EQ( v4, "((void)(x4))" );
+}
+
+#undef BOOST_DISABLE_ASSERTS
+
+// BOOST_ENABLE_ASSERT_HANDLER, !NDEBUG
+// BOOST_VERIFY_MSG(x,m) -> BOOST_ASSERT_MSG(x,m)
+
+#define BOOST_ENABLE_ASSERT_HANDLER
+
+#undef NDEBUG
+#include <boost/assert.hpp>
+#undef BOOST_ASSERT_MSG
+
+void test_handler()
+{
+ std::string v5 = BOOST_STRINGIZE(BOOST_VERIFY_MSG(x5, m5));
+ BOOST_TEST_EQ( v5, "BOOST_ASSERT_MSG(x5,m5)" );
+}
+
+// BOOST_ENABLE_ASSERT_HANDLER, NDEBUG
+// BOOST_VERIFY_MSG(x,n) -> BOOST_ASSERT_MSG(x,m)
+
+#define NDEBUG
+#include <boost/assert.hpp>
+#undef BOOST_ASSERT_MSG
+
+void test_handler_ndebug()
+{
+ std::string v6 = BOOST_STRINGIZE(BOOST_VERIFY_MSG(x6, m6));
+ BOOST_TEST_EQ( v6, "BOOST_ASSERT_MSG(x6,m6)" );
+}
+
+#undef BOOST_ENABLE_ASSERT_HANDLER
+
+// BOOST_ENABLE_ASSERT_DEBUG_HANDLER, !NDEBUG
+// BOOST_VERIFY_MSG(x,n) -> BOOST_ASSERT_MSG(x,m)
+
+#define BOOST_ENABLE_ASSERT_DEBUG_HANDLER
+
+#undef NDEBUG
+#include <boost/assert.hpp>
+#undef BOOST_ASSERT_MSG
+
+void test_debug_handler()
+{
+ std::string v7 = BOOST_STRINGIZE(BOOST_VERIFY_MSG(x7, m7));
+ BOOST_TEST_EQ( v7, "BOOST_ASSERT_MSG(x7,m7)" );
+}
+
+// BOOST_ENABLE_ASSERT_DEBUG_HANDLER, NDEBUG
+// BOOST_VERIFY_MSG(x,"m") -> ((void)(x))
+
+#define NDEBUG
+#include <boost/assert.hpp>
+
+void test_debug_handler_ndebug()
+{
+ std::string v8 = BOOST_STRINGIZE(BOOST_VERIFY_MSG(x8, "m8"));
+ BOOST_TEST_EQ( v8, "((void)(x8))" );
+}
+
+#undef BOOST_ENABLE_ASSERT_DEBUG_HANDLER
+
+int main()
+{
+ test_default();
+ test_default_ndebug();
+ test_disabled();
+ test_disabled_ndebug();
+ test_handler();
+ test_handler_ndebug();
+ test_debug_handler();
+ test_debug_handler_ndebug();
+
+ return boost::report_errors();
+}
diff --git a/test/quick.cpp b/test/quick.cpp
new file mode 100644
index 0000000..ec3dba6
--- /dev/null
+++ b/test/quick.cpp
@@ -0,0 +1,18 @@
+//
+// quick.cpp - a quick test for boost/assert.hpp
+//
+// Copyright 2017 Peter Dimov
+//
+// Distributed under the Boost Software License, Version 1.0.
+//
+// See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt
+//
+
+#include <boost/assert.hpp>
+
+int main()
+{
+ int x = 1;
+ BOOST_ASSERT( x == 1 );
+}
diff --git a/test/verify_test.cpp b/test/verify_test.cpp
new file mode 100644
index 0000000..3481636
--- /dev/null
+++ b/test/verify_test.cpp
@@ -0,0 +1,126 @@
+//
+// verify_test.cpp - a test for BOOST_VERIFY
+//
+// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
+// Copyright (c) 2007 Peter Dimov
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#include <boost/detail/lightweight_test.hpp>
+
+#include <boost/assert.hpp>
+
+int f( int & x )
+{
+ return ++x;
+}
+
+void test_default()
+{
+ int x = 1;
+
+ BOOST_VERIFY( 1 );
+ BOOST_VERIFY( x == 1 );
+ BOOST_VERIFY( ++x );
+ BOOST_VERIFY( f(x) );
+ BOOST_VERIFY( &x );
+
+ BOOST_TEST( x == 3 );
+}
+
+#define BOOST_DISABLE_ASSERTS
+#include <boost/assert.hpp>
+
+void test_disabled()
+{
+ int x = 1;
+
+ BOOST_VERIFY( 1 );
+ BOOST_VERIFY( x == 1 );
+ BOOST_VERIFY( ++x );
+ BOOST_VERIFY( f(x) );
+ BOOST_VERIFY( &x );
+
+ BOOST_TEST( x == 3 );
+
+ BOOST_VERIFY( 0 );
+ BOOST_VERIFY( !x );
+ BOOST_VERIFY( x == 0 );
+ BOOST_VERIFY( !++x );
+ BOOST_VERIFY( !f(x) );
+
+ BOOST_TEST( x == 5 );
+
+ void * p = 0;
+ BOOST_VERIFY( p );
+}
+
+#undef BOOST_DISABLE_ASSERTS
+
+#define BOOST_ENABLE_ASSERT_HANDLER
+#include <boost/assert.hpp>
+#include <boost/config.hpp>
+#include <cstdio>
+
+int handler_invoked = 0;
+
+void boost::assertion_failed(char const * expr, char const * function, char const * file, long line)
+{
+#if !defined(BOOST_NO_STDC_NAMESPACE)
+ using std::printf;
+#endif
+
+ printf("Expression: %s\nFunction: %s\nFile: %s\nLine: %ld\n\n", expr, function, file, line);
+ ++handler_invoked;
+}
+
+struct X
+{
+ static bool f()
+ {
+ BOOST_VERIFY( 0 );
+ return false;
+ }
+};
+
+void test_handler()
+{
+ int x = 1;
+
+ BOOST_VERIFY( 1 );
+ BOOST_VERIFY( x == 1 );
+ BOOST_VERIFY( ++x );
+ BOOST_VERIFY( f(x) );
+ BOOST_VERIFY( &x );
+
+ BOOST_TEST( x == 3 );
+
+ BOOST_VERIFY( 0 );
+ BOOST_VERIFY( !x );
+ BOOST_VERIFY( x == 0 );
+ BOOST_VERIFY( !++x );
+ BOOST_VERIFY( !f(x) );
+
+ BOOST_TEST( x == 5 );
+
+ void * p = 0;
+ BOOST_VERIFY( p );
+
+ BOOST_VERIFY( X::f() );
+
+ BOOST_TEST( handler_invoked == 8 );
+}
+
+#undef BOOST_ENABLE_ASSERT_HANDLER
+
+int main()
+{
+ test_default();
+ test_disabled();
+ test_handler();
+
+ return boost::report_errors();
+}