From ac12410b279e2e96db33bb887314e3216837ba49 Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Sat, 6 Sep 2014 02:56:00 +0200 Subject: [PATCH] test: instantiating TestStorage dynamically Having the TestStorage as static field of the TestSuites caused problems in test startup, because the TestSuites are instantiated globally and for some reason the programm has trouble allocating memory when initializing the SearchIndex. --- src/test/GraphFilterConductorTestSuite.h | 10 ++++++---- src/test/GraphFilterTestSuite.h | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/test/GraphFilterConductorTestSuite.h b/src/test/GraphFilterConductorTestSuite.h index 94726f09..569c31cc 100644 --- a/src/test/GraphFilterConductorTestSuite.h +++ b/src/test/GraphFilterConductorTestSuite.h @@ -97,7 +97,7 @@ private: createTestStorage(); Graph result; - conductor.filter(&tree, &m_storage.getGraph(), &result); + conductor.filter(&tree, &m_storage->getGraph(), &result); std::stringstream ss; result.printBasic(ss); @@ -106,12 +106,14 @@ private: void createTestStorage() { - if (m_storage.getGraph().getNodeCount()) + if (m_storage) { return; } - m_storage.parseCxxCode( + m_storage = std::make_shared(); + + m_storage->parseCxxCode( "class A\n" "{\n" "public:\n" @@ -150,5 +152,5 @@ private: ); } - TestStorage m_storage; + std::shared_ptr m_storage; }; diff --git a/src/test/GraphFilterTestSuite.h b/src/test/GraphFilterTestSuite.h index 1e38274b..bc166e7b 100644 --- a/src/test/GraphFilterTestSuite.h +++ b/src/test/GraphFilterTestSuite.h @@ -177,7 +177,7 @@ private: createTestStorage(); Graph result; - filter->apply(&m_storage.getGraph(), &result); + filter->apply(&m_storage->getGraph(), &result); std::stringstream ss; result.printBasic(ss); @@ -186,12 +186,14 @@ private: void createTestStorage() { - if (m_storage.getGraph().getNodeCount()) + if (m_storage) { return; } - m_storage.parseCxxCode( + m_storage = std::make_shared(); + + m_storage->parseCxxCode( "class A\n" "{\n" "public:\n" @@ -230,5 +232,5 @@ private: ); } - TestStorage m_storage; + std::shared_ptr m_storage; };