2 // Testing allocator for the C++ library testsuite.
4 // Copyright (C) 2002, 2003 Free Software Foundation, Inc.
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 2, or (at your option)
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING. If not, write to the Free
19 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22 // As a special exception, you may use this file as part of a free software
23 // library without restriction. Specifically, if other files instantiate
24 // templates or use macros or inline functions from this file, or you compile
25 // this file and link it with other files to produce an executable, this
26 // file does not by itself cause the resulting executable to be covered by
27 // the GNU General Public License. This exception does not however
28 // invalidate any other reasons why the executable file might be covered by
29 // the GNU General Public License.
32 #include <testsuite_allocator.h>
36 typedef tracker_allocator_counter counter_type
;
38 counter_type::size_type
39 counter_type::allocationCount_
= 0;
41 counter_type::size_type
42 counter_type::deallocationCount_
= 0;
44 int counter_type::constructCount_
= 0;
45 int counter_type::destructCount_
= 0;
48 check_construct_destroy(const char* tag
, int expected_c
, int expected_d
)
51 if (counter_type::get_construct_count() != expected_c
52 || counter_type::get_destruct_count() != expected_d
)
54 std::cerr
<< tag
<< ": "
55 << " construct = " << counter_type::get_construct_count()
56 << " (should be " << expected_c
<< "),"
57 << " destroy = " << counter_type::get_destruct_count()
58 << " (should be " << expected_d
<< ")"
64 } // namespace __cxx_test