Skip to content
Snippets Groups Projects
Commit 7da34a0b authored by Matt King's avatar Matt King
Browse files

Performance tests now running at .9s

Refs #14011
parent eb9d172a
No related branches found
No related tags found
No related merge requests found
...@@ -34,9 +34,9 @@ public: ...@@ -34,9 +34,9 @@ public:
* Input structure: * Input structure:
*------------------ *------------------
* ------------- * -------------
* | |///| | * | | |///| | |
* ------------- * ---------------------
* -3-2-1 0 1 2 3 * -5-4-3 2-1 0 1 2 3 4 5
*--------------------------- *---------------------------
* Expected output structure: * Expected output structure:
*---------------------------- *----------------------------
...@@ -51,13 +51,13 @@ public: ...@@ -51,13 +51,13 @@ public:
const size_t numDims = 1; const size_t numDims = 1;
const double signal = 0.0; const double signal = 0.0;
const double errorSquared = 1.3; const double errorSquared = 1.3;
size_t numBins[static_cast<int>(numDims)] = {3}; size_t numBins[static_cast<int>(numDims)] = {5};
Mantid::coord_t min[static_cast<int>(numDims)] = {-3}; Mantid::coord_t min[static_cast<int>(numDims)] = {-5};
Mantid::coord_t max[static_cast<int>(numDims)] = {3}; Mantid::coord_t max[static_cast<int>(numDims)] = {5};
const std::string name("test"); const std::string name("test");
auto inWS = MDEventsTestHelper::makeFakeMDHistoWorkspaceGeneral( auto inWS = MDEventsTestHelper::makeFakeMDHistoWorkspaceGeneral(
numDims, signal, errorSquared, numBins, min, max, name); numDims, signal, errorSquared, numBins, min, max, name);
inWS->setSignalAt(1, 1.0); // set middle bin signal to one inWS->setSignalAt(2, 1.0); // set middle bin signal to one
CompactMD alg; CompactMD alg;
alg.setChild(true); alg.setChild(true);
alg.setRethrows(true); alg.setRethrows(true);
...@@ -258,17 +258,37 @@ public: ...@@ -258,17 +258,37 @@ public:
const size_t numDims = 4; const size_t numDims = 4;
const double signal = 0.0; const double signal = 0.0;
const double errorSquared = 1.2; const double errorSquared = 1.2;
size_t numBins[static_cast<int>(numDims)] = {3, 3, 3, 3}; size_t numBins[static_cast<int>(numDims)] = {5, 10, 5, 10};
Mantid::coord_t min[static_cast<int>(numDims)] = {-3, -3, -3, -3}; Mantid::coord_t min[static_cast<int>(numDims)] = {-5, -10, -5, -10};
Mantid::coord_t max[static_cast<int>(numDims)] = {3, 3, 3, 3}; Mantid::coord_t max[static_cast<int>(numDims)] = {5, 10, 5, 10};
const std::string name("test"); const std::string name("test");
m_ws = MDEventsTestHelper::makeFakeMDHistoWorkspaceGeneral( m_ws = MDEventsTestHelper::makeFakeMDHistoWorkspaceGeneral(
numDims, signal, errorSquared, numBins, min, max, name); numDims, signal, errorSquared, numBins, min, max, name);
} }
void test_execute_4d() { void test_execute_4d() {
m_ws->setSignalAt(0, 1.0); // setting signals like this for variety
m_ws->setSignalAt(5, 1.2); auto iter = m_ws->createIterator();
m_ws->setSignalAt(1, 2.3); do {
auto index = iter->getLinearIndex();
if (index % 2 == 0) {
m_ws->setSignalAt(index, 1.0);
}
} while (iter->next());
CompactMD alg;
alg.setChild(true);
alg.setRethrows(true);
alg.initialize();
alg.setProperty("InputWorkspace", m_ws);
alg.setProperty("OutputWorkspace", "out");
alg.execute();
IMDHistoWorkspace_sptr outWS = alg.getProperty("OutputWorkspace");
TS_ASSERT(outWS);
}
void test_on_workspace_where_every_bin_has_non_zero_signal() {
auto iter = m_ws->createIterator();
do {
m_ws->setSignalAt(iter->getLinearIndex(), 1.0);
} while (iter->next());
CompactMD alg; CompactMD alg;
alg.setChild(true); alg.setChild(true);
alg.setRethrows(true); alg.setRethrows(true);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment