mirror of
https://github.com/boostorg/python.git
synced 2026-01-19 04:22:16 +00:00
Stop using assert() in tests so we can test with NDEBUG defined.
[SVN r33026]
This commit is contained in:
@@ -10,7 +10,8 @@
|
||||
#include <boost/ref.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
#include <memory>
|
||||
#include <cassert>
|
||||
#define BOOST_ENABLE_ASSERT_HANDLER
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/python/copy_const_reference.hpp>
|
||||
#include <boost/python/return_value_policy.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
@@ -24,10 +25,10 @@ struct X
|
||||
{
|
||||
explicit X(int x) : x(x), magic(7654321) { ++counter; }
|
||||
X(X const& rhs) : x(rhs.x), magic(7654321) { ++counter; }
|
||||
virtual ~X() { assert(magic == 7654321); magic = 6666666; x = 9999; --counter; }
|
||||
virtual ~X() { BOOST_ASSERT(magic == 7654321); magic = 6666666; x = 9999; --counter; }
|
||||
|
||||
void set(int x) { assert(magic == 7654321); this->x = x; }
|
||||
int value() const { assert(magic == 7654321); return x; }
|
||||
void set(int x) { BOOST_ASSERT(magic == 7654321); this->x = x; }
|
||||
int value() const { BOOST_ASSERT(magic == 7654321); return x; }
|
||||
static int count() { return counter; }
|
||||
private:
|
||||
void operator=(X const&);
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// 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>
|
||||
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
@@ -29,10 +31,10 @@ struct X
|
||||
{
|
||||
explicit X(int x) : x(x), magic(7654321) { ++counter; }
|
||||
X(X const& rhs) : x(rhs.x), magic(7654321) { ++counter; }
|
||||
~X() { assert(magic == 7654321); magic = 6666666; x = 9999; --counter; }
|
||||
~X() { BOOST_ASSERT(magic == 7654321); magic = 6666666; x = 9999; --counter; }
|
||||
|
||||
void set(int x) { assert(magic == 7654321); this->x = x; }
|
||||
int value() const { assert(magic == 7654321); return x; }
|
||||
void set(int x) { BOOST_ASSERT(magic == 7654321); this->x = x; }
|
||||
int value() const { BOOST_ASSERT(magic == 7654321); return x; }
|
||||
static int count() { return counter; }
|
||||
private:
|
||||
void operator=(X const&);
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
// 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/python/detail/destroy.hpp>
|
||||
#include <cassert>
|
||||
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
int count;
|
||||
int marks[] = {
|
||||
@@ -26,8 +27,8 @@ struct foo
|
||||
void assert_destructions(int n)
|
||||
{
|
||||
for (int i = 0; i < n; ++i)
|
||||
assert(marks[i] == i);
|
||||
assert(marks[n] == -1);
|
||||
BOOST_TEST(marks[i] == i);
|
||||
BOOST_TEST(marks[n] == -1);
|
||||
}
|
||||
|
||||
int main()
|
||||
@@ -50,5 +51,5 @@ int main()
|
||||
boost::python::detail::destroy_referent<y&>(f3);
|
||||
assert_destructions(7);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// 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/python/module.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/dict.hpp>
|
||||
@@ -69,7 +71,7 @@ void test_templates(object print)
|
||||
print(tmp.get(2,"default"));
|
||||
print(tmp.setdefault(3,"default"));
|
||||
|
||||
assert(!tmp.has_key(key));
|
||||
BOOST_ASSERT(!tmp.has_key(key));
|
||||
//print(tmp[3]);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,22 +4,10 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/python.hpp>
|
||||
#define BOOST_ENABLE_ASSERT_HANDLER 1
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <iostream>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
void assertion_failed(char const * expr, char const * function,
|
||||
char const * file, long line)
|
||||
{
|
||||
std::cerr << "assertion failed : " << expr << " in " << function
|
||||
<< " at " << file << ':' << line << std::endl;
|
||||
abort();
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
namespace python = boost::python;
|
||||
|
||||
@@ -85,7 +73,7 @@ void exec_test()
|
||||
|
||||
// Creating and using instances of the C++ class is as easy as always.
|
||||
CppDerived cpp;
|
||||
BOOST_ASSERT(cpp.hello() == "Hello from C++!");
|
||||
BOOST_TEST(cpp.hello() == "Hello from C++!");
|
||||
|
||||
// But now creating and using instances of the Python class is almost
|
||||
// as easy!
|
||||
@@ -93,7 +81,7 @@ void exec_test()
|
||||
Base& py = python::extract<Base&>(py_base) BOOST_EXTRACT_WORKAROUND;
|
||||
|
||||
// Make sure the right 'hello' method is called.
|
||||
BOOST_ASSERT(py.hello() == "Hello from Python!");
|
||||
BOOST_TEST(py.hello() == "Hello from Python!");
|
||||
}
|
||||
|
||||
void exec_file_test(std::string const &script)
|
||||
@@ -103,7 +91,7 @@ void exec_file_test(std::string const &script)
|
||||
python::object result = python::exec_file(script.c_str(), global, global);
|
||||
|
||||
// Extract an object the script stored in the global dictionary.
|
||||
BOOST_ASSERT(python::extract<int>(global["number"]) == 42);
|
||||
BOOST_TEST(python::extract<int>(global["number"]) == 42);
|
||||
}
|
||||
|
||||
void exec_test_error()
|
||||
@@ -115,9 +103,8 @@ void exec_test_error()
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
assert(argc == 2);
|
||||
BOOST_TEST(argc == 2);
|
||||
std::string script = argv[1];
|
||||
bool success = true;
|
||||
// Initialize the interpreter
|
||||
Py_Initialize();
|
||||
|
||||
@@ -126,15 +113,16 @@ int main(int argc, char **argv)
|
||||
{
|
||||
if (PyErr_Occurred())
|
||||
{
|
||||
BOOST_ERROR("Python Error detected");
|
||||
PyErr_Print();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "A C++ exception was thrown for which "
|
||||
<< "there was no exception handler registered." << std::endl;
|
||||
BOOST_ERROR("A C++ exception was thrown for which "
|
||||
"there was no exception handler registered.");
|
||||
}
|
||||
success = false;
|
||||
}
|
||||
|
||||
if (python::handle_exception(exec_test_error))
|
||||
{
|
||||
if (PyErr_Occurred())
|
||||
@@ -143,18 +131,18 @@ int main(int argc, char **argv)
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "A C++ exception was thrown for which "
|
||||
<< "there was no exception handler registered." << std::endl;
|
||||
success = false;
|
||||
BOOST_ERROR("A C++ exception was thrown for which "
|
||||
"there was no exception handler registered.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
success = false;
|
||||
BOOST_ERROR("Python exception expected, but not seen.");
|
||||
}
|
||||
|
||||
// Boost.Python doesn't support Py_Finalize yet.
|
||||
// Py_Finalize();
|
||||
return success ? 0 : 1;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
// Including this file makes sure
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
#include <boost/python/implicit.hpp>
|
||||
#include <string>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <cassert>
|
||||
#define BOOST_ENABLE_ASSERT_HANDLER
|
||||
#include <boost/assert.hpp>
|
||||
#include "test_class.hpp"
|
||||
|
||||
using namespace boost::python;
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
// Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//#include <stdio.h>
|
||||
#include <cassert>
|
||||
#define BOOST_ENABLE_ASSERT_HANDLER
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/type_traits/is_member_function_pointer.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/python/detail/indirect_traits.hpp>
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// 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>
|
||||
|
||||
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
@@ -118,10 +120,10 @@ void exercise(list x, object y, object print)
|
||||
w.append(5);
|
||||
w.append(6);
|
||||
w += "hi";
|
||||
assert(w[0] == 5);
|
||||
assert(w[1] == 6);
|
||||
assert(w[2] == 'h');
|
||||
assert(w[3] == 'i');
|
||||
BOOST_ASSERT(w[0] == 5);
|
||||
BOOST_ASSERT(w[1] == 6);
|
||||
BOOST_ASSERT(w[2] == 'h');
|
||||
BOOST_ASSERT(w[3] == 'i');
|
||||
}
|
||||
|
||||
BOOST_PYTHON_MODULE(list_ext)
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/long.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <cassert>
|
||||
#define BOOST_ENABLE_ASSERT_HANDLER
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
using namespace boost::python;
|
||||
|
||||
@@ -30,7 +31,7 @@ char const* is_long1(long_& x)
|
||||
{
|
||||
long_ y = x;
|
||||
x += 50;
|
||||
assert(x == y + 50);
|
||||
BOOST_ASSERT(x == y + 50);
|
||||
return "yes";
|
||||
}
|
||||
|
||||
@@ -59,3 +60,4 @@ BOOST_PYTHON_MODULE(long_ext)
|
||||
;
|
||||
}
|
||||
|
||||
#include "module_tail.cpp"
|
||||
|
||||
@@ -27,3 +27,29 @@ extern "C" void (*old_translator)(unsigned, EXCEPTION_POINTERS*)
|
||||
|
||||
#endif // _WIN32
|
||||
|
||||
#include <exception>
|
||||
#include <boost/python/extract.hpp>
|
||||
#include <boost/python/str.hpp>
|
||||
struct test_failure : std::exception
|
||||
{
|
||||
test_failure(char const* expr, char const* function, char const* file, unsigned line)
|
||||
: msg(file + boost::python::str(":%s:") % line + ": Boost.Python assertion failure: " + expr)
|
||||
{}
|
||||
|
||||
char const* what() throw()
|
||||
{
|
||||
return boost::python::extract<char const*>(msg)();
|
||||
}
|
||||
|
||||
boost::python::str msg;
|
||||
};
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
void assertion_failed(char const * expr, char const * function, char const * file, long line)
|
||||
{
|
||||
throw ::test_failure(expr,function, file, line);
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
// 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/python/type_id.hpp>
|
||||
#include <cassert>
|
||||
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/python/converter/pointer_type_id.hpp>
|
||||
|
||||
int main()
|
||||
@@ -13,30 +14,30 @@ int main()
|
||||
= boost::python::type_id<int>();
|
||||
|
||||
|
||||
assert(pointer_type_id<int*>() == x);
|
||||
assert(pointer_type_id<int const*>() == x);
|
||||
assert(pointer_type_id<int volatile*>() == x);
|
||||
assert(pointer_type_id<int const volatile*>() == x);
|
||||
BOOST_TEST(pointer_type_id<int*>() == x);
|
||||
BOOST_TEST(pointer_type_id<int const*>() == x);
|
||||
BOOST_TEST(pointer_type_id<int volatile*>() == x);
|
||||
BOOST_TEST(pointer_type_id<int const volatile*>() == x);
|
||||
|
||||
assert(pointer_type_id<int*&>() == x);
|
||||
assert(pointer_type_id<int const*&>() == x);
|
||||
assert(pointer_type_id<int volatile*&>() == x);
|
||||
assert(pointer_type_id<int const volatile*&>() == x);
|
||||
BOOST_TEST(pointer_type_id<int*&>() == x);
|
||||
BOOST_TEST(pointer_type_id<int const*&>() == x);
|
||||
BOOST_TEST(pointer_type_id<int volatile*&>() == x);
|
||||
BOOST_TEST(pointer_type_id<int const volatile*&>() == x);
|
||||
|
||||
assert(pointer_type_id<int*const&>() == x);
|
||||
assert(pointer_type_id<int const*const&>() == x);
|
||||
assert(pointer_type_id<int volatile*const&>() == x);
|
||||
assert(pointer_type_id<int const volatile*const&>() == x);
|
||||
BOOST_TEST(pointer_type_id<int*const&>() == x);
|
||||
BOOST_TEST(pointer_type_id<int const*const&>() == x);
|
||||
BOOST_TEST(pointer_type_id<int volatile*const&>() == x);
|
||||
BOOST_TEST(pointer_type_id<int const volatile*const&>() == x);
|
||||
|
||||
assert(pointer_type_id<int*volatile&>() == x);
|
||||
assert(pointer_type_id<int const*volatile&>() == x);
|
||||
assert(pointer_type_id<int volatile*volatile&>() == x);
|
||||
assert(pointer_type_id<int const volatile*volatile&>() == x);
|
||||
BOOST_TEST(pointer_type_id<int*volatile&>() == x);
|
||||
BOOST_TEST(pointer_type_id<int const*volatile&>() == x);
|
||||
BOOST_TEST(pointer_type_id<int volatile*volatile&>() == x);
|
||||
BOOST_TEST(pointer_type_id<int const volatile*volatile&>() == x);
|
||||
|
||||
assert(pointer_type_id<int*const volatile&>() == x);
|
||||
assert(pointer_type_id<int const*const volatile&>() == x);
|
||||
assert(pointer_type_id<int volatile*const volatile&>() == x);
|
||||
assert(pointer_type_id<int const volatile*const volatile&>() == x);
|
||||
BOOST_TEST(pointer_type_id<int*const volatile&>() == x);
|
||||
BOOST_TEST(pointer_type_id<int const*const volatile&>() == x);
|
||||
BOOST_TEST(pointer_type_id<int volatile*const volatile&>() == x);
|
||||
BOOST_TEST(pointer_type_id<int const volatile*const volatile&>() == x);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -7,5 +7,5 @@
|
||||
int main()
|
||||
{
|
||||
boost::python::converter::arg_to_python<PyTypeObject*> x(0);
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -9,5 +9,5 @@ struct X : PyObject {};
|
||||
int main()
|
||||
{
|
||||
boost::python::converter::arg_to_python<X*> x(0);
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// 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>
|
||||
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
@@ -15,10 +17,10 @@ struct X
|
||||
{
|
||||
explicit X(int x) : x(x), magic(7654321) { ++counter; }
|
||||
X(X const& rhs) : x(rhs.x), magic(7654321) { ++counter; }
|
||||
virtual ~X() { assert(magic == 7654321); magic = 6666666; x = 9999; --counter; }
|
||||
virtual ~X() { BOOST_ASSERT(magic == 7654321); magic = 6666666; x = 9999; --counter; }
|
||||
|
||||
void set(int x) { assert(magic == 7654321); this->x = x; }
|
||||
int value() const { assert(magic == 7654321); return x; }
|
||||
void set(int x) { BOOST_ASSERT(magic == 7654321); this->x = x; }
|
||||
int value() const { BOOST_ASSERT(magic == 7654321); return x; }
|
||||
static int count() { return counter; }
|
||||
private:
|
||||
void operator=(X const&);
|
||||
|
||||
10
test/str.cpp
10
test/str.cpp
@@ -2,6 +2,8 @@
|
||||
// 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/python/module.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/str.hpp>
|
||||
@@ -25,8 +27,8 @@ void work_with_string(object print)
|
||||
print(data.encode("utf-8"));
|
||||
print(data.decode("utf-8"));
|
||||
|
||||
assert(!data.endswith("xx"));
|
||||
assert(!data.startswith("test"));
|
||||
BOOST_ASSERT(!data.endswith("xx"));
|
||||
BOOST_ASSERT(!data.startswith("test"));
|
||||
|
||||
print(data.splitlines());
|
||||
print(data.strip());
|
||||
@@ -54,8 +56,8 @@ void work_with_string(object print)
|
||||
print(data.rfind("i",5));
|
||||
print(data.rindex("i",5));
|
||||
|
||||
assert(!data.startswith("asdf"));
|
||||
assert(!data.endswith("asdf"));
|
||||
BOOST_ASSERT(!data.startswith("asdf"));
|
||||
BOOST_ASSERT(!data.endswith("asdf"));
|
||||
|
||||
print(data.translate(str('a')*256));
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
#include <boost/python/detail/string_literal.hpp>
|
||||
//#include <stdio.h>
|
||||
#include <cassert>
|
||||
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
using namespace boost::python::detail;
|
||||
@@ -37,5 +38,5 @@ int main()
|
||||
BOOST_STATIC_ASSERT(!is_string_literal<int[20]>::value);
|
||||
BOOST_STATIC_ASSERT(!is_string_literal<int const[20]>::value);
|
||||
BOOST_STATIC_ASSERT(!is_string_literal<int const[3]>::value);
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -4,17 +4,17 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef TEST_CLASS_DWA2002326_HPP
|
||||
# define TEST_CLASS_DWA2002326_HPP
|
||||
# include <cassert>
|
||||
# include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
template <int n = 0>
|
||||
struct test_class
|
||||
{
|
||||
explicit test_class(int x) : x(x), magic(7654321 + n) { ++counter; }
|
||||
test_class(test_class const& rhs) : x(rhs.x), magic(7654321 + n) { ++counter; }
|
||||
virtual ~test_class() { assert(magic == 7654321 + n); magic = 6666666; x = 9999; --counter; }
|
||||
virtual ~test_class() { BOOST_TEST(magic == 7654321 + n); magic = 6666666; x = 9999; --counter; }
|
||||
|
||||
void set(int x) { assert(magic == 7654321 + n); this->x = x; }
|
||||
int value() const { assert(magic == 7654321 + n); return x; }
|
||||
void set(int x) { BOOST_TEST(magic == 7654321 + n); this->x = x; }
|
||||
int value() const { BOOST_TEST(magic == 7654321 + n); return x; }
|
||||
operator int() const { return x; }
|
||||
static int count() { return counter; }
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// 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/python/cast.hpp>
|
||||
|
||||
struct X { long x; };
|
||||
@@ -11,8 +12,8 @@ int main()
|
||||
{
|
||||
PyTypeObject o;
|
||||
Y y;
|
||||
assert(&boost::python::upcast<PyObject>(&o)->ob_refcnt == &o.ob_refcnt);
|
||||
assert(&boost::python::upcast<PyObject>(&y)->ob_refcnt == &y.ob_refcnt);
|
||||
return 0;
|
||||
BOOST_TEST(&boost::python::upcast<PyObject>(&o)->ob_refcnt == &o.ob_refcnt);
|
||||
BOOST_TEST(&boost::python::upcast<PyObject>(&y)->ob_refcnt == &y.ob_refcnt);
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// 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>
|
||||
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
@@ -16,10 +18,10 @@ struct X
|
||||
{
|
||||
explicit X(int x) : x(x), magic(7654321) { ++counter; }
|
||||
X(X const& rhs) : x(rhs.x), magic(7654321) { ++counter; }
|
||||
virtual ~X() { assert(magic == 7654321); magic = 6666666; x = 9999; --counter; }
|
||||
virtual ~X() { BOOST_ASSERT(magic == 7654321); magic = 6666666; x = 9999; --counter; }
|
||||
|
||||
void set(int x) { assert(magic == 7654321); this->x = x; }
|
||||
int value() const { assert(magic == 7654321); return x; }
|
||||
void set(int x) { BOOST_ASSERT(magic == 7654321); this->x = x; }
|
||||
int value() const { BOOST_ASSERT(magic == 7654321); return x; }
|
||||
static int count() { return counter; }
|
||||
private:
|
||||
void operator=(X const&);
|
||||
|
||||
Reference in New Issue
Block a user