Skip to content

Commit

Permalink
Clear memory leaks in test. Re #4472.
Browse files Browse the repository at this point in the history
  • Loading branch information
RussellTaylor committed Jan 27, 2012
1 parent 0d472cc commit 88db0f4
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion Code/Mantid/Framework/Kernel/test/TimeSeriesPropertyTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ class TimeSeriesPropertyTest : public CxxTest::TestSuite
TS_ASSERT_EQUALS( time[1], DateAndTime("2007-11-30T16:17:10"));
TS_ASSERT_EQUALS( time[2], DateAndTime("2007-11-30T16:17:20"));
TS_ASSERT_EQUALS( time[3], DateAndTime("2007-11-30T16:17:30"));

delete p;
}

void test_addValues()
Expand Down Expand Up @@ -147,6 +149,9 @@ class TimeSeriesPropertyTest : public CxxTest::TestSuite
(*log) += log2;

TS_ASSERT_EQUALS( log->size(), 5);

delete log;
delete log2;
}

//----------------------------------------------------------------------------
Expand All @@ -160,6 +165,8 @@ class TimeSeriesPropertyTest : public CxxTest::TestSuite
(*log) += log;
// There is now a check and trying to do this does nothing.
TS_ASSERT_EQUALS( log->size(), 2);

delete log;
}

//----------------------------------------------------------------------------
Expand All @@ -183,6 +190,8 @@ class TimeSeriesPropertyTest : public CxxTest::TestSuite
log->filterByTime(start, stop);
TS_ASSERT_EQUALS( log->realSize(), 3);
TS_ASSERT_EQUALS( log->getTotalValue(), 9);

delete log;
}


Expand All @@ -202,6 +211,8 @@ class TimeSeriesPropertyTest : public CxxTest::TestSuite
// Still there!
TS_ASSERT_EQUALS( log->realSize(), 1);
TS_ASSERT_EQUALS( log->getTotalValue(), 1);

delete log;
}


Expand All @@ -221,6 +232,8 @@ class TimeSeriesPropertyTest : public CxxTest::TestSuite
// Still there!
TS_ASSERT_EQUALS( log->realSize(), 1);
TS_ASSERT_EQUALS( log->getTotalValue(), 1);

delete log;
}


Expand Down Expand Up @@ -257,7 +270,7 @@ class TimeSeriesPropertyTest : public CxxTest::TestSuite
t = DateAndTime("2007-11-30T16:17:41");
TS_ASSERT_DELTA( s.stop(), t, 1e-3);


delete log;
}


Expand Down Expand Up @@ -322,6 +335,12 @@ class TimeSeriesPropertyTest : public CxxTest::TestSuite
TS_ASSERT_EQUALS( dynamic_cast< TimeSeriesProperty<int> * >(outputs[3])->realSize(), 2);
TS_ASSERT_EQUALS( dynamic_cast< TimeSeriesProperty<int> * >(outputs[4])->realSize(), 1);

delete log;
delete outputs[0];
delete outputs[1];
delete outputs[2];
delete outputs[3];
delete outputs[4];
}


Expand Down Expand Up @@ -367,6 +386,8 @@ class TimeSeriesPropertyTest : public CxxTest::TestSuite

TS_ASSERT_EQUALS( dynamic_cast< TimeSeriesProperty<int> * >(outputs[0])->realSize(), 5);

delete log;
delete outputs[0];
}

//----------------------------------------------------------------------------
Expand Down Expand Up @@ -394,6 +415,8 @@ class TimeSeriesPropertyTest : public CxxTest::TestSuite
TS_ASSERT_DELTA( stats.mean, 6.0, 1e-3);
TS_ASSERT_DELTA( stats.duration, 100.0, 1e-3);
TS_ASSERT_DELTA( stats.standard_deviation, 3.1622, 1e-3);

delete log;
}

void test_empty_statistics()
Expand All @@ -406,6 +429,8 @@ class TimeSeriesPropertyTest : public CxxTest::TestSuite
TS_ASSERT( boost::math::isnan(stats.mean) );
TS_ASSERT( boost::math::isnan(stats.standard_deviation) );
TS_ASSERT( boost::math::isnan(stats.duration) );

delete log;
}

void test_PlusEqualsOperator_Incompatible_Types_dontThrow()
Expand All @@ -421,6 +446,10 @@ class TimeSeriesPropertyTest : public CxxTest::TestSuite
logi->operator+=(log);
val->operator+=(log);
val->operator+=(logi);

delete log;
delete logi;
delete val;
}

void test_PlusEqualsOperator_() {
Expand Down Expand Up @@ -477,6 +506,7 @@ class TimeSeriesPropertyTest : public CxxTest::TestSuite
double v5 = p->getSingleValue(time5);
TS_ASSERT_DELTA( v5, 9.99, 1e-6);

delete p;
}


Expand Down

0 comments on commit 88db0f4

Please sign in to comment.