Skip to content

Commit

Permalink
Revert "Revert "Move more tests to globalMemCounter and reset.""
Browse files Browse the repository at this point in the history
Test regressions not included this time :)

This reverts commit 1ed671082ef4b13d44e2c0f42ddedf9d450258a7.
  • Loading branch information
DanAlbert committed Mar 14, 2020
1 parent aca7167 commit 9c5d0ea
Show file tree
Hide file tree
Showing 19 changed files with 19 additions and 0 deletions.
Expand Up @@ -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
Expand Down
Expand Up @@ -45,6 +45,7 @@ struct A

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

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

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

int main(int, char**)
{
new_called = 0;
A *ap = new A;
DoNotOptimize(ap);
assert(ap);
Expand Down
Expand Up @@ -28,6 +28,7 @@

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

int main(int, char**)
{
globalMemCounter.reset();
assert(globalMemCounter.checkOutstandingNewEq(0));
{
typedef std::codecvt_utf8<wchar_t> C;
Expand Down
Expand Up @@ -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, "");
Expand Down
Expand Up @@ -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);
Expand Down
Expand Up @@ -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);
Expand Down
Expand Up @@ -62,6 +62,7 @@ struct LValueCallable {

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

int main(int, char**)
{
globalMemCounter.reset();
assert(globalMemCounter.checkOutstandingNewEq(0));
{
std::function<int(int)> f;
Expand Down
Expand Up @@ -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();
Expand Down
Expand Up @@ -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();
Expand Down
Expand Up @@ -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();
Expand Down
Expand Up @@ -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);
Expand Down
Expand Up @@ -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>());
Expand Down
Expand Up @@ -37,6 +37,7 @@ int A::count = 0;

int main(int, char**)
{
globalMemCounter.reset();
A* ptr = new A;
globalMemCounter.throw_after = 0;
try
Expand Down
Expand Up @@ -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;
Expand Down

0 comments on commit 9c5d0ea

Please sign in to comment.