]>
Commit | Line | Data |
---|---|---|
8d59b230 BK |
1 | // -*- C++ -*- |
2 | // Testing allocator for the C++ library testsuite. | |
162c7cd9 | 3 | // |
aa118a03 | 4 | // Copyright (C) 2002-2014 Free Software Foundation, Inc. |
162c7cd9 SW |
5 | // |
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 | |
748086b7 | 9 | // Free Software Foundation; either version 3, or (at your option) |
162c7cd9 SW |
10 | // any later version. |
11 | // | |
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. | |
16 | // | |
17 | // You should have received a copy of the GNU General Public License along | |
748086b7 JJ |
18 | // with this library; see the file COPYING3. If not see |
19 | // <http://www.gnu.org/licenses/>. | |
162c7cd9 | 20 | // |
162c7cd9 | 21 | |
1985f1cd | 22 | #include <iostream> |
162c7cd9 SW |
23 | #include <testsuite_allocator.h> |
24 | ||
aecf642c | 25 | namespace __gnu_test |
8d59b230 | 26 | { |
9f9900db BK |
27 | typedef tracker_allocator_counter counter_type; |
28 | ||
29 | counter_type::size_type | |
30 | counter_type::allocationCount_ = 0; | |
31 | ||
32 | counter_type::size_type | |
33 | counter_type::deallocationCount_ = 0; | |
34 | ||
35 | int counter_type::constructCount_ = 0; | |
36 | int counter_type::destructCount_ = 0; | |
1985f1cd MA |
37 | |
38 | bool | |
39 | check_construct_destroy(const char* tag, int expected_c, int expected_d) | |
40 | { | |
9f9900db BK |
41 | bool ret = true; |
42 | if (counter_type::get_construct_count() != expected_c | |
43 | || counter_type::get_destruct_count() != expected_d) | |
44 | { | |
45 | std::cerr << tag << ": " | |
46 | << " construct = " << counter_type::get_construct_count() | |
47 | << " (should be " << expected_c << ")," | |
48 | << " destroy = " << counter_type::get_destruct_count() | |
49 | << " (should be " << expected_d << ")" | |
50 | << std::endl; | |
51 | ret = false; | |
52 | } | |
53 | return ret; | |
1985f1cd | 54 | } |
799a6e36 | 55 | } // namespace __cxx_test |
162c7cd9 | 56 |