1 #include "TestMean.h"
2 
TestMean()3 TestMean::TestMean()
4 {
5 }
6 
~TestMean()7 TestMean::~TestMean()
8 {
9 }
10 
run()11 void TestMean::run()
12 {
13   testMean();
14   testMeanDouble();
15   testMeanArray();
16 }
17 
testMean()18 void TestMean::testMean()
19 {
20   //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21   // Tests using the default constructor
22   //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23 
24   // create a mean and test the value
25   Mean default_mean;
26   _test( default_mean.value() == 0 );
27 }
28 
testMeanDouble()29 void TestMean::testMeanDouble()
30 {
31   //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32   // Tests using the double constructor
33   //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
34   Mean double_mean( 0.5 );
35   _test( double_mean.value() == 0.5 );
36 }
37 
testMeanArray()38 void TestMean::testMeanArray()
39 {
40   //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
41   // Tests using the array constructor
42   //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43   std::vector<double> numbers;
44   for( int i = 1; i <= 10; i++ ) {
45     numbers.push_back( (double)i );
46   }
47   Mean number_mean( numbers );
48   _test( number_mean.value() == 5.5 );
49 }
50 
51