Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/8613_loadeventnexus_empt…
Browse files Browse the repository at this point in the history
…y_bank_failure'
  • Loading branch information
Michael Reuter committed Dec 13, 2013
2 parents db0031b + 27cfa20 commit 0aac32d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
5 changes: 0 additions & 5 deletions Code/Mantid/Framework/DataHandling/src/LoadEventNexus.cpp
Expand Up @@ -1425,11 +1425,6 @@ void LoadEventNexus::loadEvents(API::Progress * const prog, const bool monitors)

// get the number of events
std::size_t num = numEvents(file, hasTotalCounts, oldNeXusFileNames);
if (num == 0)
{
file.closeGroup();
continue;
}
bankNames.push_back( entry_name );
bankNumEvents.push_back(num);
total_events += num;
Expand Down
18 changes: 18 additions & 0 deletions Code/Mantid/Framework/DataHandling/test/LoadEventNexusTest.h
Expand Up @@ -332,6 +332,24 @@ class LoadEventNexusTest : public CxxTest::TestSuite
doTestSingleBank(false, false, "bankDoesNotExist", true);
}

void test_SingleBank_with_no_events()
{
LoadEventNexus load;
TS_ASSERT_THROWS_NOTHING( load.initialize() );
TS_ASSERT_THROWS_NOTHING( load.setPropertyValue("Filename", "HYSA_12509.nxs.h5") );
TS_ASSERT_THROWS_NOTHING( load.setPropertyValue("BankName", "bank10") );
const std::string outws("AnEmptyWS");
TS_ASSERT_THROWS_NOTHING( load.setPropertyValue("OutputWorkspace", outws) );
if ( !load.execute() )
{
TS_FAIL("LoadEventNexus shouldn't fail to load an empty bank");
return;
}

auto ws = AnalysisDataService::Instance().retrieveWS<EventWorkspace>(outws);
TS_ASSERT_EQUALS( ws->getNumberEvents(), 0 );
}

void test_instrument_inside_nexus_file()
{
LoadEventNexus load;
Expand Down

0 comments on commit 0aac32d

Please sign in to comment.