1 // 2004-08-25 Benjamin Kosnik <bkoz@redhat.com>
3 // Copyright (C) 2004, 2005 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 2, or (at your option)
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING. If not, write to the Free
18 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22 #include <ext/mt_allocator.h>
23 #include <testsuite_hooks.h>
24 #include <testsuite_character.h>
26 // Tune characteristics.
27 // __per_type_pool_policy
30 bool test __attribute__((unused)) = true;
32 typedef __gnu_test::pod_int value_type;
34 using __gnu_cxx::__pool;
35 using __gnu_cxx::__per_type_pool_policy;
38 typedef __per_type_pool_policy<value_type, __pool, true> policy_type;
40 typedef __per_type_pool_policy<value_type, __pool, false> policy_type;
42 typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type;
43 typedef __gnu_cxx::__pool_base::_Tune tune_type;
45 tune_type t_opt(16, 5120, 32, 5120, 20, 10, false);
46 tune_type t_single(16, 5120, 32, 5120, 1, 10, false);
49 tune_type t_default = a._M_get_options();
50 tune_type t1 = t_default;
51 a._M_set_options(t_opt);
52 tune_type t2 = a._M_get_options();
53 VERIFY( t1._M_align != t2._M_align );
55 allocator_type::pointer p1 = a.allocate(128);
56 allocator_type::pointer p2 = a.allocate(5128);
57 a._M_set_options(t_single);
58 t1 = a._M_get_options();
59 VERIFY( t1._M_max_threads != t_single._M_max_threads );
60 VERIFY( t1._M_max_threads == t_opt._M_max_threads );
62 a.deallocate(p1, 128);
63 a.deallocate(p2, 5128);