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.
This commit is contained in:
Eberhard Graether
2014-09-06 02:56:00 +02:00
parent 4fd1f330ed
commit ac12410b27
2 changed files with 12 additions and 8 deletions
+6 -4
View File
@@ -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<TestStorage>();
m_storage->parseCxxCode(
"class A\n"
"{\n"
"public:\n"
@@ -150,5 +152,5 @@ private:
);
}
TestStorage m_storage;
std::shared_ptr<TestStorage> m_storage;
};
+6 -4
View File
@@ -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<TestStorage>();
m_storage->parseCxxCode(
"class A\n"
"{\n"
"public:\n"
@@ -230,5 +232,5 @@ private:
);
}
TestStorage m_storage;
std::shared_ptr<TestStorage> m_storage;
};