Ocean
TestMedian.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_TESTBASE_TEST_MEDIAN_H
9 #define META_OCEAN_TEST_TESTBASE_TEST_MEDIAN_H
10 
12 
13 #include <vector>
14 
15 namespace Ocean
16 {
17 
18 namespace Test
19 {
20 
21 namespace TestBase
22 {
23 
24 /**
25  * This class implements a median test.
26  * @ingroup testbase
27  */
28 class OCEAN_TEST_BASE_EXPORT TestMedian
29 {
30  public:
31 
32  /**
33  * Tests the entire median functions.
34  * @param testDuration Number of seconds for each test, with range (0, infinity)
35  * @return True, if succeeded
36  */
37  static bool test(const double testDuration);
38 
39  /**
40  * Tests the median function for two parameters.
41  * @param testDuration Number of seconds for each test, with range (0, infinity)
42  * @return True, if succeeded
43  */
44  static bool testMedian2(const double testDuration);
45 
46  /**
47  * Tests the median function for three parameters.
48  * @param testDuration Number of seconds for each test, with range (0, infinity)
49  * @return True, if succeeded
50  */
51  static bool testMedian3(const double testDuration);
52 
53  /**
54  * Tests the median function for four parameters.
55  * @param testDuration Number of seconds for each test, with range (0, infinity)
56  * @return True, if succeeded
57  */
58  static bool testMedian4(const double testDuration);
59 
60  /**
61  * Tests the median function for three parameters.
62  * @param testDuration Number of seconds for each test, with range (0, infinity)
63  * @return True, if succeeded
64  */
65  static bool testMedian5(const double testDuration);
66 
67  /**
68  * Tests the median function with a given data type.
69  * @param testDuration Number of seconds for each test, with range (0, infinity)
70  * @return True, if succeeded
71  * @tparam T The data type to be used for testing
72  */
73  template <typename T>
74  static bool testMedian(const double testDuration);
75 
76  private:
77 
78  /**
79  * Tests the median function with a given number of elements.
80  * @param number Number of elements, with range [1, infinity)
81  * @param testDuration Number of seconds for each test, with range (0, infinity)
82  * @return True, if succeeded
83  * @tparam T The data type to be used for testing
84  */
85  template <typename T>
86  static bool testMedian(const unsigned int number, const double testDuration);
87 
88  /**
89  * Returns whether a given parameter is a real number or value.
90  * @param value The value to check
91  * @return True, if so
92  * @tparam T The data type of the parameter to check
93  */
94  template <typename T>
95  static inline bool isNumber(const T& value);
96 };
97 
98 template <typename T>
99 inline bool TestMedian::isNumber(const T& value)
100 {
101  return value != value;
102 }
103 
104 }
105 
106 }
107 
108 }
109 
110 #endif // META_OCEAN_TEST_TESTBASE_TEST_MEDIAN_H
This class implements a median test.
Definition: TestMedian.h:29
static bool testMedian2(const double testDuration)
Tests the median function for two parameters.
static bool test(const double testDuration)
Tests the entire median functions.
static bool testMedian4(const double testDuration)
Tests the median function for four parameters.
static bool testMedian5(const double testDuration)
Tests the median function for three parameters.
static bool isNumber(const T &value)
Returns whether a given parameter is a real number or value.
Definition: TestMedian.h:99
static bool testMedian(const double testDuration)
Tests the median function with a given data type.
static bool testMedian(const unsigned int number, const double testDuration)
Tests the median function with a given number of elements.
static bool testMedian3(const double testDuration)
Tests the median function for three parameters.
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15