From e413428d712098e7ba07ee82a3d2111dc3dbaaa6 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Fri, 25 Jan 2002 13:54:30 +0000 Subject: [PATCH] Added tests for the new smart pointers. [SVN r12500] --- assert_test.cpp | 33 +++++++++++++++++++++++++++++++++ current_function_test.cpp | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 assert_test.cpp create mode 100644 current_function_test.cpp diff --git a/assert_test.cpp b/assert_test.cpp new file mode 100644 index 0000000..5813e25 --- /dev/null +++ b/assert_test.cpp @@ -0,0 +1,33 @@ +#if defined(_MSC_VER) && !defined(__ICL) +#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 + +// +// assert_test.cpp - a test for boost/assert.hpp +// +// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// +// 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. +// + +#define BOOST_DEBUG 1 + +#include +#include + +bool boost_error(char const * expr, char const * func, char const * file, long line) +{ + std::printf("%s(%ld): Assertion '%s' failed in function '%s'\n", file, line, expr, func); + return true; // fail w/ standard assert() +} + +int main() +{ + BOOST_ASSERT(0 == 1); +} diff --git a/current_function_test.cpp b/current_function_test.cpp new file mode 100644 index 0000000..620a45e --- /dev/null +++ b/current_function_test.cpp @@ -0,0 +1,32 @@ +#if defined(_MSC_VER) && !defined(__ICL) +#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. +// +// 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. +// + +#include +#include + +void message(char const * file, long line, char const * func, char const * msg) +{ + std::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"); +}