testsuite_allocator.h (check_delete): New.
2004-10-29 Benjamin Kosnik <bkoz@redhat.com> * testsuite/testsuite_allocator.h (check_delete): New. (check_new): Simplify. * testsuite/ext/array_allocator/check_delete.cc: New. * testsuite/ext/array_allocator/check_new.cc: Simplify. * testsuite/ext/debug_allocator/check_delete.cc: New. * testsuite/ext/debug_allocator/check_new.cc: Simplify. * testsuite/ext/malloc_allocator/check_delete.cc: New. * testsuite/ext/malloc_allocator/check_new.cc: Simplify. * testsuite/ext/mt_allocator/check_delete.cc: New. * testsuite/ext/mt_allocator/check_new.cc: Simplify. * testsuite/ext/new_allocator/check_delete.cc: New. * testsuite/ext/new_allocator/check_new.cc: Simplify. * testsuite/ext/pool_allocator/check_delete.cc: New. * testsuite/ext/pool_allocator/check_new.cc: Simplify. From-SVN: r89850
This commit is contained in:
parent
bd004fefff
commit
a53f986f91
@ -1,3 +1,20 @@
|
||||
2004-10-29 Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
* testsuite/testsuite_allocator.h (check_delete): New.
|
||||
(check_new): Simplify.
|
||||
* testsuite/ext/array_allocator/check_delete.cc: New.
|
||||
* testsuite/ext/array_allocator/check_new.cc: Simplify.
|
||||
* testsuite/ext/debug_allocator/check_delete.cc: New.
|
||||
* testsuite/ext/debug_allocator/check_new.cc: Simplify.
|
||||
* testsuite/ext/malloc_allocator/check_delete.cc: New.
|
||||
* testsuite/ext/malloc_allocator/check_new.cc: Simplify.
|
||||
* testsuite/ext/mt_allocator/check_delete.cc: New.
|
||||
* testsuite/ext/mt_allocator/check_new.cc: Simplify.
|
||||
* testsuite/ext/new_allocator/check_delete.cc: New.
|
||||
* testsuite/ext/new_allocator/check_new.cc: Simplify.
|
||||
* testsuite/ext/pool_allocator/check_delete.cc: New.
|
||||
* testsuite/ext/pool_allocator/check_new.cc: Simplify.
|
||||
|
||||
2004-10-28 Chris Jefferson <chris@bubblescope.net>
|
||||
|
||||
PR libstdc++/18159
|
||||
|
61
libstdc++-v3/testsuite/ext/array_allocator/check_delete.cc
Normal file
61
libstdc++-v3/testsuite/ext/array_allocator/check_delete.cc
Normal file
@ -0,0 +1,61 @@
|
||||
// 2001-11-25 Phil Edwards <pme@gcc.gnu.org>
|
||||
//
|
||||
// Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
// USA.
|
||||
|
||||
// 20.4.1.1 allocator members
|
||||
|
||||
#include <cstdlib>
|
||||
#include <ext/array_allocator.h>
|
||||
#include <testsuite_hooks.h>
|
||||
#include <testsuite_allocator.h>
|
||||
|
||||
using __gnu_cxx::array_allocator;
|
||||
|
||||
void*
|
||||
operator new(std::size_t n) throw(std::bad_alloc)
|
||||
{
|
||||
new_called = true;
|
||||
return std::malloc(n);
|
||||
}
|
||||
|
||||
void
|
||||
operator delete(void *v) throw()
|
||||
{
|
||||
delete_called = true;
|
||||
return std::free(v);
|
||||
}
|
||||
|
||||
// These just help tracking down error messages.
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef unsigned int value_type;
|
||||
typedef std::tr1::array<value_type, 15> array_type;
|
||||
typedef array_allocator<value_type, array_type> allocator_type;
|
||||
array_type store;
|
||||
allocator_type a(&store);
|
||||
VERIFY( bool(__gnu_test::check_delete<allocator_type, false>(a)) );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include <cstdlib>
|
||||
#include <ext/array_allocator.h>
|
||||
#include <testsuite_hooks.h>
|
||||
#include <testsuite_allocator.h>
|
||||
|
||||
using __gnu_cxx::array_allocator;
|
||||
@ -30,7 +31,6 @@ void*
|
||||
operator new(std::size_t n) throw(std::bad_alloc)
|
||||
{
|
||||
new_called = true;
|
||||
requested = n;
|
||||
return std::malloc(n);
|
||||
}
|
||||
|
||||
@ -42,18 +42,20 @@ operator delete(void *v) throw()
|
||||
}
|
||||
|
||||
// These just help tracking down error messages.
|
||||
bool test01()
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef unsigned int value_type;
|
||||
typedef std::tr1::array<value_type, 15> array_type;
|
||||
typedef array_allocator<value_type, array_type> allocator_type;
|
||||
array_type store;
|
||||
allocator_type a(&store);
|
||||
return (__gnu_test::check_new<allocator_type, false>(a) == false);
|
||||
VERIFY( bool(__gnu_test::check_new<allocator_type, false>(a)) );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
return test01();
|
||||
test01();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
59
libstdc++-v3/testsuite/ext/debug_allocator/check_delete.cc
Normal file
59
libstdc++-v3/testsuite/ext/debug_allocator/check_delete.cc
Normal file
@ -0,0 +1,59 @@
|
||||
// 2001-11-25 Phil Edwards <pme@gcc.gnu.org>
|
||||
//
|
||||
// Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
// USA.
|
||||
|
||||
// 20.4.1.1 allocator members
|
||||
|
||||
#include <cstdlib>
|
||||
#include <ext/debug_allocator.h>
|
||||
#include <ext/malloc_allocator.h>
|
||||
#include <testsuite_hooks.h>
|
||||
#include <testsuite_allocator.h>
|
||||
|
||||
using __gnu_cxx::malloc_allocator;
|
||||
using __gnu_cxx::debug_allocator;
|
||||
|
||||
void*
|
||||
operator new(std::size_t n) throw(std::bad_alloc)
|
||||
{
|
||||
new_called = true;
|
||||
return std::malloc(n);
|
||||
}
|
||||
|
||||
void
|
||||
operator delete(void *v) throw()
|
||||
{
|
||||
delete_called = true;
|
||||
return std::free(v);
|
||||
}
|
||||
|
||||
// These just help tracking down error messages.
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef debug_allocator<malloc_allocator<unsigned int> > allocator_type;
|
||||
VERIFY( bool(__gnu_test::check_delete<allocator_type, false>()) );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <cstdlib>
|
||||
#include <ext/debug_allocator.h>
|
||||
#include <ext/malloc_allocator.h>
|
||||
#include <testsuite_hooks.h>
|
||||
#include <testsuite_allocator.h>
|
||||
|
||||
using __gnu_cxx::malloc_allocator;
|
||||
@ -32,7 +33,6 @@ void*
|
||||
operator new(std::size_t n) throw(std::bad_alloc)
|
||||
{
|
||||
new_called = true;
|
||||
requested = n;
|
||||
return std::malloc(n);
|
||||
}
|
||||
|
||||
@ -43,14 +43,17 @@ operator delete(void *v) throw()
|
||||
return std::free(v);
|
||||
}
|
||||
|
||||
bool test02()
|
||||
// These just help tracking down error messages.
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef debug_allocator<malloc_allocator<unsigned int> > allocator_type;
|
||||
return (__gnu_test::check_new<allocator_type, false>() == false);
|
||||
VERIFY( bool(__gnu_test::check_new<allocator_type, false>()) );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
return test02();
|
||||
test01();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
57
libstdc++-v3/testsuite/ext/malloc_allocator/check_delete.cc
Normal file
57
libstdc++-v3/testsuite/ext/malloc_allocator/check_delete.cc
Normal file
@ -0,0 +1,57 @@
|
||||
// 2001-11-25 Phil Edwards <pme@gcc.gnu.org>
|
||||
//
|
||||
// Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
// USA.
|
||||
|
||||
// 20.4.1.1 allocator members
|
||||
|
||||
#include <cstdlib>
|
||||
#include <ext/malloc_allocator.h>
|
||||
#include <testsuite_hooks.h>
|
||||
#include <testsuite_allocator.h>
|
||||
|
||||
using __gnu_cxx::malloc_allocator;
|
||||
|
||||
void*
|
||||
operator new(std::size_t n) throw(std::bad_alloc)
|
||||
{
|
||||
new_called = true;
|
||||
return std::malloc(n);
|
||||
}
|
||||
|
||||
void
|
||||
operator delete(void *v) throw()
|
||||
{
|
||||
delete_called = true;
|
||||
return std::free(v);
|
||||
}
|
||||
|
||||
// These just help tracking down error messages.
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef malloc_allocator<unsigned int> allocator_type;
|
||||
VERIFY( bool(__gnu_test::check_delete<allocator_type, false>()) );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include <cstdlib>
|
||||
#include <ext/malloc_allocator.h>
|
||||
#include <testsuite_hooks.h>
|
||||
#include <testsuite_allocator.h>
|
||||
|
||||
using __gnu_cxx::malloc_allocator;
|
||||
@ -30,7 +31,6 @@ void*
|
||||
operator new(std::size_t n) throw(std::bad_alloc)
|
||||
{
|
||||
new_called = true;
|
||||
requested = n;
|
||||
return std::malloc(n);
|
||||
}
|
||||
|
||||
@ -42,14 +42,16 @@ operator delete(void *v) throw()
|
||||
}
|
||||
|
||||
// These just help tracking down error messages.
|
||||
bool test01()
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef malloc_allocator<unsigned int> allocator_type;
|
||||
return (__gnu_test::check_new<allocator_type, false>() == false);
|
||||
VERIFY( bool(__gnu_test::check_new<allocator_type, false>()) );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
return test01();
|
||||
test01();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
55
libstdc++-v3/testsuite/ext/mt_allocator/check_delete.cc
Normal file
55
libstdc++-v3/testsuite/ext/mt_allocator/check_delete.cc
Normal file
@ -0,0 +1,55 @@
|
||||
// 2001-11-25 Phil Edwards <pme@gcc.gnu.org>
|
||||
//
|
||||
// Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
// USA.
|
||||
|
||||
// 20.4.1.1 allocator members
|
||||
|
||||
#include <cstdlib>
|
||||
#include <ext/mt_allocator.h>
|
||||
#include <testsuite_hooks.h>
|
||||
#include <testsuite_allocator.h>
|
||||
|
||||
using __gnu_cxx::__mt_alloc;
|
||||
|
||||
void*
|
||||
operator new(std::size_t n) throw(std::bad_alloc)
|
||||
{
|
||||
new_called = true;
|
||||
return std::malloc(n);
|
||||
}
|
||||
|
||||
void
|
||||
operator delete(void* v) throw()
|
||||
{
|
||||
delete_called = true;
|
||||
return std::free(v);
|
||||
}
|
||||
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef __mt_alloc<unsigned int> allocator_type;
|
||||
VERIFY( bool(__gnu_test::check_delete<allocator_type, false>()) );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include <cstdlib>
|
||||
#include <ext/mt_allocator.h>
|
||||
#include <testsuite_hooks.h>
|
||||
#include <testsuite_allocator.h>
|
||||
|
||||
using __gnu_cxx::__mt_alloc;
|
||||
@ -30,7 +31,6 @@ void*
|
||||
operator new(std::size_t n) throw(std::bad_alloc)
|
||||
{
|
||||
new_called = true;
|
||||
requested = n;
|
||||
return std::malloc(n);
|
||||
}
|
||||
|
||||
@ -41,14 +41,16 @@ operator delete(void *v) throw()
|
||||
return std::free(v);
|
||||
}
|
||||
|
||||
bool test03()
|
||||
void test01()
|
||||
{
|
||||
// Uses new but delete only optionally.
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef __mt_alloc<unsigned int> allocator_type;
|
||||
return (__gnu_test::check_new<allocator_type, true>() == true);
|
||||
VERIFY( bool(__gnu_test::check_new<allocator_type, true>()) );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
return test03();
|
||||
test01();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
57
libstdc++-v3/testsuite/ext/new_allocator/check_delete.cc
Normal file
57
libstdc++-v3/testsuite/ext/new_allocator/check_delete.cc
Normal file
@ -0,0 +1,57 @@
|
||||
// 2001-11-25 Phil Edwards <pme@gcc.gnu.org>
|
||||
//
|
||||
// Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
// USA.
|
||||
|
||||
// 20.4.1.1 allocator members
|
||||
|
||||
#include <cstdlib>
|
||||
#include <ext/new_allocator.h>
|
||||
#include <testsuite_hooks.h>
|
||||
#include <testsuite_allocator.h>
|
||||
|
||||
using __gnu_cxx::new_allocator;
|
||||
|
||||
void*
|
||||
operator new(std::size_t n) throw(std::bad_alloc)
|
||||
{
|
||||
new_called = true;
|
||||
return std::malloc(n);
|
||||
}
|
||||
|
||||
void
|
||||
operator delete(void *v) throw()
|
||||
{
|
||||
delete_called = true;
|
||||
return std::free(v);
|
||||
}
|
||||
|
||||
// These just help tracking down error messages.
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef new_allocator<unsigned int> allocator_type;
|
||||
VERIFY( bool(__gnu_test::check_delete<allocator_type, true>()) );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include <cstdlib>
|
||||
#include <ext/new_allocator.h>
|
||||
#include <testsuite_hooks.h>
|
||||
#include <testsuite_allocator.h>
|
||||
|
||||
using __gnu_cxx::new_allocator;
|
||||
@ -30,7 +31,6 @@ void*
|
||||
operator new(std::size_t n) throw(std::bad_alloc)
|
||||
{
|
||||
new_called = true;
|
||||
requested = n;
|
||||
return std::malloc(n);
|
||||
}
|
||||
|
||||
@ -42,14 +42,16 @@ operator delete(void *v) throw()
|
||||
}
|
||||
|
||||
// These just help tracking down error messages.
|
||||
bool test01()
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef new_allocator<unsigned int> allocator_type;
|
||||
return (__gnu_test::check_new<allocator_type, true>() == true);
|
||||
VERIFY( bool(__gnu_test::check_new<allocator_type, true>()) );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
return test01();
|
||||
test01();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
57
libstdc++-v3/testsuite/ext/pool_allocator/check_delete.cc
Normal file
57
libstdc++-v3/testsuite/ext/pool_allocator/check_delete.cc
Normal file
@ -0,0 +1,57 @@
|
||||
// 2001-11-25 Phil Edwards <pme@gcc.gnu.org>
|
||||
//
|
||||
// Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
// USA.
|
||||
|
||||
// 20.4.1.1 allocator members
|
||||
|
||||
#include <cstdlib>
|
||||
#include <ext/pool_allocator.h>
|
||||
#include <testsuite_hooks.h>
|
||||
#include <testsuite_allocator.h>
|
||||
|
||||
using __gnu_cxx::__pool_alloc;
|
||||
|
||||
void*
|
||||
operator new(std::size_t n) throw(std::bad_alloc)
|
||||
{
|
||||
new_called = true;
|
||||
return std::malloc(n);
|
||||
}
|
||||
|
||||
void
|
||||
operator delete(void *v) throw()
|
||||
{
|
||||
delete_called = true;
|
||||
return std::free(v);
|
||||
}
|
||||
|
||||
void test01()
|
||||
{
|
||||
// Uses new, but delete only sometimes.
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef __pool_alloc<unsigned int> allocator_type;
|
||||
VERIFY( bool(__gnu_test::check_delete<allocator_type, false>()) );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include <cstdlib>
|
||||
#include <ext/pool_allocator.h>
|
||||
#include <testsuite_hooks.h>
|
||||
#include <testsuite_allocator.h>
|
||||
|
||||
using __gnu_cxx::__pool_alloc;
|
||||
@ -30,7 +31,6 @@ void*
|
||||
operator new(std::size_t n) throw(std::bad_alloc)
|
||||
{
|
||||
new_called = true;
|
||||
requested = n;
|
||||
return std::malloc(n);
|
||||
}
|
||||
|
||||
@ -41,14 +41,16 @@ operator delete(void *v) throw()
|
||||
return std::free(v);
|
||||
}
|
||||
|
||||
bool test03()
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef __pool_alloc<unsigned int> allocator_type;
|
||||
return (__gnu_test::check_new<allocator_type, true>() == true);
|
||||
VERIFY( bool(__gnu_test::check_new<allocator_type, true>()) );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
return test03();
|
||||
test01();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,6 @@ namespace
|
||||
{
|
||||
bool new_called = false;
|
||||
bool delete_called = false;
|
||||
std::size_t requested = 0;
|
||||
};
|
||||
|
||||
namespace __gnu_test
|
||||
@ -180,19 +179,24 @@ namespace __gnu_test
|
||||
bool
|
||||
check_construct_destroy(const char* tag, int expected_c, int expected_d);
|
||||
|
||||
template<typename Alloc, bool uses_global_new_and_delete>
|
||||
template<typename Alloc, bool uses_global_new>
|
||||
bool
|
||||
check_new(Alloc a = Alloc())
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typename Alloc::pointer p = a.allocate(10);
|
||||
if (uses_global_new_and_delete)
|
||||
test &= ( requested >= (10 * 15 * sizeof(long)) );
|
||||
test &= ( new_called == uses_global_new );
|
||||
return test;
|
||||
}
|
||||
|
||||
test &= ( new_called == uses_global_new_and_delete );
|
||||
template<typename Alloc, bool uses_global_delete>
|
||||
bool
|
||||
check_delete(Alloc a = Alloc())
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typename Alloc::pointer p = a.allocate(10);
|
||||
a.deallocate(p, 10);
|
||||
test &= ( delete_called == uses_global_new_and_delete );
|
||||
|
||||
test &= ( delete_called == uses_global_delete );
|
||||
return test;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user