Ocean
TestRateCalculator.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_TEST_TESTMATH_TEST_RATE_CALCULATOR_H
9 #define META_OCEAN_TEST_TESTMATH_TEST_RATE_CALCULATOR_H
10 
12 
13 #include "ocean/base/Timestamp.h"
14 
15 namespace Ocean
16 {
17 
18 namespace Test
19 {
20 
21 namespace TestMath
22 {
23 
24 /**
25  * This class implements tests for the RateCalculator class.
26  * @ingroup testmath
27  */
28 class OCEAN_TEST_MATH_EXPORT TestRateCalculator
29 {
30  protected:
31 
32  /**
33  * Definition of a pair combining a timestamp with a quantity.
34  */
35  typedef std::pair<Timestamp, double> TimestampPair;
36 
37  /**
38  * Definition of a vector holding timestamp pair objects.
39  */
40  typedef std::vector<TimestampPair> TimestampPairs;
41 
42  public:
43 
44  /**
45  * Starts all tests for the class.
46  * @param testDuration Number of seconds for each test, with range (0, infinity)
47  * @param worker The worker object
48  * @return True, if succeeded
49  */
50  static bool test(const double testDuration, Worker& worker);
51 
52  /**
53  * Tests the rate functionality.
54  * @param testDuration Number of seconds for each test, with range (0, infinity)
55  * @return True, if succeeded
56  */
57  static bool testRate(const double testDuration);
58 };
59 
60 }
61 
62 }
63 
64 }
65 
66 #endif // META_OCEAN_TEST_TESTMATH_TEST_RATE_CALCULATOR_H
This class implements tests for the RateCalculator class.
Definition: TestRateCalculator.h:29
static bool test(const double testDuration, Worker &worker)
Starts all tests for the class.
static bool testRate(const double testDuration)
Tests the rate functionality.
std::pair< Timestamp, double > TimestampPair
Definition of a pair combining a timestamp with a quantity.
Definition: TestRateCalculator.h:35
std::vector< TimestampPair > TimestampPairs
Definition of a vector holding timestamp pair objects.
Definition: TestRateCalculator.h:40
This class implements a worker able to distribute function calls over different threads.
Definition: Worker.h:33
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15