Ocean
Loading...
Searching...
No Matches
TestEigenUtilities.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_TESTCV_TEST_EIGEN_UTILITIES_H
9#define META_OCEAN_TEST_TESTCV_TEST_EIGEN_UTILITIES_H
10
12
14
15namespace Ocean
16{
17
18namespace Test
19{
20
21namespace TestCV
22{
23
24/**
25 * This class implements tests for the EigenUtilities class.
26 * @ingroup testcv
27 */
28class OCEAN_TEST_CV_EXPORT TestEigenUtilities
29{
30 public:
31
32 /**
33 * Invokes all tests.
34 * @param testDuration Number of seconds for each test, with range (0, infinity)
35 * @param selector Test selector for filtering sub-tests; default runs all tests
36 * @return True, if succeeded
37 */
38 static bool test(const double testDuration, const TestSelector& selector = TestSelector());
39
40 /**
41 * Tests the frame to matrix conversion function.
42 * @param testDuration Number of seconds for each test, with range (0, infinity)
43 * @return True, if succeeded
44 */
45 static bool testFrame2Matrix(const double testDuration);
46
47 /**
48 * Tests the conversion of Ocean VectorT2 to Eigen::Vector2T
49 * @param testDuration Number of seconds that this test is rung, with range (0, infinity)
50 * @return True, if succeeded
51 */
52 static bool testToEigenVector(const double testDuration);
53
54 /**
55 * Tests the conversion of Eigen::Vector2T to Ocean VectorT2
56 * @param testDuration Number of seconds that this test is rung, with range (0, infinity)
57 * @return True, if succeeded
58 */
59 static bool testToOceanVector(const double testDuration);
60
61 /**
62 * Tests the conversion of Ocean::QuaternionT<T> to Eigen::Quaternion<T>
63 * @param testDuration Number of seconds that this test is rung, with range (0, infinity)
64 * @return True, if succeeded
65 */
66 static bool testToEigenQuaternion(const double testDuration);
67
68 /**
69 * Tests the conversion of Eigen::Quaternion<T> to Ocean::QuaternionT<T>
70 * @param testDuration Number of seconds that this test is rung, with range (0, infinity)
71 * @return True, if succeeded
72 */
73 static bool testToOceanQuaternion(const double testDuration);
74
75 protected:
76
77 /**
78 * Tests the frame to matrix conversion function for a specific source type and target type.
79 * @param testDuration Number of seconds for each test, with range (0, infinity)
80 * @return True, if succeeded
81 * @tparam TSource The data type of each source element
82 * @tparam TTarget The data type of each target element
83 */
84 template <typename TSource, typename TTarget>
85 static bool testFrame2Matrix(const double testDuration);
86
87 /**
88 * Tests the conversion of Ocean VectorT{2,3,4}T to Eigen::Vector{2,3,4}T
89 * @param testDuration Number of seconds that this test will be run, range: (0, infinity)
90 * @return True if the test passed, otherwise false
91 * @tparam TType The type of the vector elements, must be either `int`, `float`, or `double`
92 * @tparam tElements Number of vector elements, range: [2, 4]
93 * @tparam TOceanVector The type of the Ocean vector that has `tElements` elements of type `TType`, e.g., `TType=int` and `tElements=3` then `TOceanVector=VectorI3`
94 */
95 template <typename TType, size_t tElements, typename TOceanVector>
96 static bool testToEigenVector(const double testDuration);
97
98 /**
99 * Tests the conversion of Eigen::Vector{2,3,4}T to Ocean VectorT{2,3,4}T
100 * @param testDuration Number of seconds that this test will be run, range: (0, infinity)
101 * @return True if the test passed, otherwise false
102 * @tparam TType The type of the vector elements, must be either `int`, `float`, or `double`
103 * @tparam tElements Number of vector elements, range: [2, 4]
104 * @tparam TOceanVector The type of the Ocean vector that has `tElements` elements of type `TType`, e.g., `TType=int` and `tElements=3` then `TOceanVector=VectorI3`
105 */
106 template <typename TType, size_t tElements, typename TOceanVector>
107 static bool testToOceanVector(const double testDuration);
108
109 /**
110 * Tests the conversion of Ocean::QuaternionT<T> to Eigen::Quaternion<T>
111 * @param testDuration Number of seconds that this test is rung, with range (0, infinity)
112 * @return True, if succeeded
113 * @tparam TType Type of the quaternion elements, must be either {float, double}
114 */
115 template <typename TType>
116 static bool testToEigenQuaternion(const double testDuration);
117
118 /**
119 * Tests the conversion of Eigen::Quaternion<T> to Ocean::QuaternionT<T>
120 * @param testDuration Number of seconds that this test is rung, with range (0, infinity)
121 * @return True, if succeeded
122 * @tparam TType Type of the quaternion elements, must be either {float, double}
123 */
124 template <typename TType>
125 static bool testToOceanQuaternion(const double testDuration);
126};
127
128} // namespace CV
129
130} // namespace Test
131
132} // namespace Ocean
133
134#endif // META_OCEAN_TEST_TESTCV_TEST_EIGEN_UTILITIES_H
This class implements tests for the EigenUtilities class.
Definition TestEigenUtilities.h:29
static bool testToOceanVector(const double testDuration)
Tests the conversion of Eigen::Vector{2,3,4}T to Ocean VectorT{2,3,4}T.
static bool testFrame2Matrix(const double testDuration)
Tests the frame to matrix conversion function for a specific source type and target type.
static bool testToOceanQuaternion(const double testDuration)
Tests the conversion of Eigen::Quaternion<T> to Ocean::QuaternionT<T>
static bool testToEigenQuaternion(const double testDuration)
Tests the conversion of Ocean::QuaternionT<T> to Eigen::Quaternion<T>
static bool testToEigenVector(const double testDuration)
Tests the conversion of Ocean VectorT2 to Eigen::Vector2T.
static bool testFrame2Matrix(const double testDuration)
Tests the frame to matrix conversion function.
static bool testToOceanVector(const double testDuration)
Tests the conversion of Eigen::Vector2T to Ocean VectorT2.
static bool testToEigenQuaternion(const double testDuration)
Tests the conversion of Ocean::QuaternionT<T> to Eigen::Quaternion<T>
static bool test(const double testDuration, const TestSelector &selector=TestSelector())
Invokes all tests.
static bool testToEigenVector(const double testDuration)
Tests the conversion of Ocean VectorT{2,3,4}T to Eigen::Vector{2,3,4}T.
static bool testToOceanQuaternion(const double testDuration)
Tests the conversion of Eigen::Quaternion<T> to Ocean::QuaternionT<T>
This class implements a test selector that parses test function strings and determines which tests sh...
Definition TestSelector.h:51
The namespace covering the entire Ocean framework.
Definition Accessor.h:15