20 #include "ns3/basic-data-calculators.h"
42 void DoRun()
override;
46 :
TestCase(
"Basic Statistical Functions using One Integer")
73 for (
long i = 0; i < count; i++)
75 value = multiple * (i + 1);
85 max = multiple * count;
88 stddev = std::sqrt(variance);
100 "Variance value wrong");
116 void DoRun()
override;
120 :
TestCase(
"Basic Statistical Functions using Five Integers")
147 for (
long i = 0; i < count; i++)
149 value = multiple * (i + 1);
159 max = multiple * count;
161 variance = (count * sqrSum - sum * sum) / (count * (count - 1));
162 stddev = std::sqrt(variance);
174 "Variance value wrong");
190 void DoRun()
override;
194 :
TestCase(
"Basic Statistical Functions using Five Double Values")
219 double multiple = 3.14;
221 for (
long i = 0; i < count; i++)
223 value = multiple * (i + 1);
233 max = multiple * count;
235 variance = (count * sqrSum - sum * sum) / (count * (count - 1));
236 stddev = std::sqrt(variance);
248 "Variance value wrong");
264 :
TestSuite(
"basic-data-calculators", UNIT)
static BasicDataCalculatorsTestSuite basicDataCalculatorsTestSuite
Static variable for test initialization.
MinMaxAvgTotalCalculator class TestSuite.
BasicDataCalculatorsTestSuite()
MinMaxAvgTotalCalculator class - Test case for five double values.
void DoRun() override
Implementation to actually run this TestCase.
~FiveDoublesTestCase() override
MinMaxAvgTotalCalculator class - Test case for five integers.
~FiveIntegersTestCase() override
void DoRun() override
Implementation to actually run this TestCase.
MinMaxAvgTotalCalculator class - Test case for a single integer.
void DoRun() override
Implementation to actually run this TestCase.
~OneIntegerTestCase() override
Template class MinMaxAvgTotalCalculator.
long getCount() const override
Returns the count.
double getVariance() const override
Returns the current variance.
double getMax() const override
Returns the maximum value.
double getSqrSum() const override
Returns the sum of squares.
double getSum() const override
Returns the sum.
double getStddev() const override
Returns the standard deviation.
double getMean() const override
Returns the mean value.
double getMin() const override
Returns the minimum value.
void Update(const T i)
Updates all variables of MinMaxAvgTotalCalculator.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
#define NS_TEST_ASSERT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static const double TOLERANCE
Tolerance used to check reciprocal of two numbers.