Commit 3641bd55 by Paolo Carlini Committed by Paolo Carlini

tune-1.cc: Use VERIFY, clean up a bit.

2004-09-17  Paolo Carlini  <pcarlini@suse.de>

	* testsuite/ext/mt_allocator/tune-1.cc: Use VERIFY, clean
	up a bit.
	* testsuite/ext/mt_allocator/tune-2.cc: Likewise.
	* testsuite/ext/mt_allocator/tune-3.cc: Likewise.
	* testsuite/ext/mt_allocator/tune-4.cc: Likewise.

From-SVN: r87638
parent b01d837f
2004-09-17 Paolo Carlini <pcarlini@suse.de> 2004-09-17 Paolo Carlini <pcarlini@suse.de>
* testsuite/ext/mt_allocator/tune-1.cc: Use VERIFY, clean
up a bit.
* testsuite/ext/mt_allocator/tune-2.cc: Likewise.
* testsuite/ext/mt_allocator/tune-3.cc: Likewise.
* testsuite/ext/mt_allocator/tune-4.cc: Likewise.
2004-09-17 Paolo Carlini <pcarlini@suse.de>
Andrea Arcangeli <andrea@suse.de> Andrea Arcangeli <andrea@suse.de>
* config/io/basic_file_stdio.cc (__basic_file<>::close)): Don't * config/io/basic_file_stdio.cc (__basic_file<>::close)): Don't
......
...@@ -18,20 +18,17 @@ ...@@ -18,20 +18,17 @@
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA. // USA.
#include <cassert> #include <testsuite_hooks.h>
#include <memory> #include <memory>
#include <ext/mt_allocator.h> #include <ext/mt_allocator.h>
struct pod
{
int i;
};
// Tune characteristics. // Tune characteristics.
// __common_pool_policy // __common_pool_policy
void test01() void test01()
{ {
typedef pod value_type; bool test __attribute__((unused)) = true;
typedef __gnu_test::pod_int value_type;
#ifdef __GTHREADS #ifdef __GTHREADS
typedef __gnu_cxx::__common_pool_policy<true> policy_type; typedef __gnu_cxx::__common_pool_policy<true> policy_type;
#else #else
...@@ -46,17 +43,17 @@ void test01() ...@@ -46,17 +43,17 @@ void test01()
allocator_type a; allocator_type a;
tune_type t1 = a._M_get_options(); tune_type t1 = a._M_get_options();
assert(t1._M_align == t_default._M_align); VERIFY( t1._M_align == t_default._M_align );
a._M_set_options(t_opt); a._M_set_options(t_opt);
tune_type t2 = a._M_get_options(); tune_type t2 = a._M_get_options();
assert(t1._M_align != t2._M_align); VERIFY( t1._M_align != t2._M_align );
allocator_type::pointer p1 = a.allocate(128); allocator_type::pointer p1 = a.allocate(128);
allocator_type::pointer p2 = a.allocate(5128); allocator_type::pointer p2 = a.allocate(5128);
a._M_set_options(t_single); a._M_set_options(t_single);
t1 = a._M_get_options(); t1 = a._M_get_options();
assert(t1._M_max_threads != t_single._M_max_threads); VERIFY( t1._M_max_threads != t_single._M_max_threads );
assert(t1._M_max_threads == t_opt._M_max_threads); VERIFY( t1._M_max_threads == t_opt._M_max_threads );
a.deallocate(p1, 128); a.deallocate(p1, 128);
a.deallocate(p2, 5128); a.deallocate(p2, 5128);
......
...@@ -18,20 +18,17 @@ ...@@ -18,20 +18,17 @@
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA. // USA.
#include <cassert> #include <testsuite_hooks.h>
#include <memory> #include <memory>
#include <ext/mt_allocator.h> #include <ext/mt_allocator.h>
struct pod
{
int i;
};
// Tune characteristics. // Tune characteristics.
// __per_type_pool_policy // __per_type_pool_policy
void test02() void test02()
{ {
typedef pod value_type; bool test __attribute__((unused)) = true;
typedef __gnu_test::pod_int value_type;
#ifdef __GTHREADS #ifdef __GTHREADS
typedef __gnu_cxx::__per_type_pool_policy<value_type, true> policy_type; typedef __gnu_cxx::__per_type_pool_policy<value_type, true> policy_type;
#else #else
...@@ -46,23 +43,22 @@ void test02() ...@@ -46,23 +43,22 @@ void test02()
allocator_type a; allocator_type a;
tune_type t1 = a._M_get_options(); tune_type t1 = a._M_get_options();
assert(t1._M_align == t_default._M_align); VERIFY( t1._M_align == t_default._M_align );
a._M_set_options(t_opt); a._M_set_options(t_opt);
tune_type t2 = a._M_get_options(); tune_type t2 = a._M_get_options();
assert(t1._M_align != t2._M_align); VERIFY( t1._M_align != t2._M_align );
allocator_type::pointer p1 = a.allocate(128); allocator_type::pointer p1 = a.allocate(128);
allocator_type::pointer p2 = a.allocate(5128); allocator_type::pointer p2 = a.allocate(5128);
a._M_set_options(t_single); a._M_set_options(t_single);
t1 = a._M_get_options(); t1 = a._M_get_options();
assert(t1._M_max_threads != t_single._M_max_threads); VERIFY( t1._M_max_threads != t_single._M_max_threads );
assert(t1._M_max_threads == t_opt._M_max_threads); VERIFY( t1._M_max_threads == t_opt._M_max_threads );
a.deallocate(p1, 128); a.deallocate(p1, 128);
a.deallocate(p2, 5128); a.deallocate(p2, 5128);
} }
int main() int main()
{ {
test02(); test02();
......
...@@ -18,15 +18,10 @@ ...@@ -18,15 +18,10 @@
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA. // USA.
#include <cassert> #include <testsuite_hooks.h>
#include <memory> #include <memory>
#include <ext/mt_allocator.h> #include <ext/mt_allocator.h>
struct pod
{
int i;
};
// Tune characteristics, two of same type // Tune characteristics, two of same type
template<typename _Tp> template<typename _Tp>
struct test_policy struct test_policy
...@@ -43,6 +38,8 @@ struct test_policy<__gnu_cxx::__common_pool_policy<_Thread> > ...@@ -43,6 +38,8 @@ struct test_policy<__gnu_cxx::__common_pool_policy<_Thread> >
template<typename _Tp, typename _Cp> template<typename _Tp, typename _Cp>
void test03() void test03()
{ {
bool test __attribute__((unused)) = true;
typedef __gnu_cxx::__pool_base::_Tune tune_type; typedef __gnu_cxx::__pool_base::_Tune tune_type;
typedef _Tp value_type; typedef _Tp value_type;
typedef _Cp policy_type; typedef _Cp policy_type;
...@@ -58,29 +55,28 @@ void test03() ...@@ -58,29 +55,28 @@ void test03()
tune_type t2; tune_type t2;
if (test_policy<policy_type>::per_type()) if (test_policy<policy_type>::per_type())
{ {
assert(t1._M_align == t_default._M_align); VERIFY( t1._M_align == t_default._M_align );
a._M_set_options(t_opt); a._M_set_options(t_opt);
t2 = a._M_get_options(); t2 = a._M_get_options();
assert(t1._M_align != t2._M_align); VERIFY( t1._M_align != t2._M_align );
} }
else else
t2 = t1; t2 = t1;
// Lock tune settings. // Lock tune settings.
typename allocator_type::pointer p1 = a.allocate(128); typename allocator_type::pointer p1 = a.allocate(128);
allocator_type a2; allocator_type a2;
tune_type t3 = a2._M_get_options(); tune_type t3 = a2._M_get_options();
tune_type t4; tune_type t4;
assert(t3._M_max_threads == t2._M_max_threads); VERIFY( t3._M_max_threads == t2._M_max_threads );
typename allocator_type::pointer p2 = a2.allocate(5128); typename allocator_type::pointer p2 = a2.allocate(5128);
a2._M_set_options(t_single); a2._M_set_options(t_single);
t4 = a2._M_get_options(); t4 = a2._M_get_options();
assert(t4._M_max_threads != t_single._M_max_threads); VERIFY( t4._M_max_threads != t_single._M_max_threads );
assert(t4._M_max_threads == t3._M_max_threads); VERIFY( t4._M_max_threads == t3._M_max_threads );
a.deallocate(p1, 128); a.deallocate(p1, 128);
a2.deallocate(p2, 5128); a2.deallocate(p2, 5128);
......
...@@ -18,15 +18,10 @@ ...@@ -18,15 +18,10 @@
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA. // USA.
#include <cassert> #include <testsuite_hooks.h>
#include <memory> #include <memory>
#include <ext/mt_allocator.h> #include <ext/mt_allocator.h>
struct pod
{
int i;
};
// Tune characteristics, two of same type // Tune characteristics, two of same type
template<typename _Tp> template<typename _Tp>
struct test_policy struct test_policy
...@@ -49,6 +44,8 @@ struct pod2 ...@@ -49,6 +44,8 @@ struct pod2
template<typename _Tp, typename _Cp> template<typename _Tp, typename _Cp>
void test04() void test04()
{ {
bool test __attribute__((unused)) = true;
typedef __gnu_cxx::__pool_base::_Tune tune_type; typedef __gnu_cxx::__pool_base::_Tune tune_type;
typedef _Tp value_type; typedef _Tp value_type;
typedef _Cp policy_type; typedef _Cp policy_type;
...@@ -63,10 +60,10 @@ void test04() ...@@ -63,10 +60,10 @@ void test04()
tune_type t2; tune_type t2;
if (test_policy<policy_type>::per_type()) if (test_policy<policy_type>::per_type())
{ {
assert(t1._M_align == t_default._M_align); VERIFY( t1._M_align == t_default._M_align );
a._M_set_options(t_opt); a._M_set_options(t_opt);
t2 = a._M_get_options(); t2 = a._M_get_options();
assert(t1._M_align != t2._M_align); VERIFY( t1._M_align != t2._M_align );
} }
else else
t2 = t1; t2 = t1;
...@@ -85,21 +82,21 @@ void test04() ...@@ -85,21 +82,21 @@ void test04()
// Both policy_type and rebind_type::policy_type have same characteristics. // Both policy_type and rebind_type::policy_type have same characteristics.
if (test_policy<policy_type>::per_type()) if (test_policy<policy_type>::per_type())
{ {
assert(t3._M_align == t_default._M_align); VERIFY( t3._M_align == t_default._M_align );
a2._M_set_options(t_opt); a2._M_set_options(t_opt);
t4 = a2._M_get_options(); t4 = a2._M_get_options();
assert(t3._M_align != t4._M_align); VERIFY( t3._M_align != t4._M_align );
t3 = t4; t3 = t4;
} }
else else
assert(t3._M_max_threads == t2._M_max_threads); VERIFY( t3._M_max_threads == t2._M_max_threads );
typename rebind_type::pointer p2 = a2.allocate(5128); typename rebind_type::pointer p2 = a2.allocate(5128);
a2._M_set_options(t_single); a2._M_set_options(t_single);
t4 = a2._M_get_options(); t4 = a2._M_get_options();
assert(t4._M_max_threads != t_single._M_max_threads); VERIFY( t4._M_max_threads != t_single._M_max_threads );
assert(t4._M_max_threads == t3._M_max_threads); VERIFY( t4._M_max_threads == t3._M_max_threads );
a.deallocate(p1, 128); a.deallocate(p1, 128);
a2.deallocate(p2, 5128); a2.deallocate(p2, 5128);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment