Skip to content

Commit

Permalink
Refs #3866 better test for EventList::convertTof()
Browse files Browse the repository at this point in the history
  • Loading branch information
Janik Zikovsky committed Dec 29, 2011
1 parent 4d2b73e commit e9f97a9
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Code/Mantid/Framework/DataObjects/test/EventListTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -1176,13 +1176,20 @@ class EventListTest : public CxxTest::TestSuite
this->fake_uniform_data();
el.switchTo(static_cast<EventType>(this_type));
size_t old_num = this->el.getNumberEvents();
// Initial X values
TS_ASSERT_DELTA( this->el.readX()[0], 0.0, 1e-4);
TS_ASSERT_DELTA( this->el.readX()[1], MAX_TOF, 1e-4);

//Do convert
this->el.convertTof( 2.5, 1 );
//Unchanged size
TS_ASSERT_EQUALS(old_num, this->el.getNumberEvents());
//Original tofs were 100, 5100, 10100, etc.)
TSM_ASSERT_EQUALS(this_type, this->el.getEvent(0).tof(), 251.0);
TSM_ASSERT_EQUALS(this_type, this->el.getEvent(1).tof(), 12751.0);
// Modified X values
TS_ASSERT_DELTA( this->el.readX()[0], 1.0, 1e-4);
TS_ASSERT_DELTA( this->el.readX()[1], MAX_TOF * 2.5 + 1.0, 1e-4);
}
}

Expand Down Expand Up @@ -1729,6 +1736,12 @@ class EventListTest : public CxxTest::TestSuite
//tof steps of 5 microseconds, starting at 100 ns, up to 20 msec
el += TofEvent( tof, rand()%1000);
}
// Create an X axis
MantidVec X;
X.resize(2);
X[0] = 0;
X[1] = MAX_TOF;
el.dataX() = X;
}

/** Create a uniform event list with each event weight of 2.0, error 2.5 */
Expand Down

0 comments on commit e9f97a9

Please sign in to comment.