Revert "Revert "Move more tests to globalMemCounter and reset.""

Test regressions not included this time :)

This reverts commit 1ed671082ef4b13d44e2c0f42ddedf9d450258a7.
This commit is contained in:
Dan Albert 2020-03-13 13:55:26 -07:00
parent aca7167535
commit 9c5d0ea678
19 changed files with 19 additions and 0 deletions

View File

@ -36,6 +36,7 @@ struct A
int main(int, char**)
{
new_handler_called = 0;
std::set_new_handler(my_new_handler);
#ifndef TEST_HAS_NO_EXCEPTIONS
try

View File

@ -45,6 +45,7 @@ struct A
int main(int, char**)
{
new_called = 0;
A *ap = new (std::nothrow) A[3];
DoNotOptimize(ap);
assert(ap);

View File

@ -46,6 +46,7 @@ struct A
int main(int, char**)
{
new_called = 0;
A *ap = new A[3];
DoNotOptimize(ap);
assert(ap);

View File

@ -45,6 +45,7 @@ struct A
int main(int, char**)
{
new_called = 0;
A *ap = new (std::nothrow) A;
DoNotOptimize(ap);
assert(ap);

View File

@ -44,6 +44,7 @@ struct A
int main(int, char**)
{
new_called = 0;
A *ap = new A;
DoNotOptimize(ap);
assert(ap);

View File

@ -28,6 +28,7 @@
int main(int, char**)
{
globalMemCounter.reset();
assert(globalMemCounter.checkOutstandingNewEq(0));
{
typedef std::codecvt_utf16<wchar_t> C;

View File

@ -28,6 +28,7 @@
int main(int, char**)
{
globalMemCounter.reset();
assert(globalMemCounter.checkOutstandingNewEq(0));
{
typedef std::codecvt_utf8<wchar_t> C;

View File

@ -23,6 +23,7 @@
int main(int, char**)
{
globalMemCounter.reset();
typedef std::wbuffer_convert<std::codecvt_utf8<wchar_t> > B;
#if TEST_STD_VER > 11
static_assert(!std::is_convertible<std::streambuf*, B>::value, "");

View File

@ -66,6 +66,7 @@ std::locale::id my_facet::id;
int main(int, char**)
{
{
globalMemCounter.reset();
{
std::locale loc;
std::locale loc2(loc, new my_facet);

View File

@ -59,6 +59,7 @@ int h(int) {return 1;}
int main(int, char**)
{
globalMemCounter.reset();
assert(globalMemCounter.checkOutstandingNewEq(0));
{
std::function<int(int)> f1 = A(1);

View File

@ -62,6 +62,7 @@ struct LValueCallable {
int main(int, char**)
{
globalMemCounter.reset();
assert(globalMemCounter.checkOutstandingNewEq(0));
{
std::function<int(int)> f = A();

View File

@ -65,6 +65,7 @@ struct LValueCallable {
int main(int, char**)
{
globalMemCounter.reset();
assert(globalMemCounter.checkOutstandingNewEq(0));
{
std::function<int(int)> f;

View File

@ -49,6 +49,7 @@ int g2(int, int) { return 2; }
int g3(int, int, int) { return 3; }
int main(int, char**) {
globalMemCounter.reset();
assert(globalMemCounter.checkOutstandingNewEq(0));
{
std::function<int(int)> f = A();

View File

@ -52,6 +52,7 @@ int g(int) {return 0;}
int main(int, char**)
{
globalMemCounter.reset();
assert(globalMemCounter.checkOutstandingNewEq(0));
{
std::function<int(int)> f = A();

View File

@ -50,6 +50,7 @@ int g(int) {return 0;}
int main(int, char**)
{
globalMemCounter.reset();
assert(globalMemCounter.checkOutstandingNewEq(0));
{
std::function<int(int)> f = A();

View File

@ -60,6 +60,7 @@ int g2(int, int) { return 2; }
int g3(int, int, int) { return 3; }
int main(int, char**) {
globalMemCounter.reset();
assert(globalMemCounter.checkOutstandingNewEq(0));
{
std::function<int(int)> f1 = A(1);

View File

@ -54,6 +54,7 @@ struct PrivateBase : private std::enable_shared_from_this<PrivateBase> {
int main(int, char**)
{
globalMemCounter.reset();
{ // https://bugs.llvm.org/show_bug.cgi?id=18843
std::shared_ptr<T const> t1(new T);
std::shared_ptr<T const> t2(std::make_shared<T>());

View File

@ -37,6 +37,7 @@ int A::count = 0;
int main(int, char**)
{
globalMemCounter.reset();
A* ptr = new A;
globalMemCounter.throw_after = 0;
try

View File

@ -37,6 +37,7 @@ int A::count = 0;
int main(int, char**)
{
globalMemCounter.reset();
A* ptr = new A;
assert(A::count == 1);
globalMemCounter.throw_after = 0;