Ocean
TestApproximation.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_APPROXIMATION_H
9 #define META_OCEAN_TEST_TESTMATH_APPROXIMATION_H
10 
12 
13 namespace Ocean
14 {
15 
16 namespace Test
17 {
18 
19 namespace TestMath
20 {
21 
22 /**
23  * This class implements a test of the approximation functions.
24  * @ingroup testmath
25  */
26 class OCEAN_TEST_MATH_EXPORT TestApproximation
27 {
28  public:
29 
30  /**
31  * Tests all approximation functions.
32  * @param testDuration Number of seconds for each test, with range (0, infinity)
33  * @return True, if succeeded
34  */
35  static bool test(const double testDuration);
36 
37  /**
38  * Tests the sqrt function for 8 bit integer values.
39  * @param testDuration Number of seconds for each test, with range (0, infinity)
40  * @return True, if succeeded
41  */
42  static bool testSqrt8(const double testDuration);
43 
44  /**
45  * Tests the sqrt function for 16 bit integer values.
46  * @param testDuration Number of seconds for each test, with range (0, infinity)
47  * @return True, if succeeded
48  */
49  static bool testSqrt16(const double testDuration);
50 
51  /**
52  * Tests the sqrt function for 17 bit integer values.
53  * @param testDuration Number of seconds for each test, with range (0, infinity)
54  * @return True, if succeeded
55  */
56  static bool testSqrt17(const double testDuration);
57 
58  /**
59  * Tests the arc tangent function.
60  * @param testDuration Number of seconds for each test, with range (0, infinity)
61  * @return True, if succeeded
62  */
63  static bool testAtan2(const double testDuration);
64 
65  /**
66  * Tests the exponential function exp(x) = e^x.
67  * @param testDuration Number of seconds for each test, with range (0, infinity)
68  * @return True, if succeeded
69  * @tparam T The data type of the value
70  * @tparam tHigherAccuracy True, to test the higer accuracy; False, to test the lower accuracy
71  */
72  template <typename T, bool tHigherAccuracy>
73  static bool testExp(const double testDuration);
74 
75  private:
76 
77  /**
78  * Validates the arc tangent function.
79  * @param testDuration Number of seconds for each test, with range (0, infinity)
80  * @return True, if succeeded
81  */
82  static bool validateAtan2(const double testDuration);
83 };
84 
85 }
86 
87 }
88 
89 }
90 
91 #endif // META_OCEAN_TEST_TESTMATH_APPROXIMATION_H
This class implements a test of the approximation functions.
Definition: TestApproximation.h:27
static bool test(const double testDuration)
Tests all approximation functions.
static bool testSqrt16(const double testDuration)
Tests the sqrt function for 16 bit integer values.
static bool testSqrt8(const double testDuration)
Tests the sqrt function for 8 bit integer values.
static bool testSqrt17(const double testDuration)
Tests the sqrt function for 17 bit integer values.
static bool validateAtan2(const double testDuration)
Validates the arc tangent function.
static bool testAtan2(const double testDuration)
Tests the arc tangent function.
static bool testExp(const double testDuration)
Tests the exponential function exp(x) = e^x.
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15