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:
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user