Make locale constructors tests use count_new.hpp

llvm-svn: 273375
This commit is contained in:
Eric Fiselier 2016-06-22 04:34:24 +00:00
parent cc4162293f
commit 739cc95471
8 changed files with 18 additions and 129 deletions

View File

@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// REQUIRES: locale.ru_RU.UTF-8
// UNSUPPORTED: sanitizer-new-delete
// <locale>
@ -18,21 +17,10 @@
#include <cassert>
#include <new>
#include "count_new.hpp"
#include "platform_support.h" // locale name macros
int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
return std::malloc(s);
}
void operator delete(void* p) throw()
{
--new_called;
std::free(p);
}
void check(const std::locale& loc)
{
@ -79,5 +67,5 @@ int main()
check(loc);
check(loc2);
}
assert(new_called == 0);
assert(globalMemCounter.checkOutstandingNewEq(0));
}

View File

@ -10,7 +10,6 @@
// XFAIL: libcpp-no-exceptions
// REQUIRES: locale.ru_RU.UTF-8
// REQUIRES: locale.zh_CN.UTF-8
// UNSUPPORTED: sanitizer-new-delete
// <locale>
@ -20,21 +19,9 @@
#include <new>
#include <cassert>
#include "count_new.hpp"
#include "platform_support.h" // locale name macros
int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
return std::malloc(s);
}
void operator delete(void* p) throw()
{
--new_called;
std::free(p);
}
void check(const std::locale& loc)
{
@ -101,5 +88,5 @@ int main()
}
std::locale ok("");
}
assert(new_called == 0);
assert(globalMemCounter.checkOutstandingNewEq(0));
}

View File

@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// REQUIRES: locale.fr_FR.UTF-8
// UNSUPPORTED: sanitizer-new-delete
// <locale>
@ -18,22 +17,9 @@
#include <cassert>
#include <new>
#include "count_new.hpp"
#include "platform_support.h" // locale name macros
int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
return std::malloc(s);
}
void operator delete(void* p) throw()
{
--new_called;
std::free(p);
}
void check(const std::locale& loc)
{
assert(std::has_facet<std::collate<char> >(loc));
@ -78,5 +64,5 @@ int main()
check(loc);
check(loc2);
}
assert(new_called == 0);
assert(globalMemCounter.checkOutstandingNewEq(0));
}

View File

@ -9,7 +9,6 @@
// REQUIRES: locale.en_US.UTF-8
// REQUIRES: locale.ru_RU.UTF-8
// UNSUPPORTED: sanitizer-new-delete
// <locale>
@ -19,22 +18,9 @@
#include <new>
#include <cassert>
#include "count_new.hpp"
#include "platform_support.h" // locale name macros
int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
return std::malloc(s);
}
void operator delete(void* p) throw()
{
--new_called;
std::free(p);
}
void check(const std::locale& loc)
{
assert(std::has_facet<std::collate<char> >(loc));
@ -78,5 +64,5 @@ int main()
std::locale loc2(loc, LOCALE_en_US_UTF_8, std::locale::monetary);
check(loc2);
}
assert(new_called == 0);
assert(globalMemCounter.checkOutstandingNewEq(0));
}

View File

@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// REQUIRES: locale.ru_RU.UTF-8
// UNSUPPORTED: sanitizer-new-delete
// <locale>
@ -18,21 +17,9 @@
#include <new>
#include <cassert>
#include "count_new.hpp"
#include "platform_support.h" // locale name macros
int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
return std::malloc(s);
}
void operator delete(void* p) throw()
{
--new_called;
std::free(p);
}
void check(const std::locale& loc)
{
@ -80,7 +67,6 @@ struct my_facet
std::locale::id my_facet::id;
int main()
{
{
{
std::locale loc(LOCALE_ru_RU_UTF_8);
@ -91,9 +77,7 @@ int main()
const my_facet& f = std::use_facet<my_facet>(loc2);
assert(f.test() == 5);
}
assert(new_called == 0);
}
{
assert(globalMemCounter.checkOutstandingNewEq(0));
{
std::locale loc;
check(loc);
@ -101,6 +85,5 @@ int main()
check(loc2);
assert(loc == loc2);
}
assert(new_called == 0);
}
assert(globalMemCounter.checkOutstandingNewEq(0));
}

View File

@ -9,7 +9,6 @@
// REQUIRES: locale.en_US.UTF-8
// REQUIRES: locale.ru_RU.UTF-8
// UNSUPPORTED: sanitizer-new-delete
// <locale>
@ -19,22 +18,9 @@
#include <new>
#include <cassert>
#include "count_new.hpp"
#include "platform_support.h" // locale name macros
int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
return std::malloc(s);
}
void operator delete(void* p) throw()
{
--new_called;
std::free(p);
}
void check(const std::locale& loc)
{
assert(std::has_facet<std::collate<char> >(loc));
@ -78,5 +64,5 @@ int main()
std::locale loc2(loc, std::locale(LOCALE_en_US_UTF_8), std::locale::monetary);
check(loc2);
}
assert(new_called == 0);
assert(globalMemCounter.checkOutstandingNewEq(0));
}

View File

@ -9,7 +9,6 @@
// REQUIRES: locale.en_US.UTF-8
// REQUIRES: locale.ru_RU.UTF-8
// UNSUPPORTED: sanitizer-new-delete
// <locale>
@ -19,21 +18,9 @@
#include <new>
#include <cassert>
#include "count_new.hpp"
#include "platform_support.h" // locale name macros
int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
return std::malloc(s);
}
void operator delete(void* p) throw()
{
--new_called;
std::free(p);
}
void check(const std::locale& loc)
{
@ -78,5 +65,5 @@ int main()
std::locale loc2(loc, std::string(LOCALE_en_US_UTF_8), std::locale::monetary);
check(loc2);
}
assert(new_called == 0);
assert(globalMemCounter.checkOutstandingNewEq(0));
}

View File

@ -9,7 +9,6 @@
// REQUIRES: locale.ru_RU.UTF-8
// REQUIRES: locale.zh_CN.UTF-8
// UNSUPPORTED: sanitizer-new-delete
// <locale>
@ -19,22 +18,9 @@
#include <new>
#include <cassert>
#include "count_new.hpp"
#include "platform_support.h" // locale name macros
int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
return std::malloc(s);
}
void operator delete(void* p) throw()
{
--new_called;
std::free(p);
}
void check(const std::locale& loc)
{
assert(std::has_facet<std::collate<char> >(loc));
@ -83,5 +69,5 @@ int main()
assert(!(loc == loc3));
assert(loc != loc3);
}
assert(new_called == 0);
assert(globalMemCounter.checkOutstandingNewEq(0));
}