Ocean
Loading...
Searching...
No Matches
testnetwork/TestData.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_TESTNETWORK_TEST_DATA_H
9#define META_OCEAN_TEST_TESTNETWORK_TEST_DATA_H
10
12
14
16
17namespace Ocean
18{
19
20namespace Test
21{
22
23namespace TestNetwork
24{
25
26/**
27 * This class implements test for Data.
28 * @ingroup testnetwork
29 */
30class OCEAN_TEST_NETWORK_EXPORT TestData
31{
32 public:
33
34 /**
35 * Tests all Data functions.
36 * @param testDuration The number of seconds for each test, with range (0, infinity)
37 * @param selector The selector defining which tests to run
38 * @return True, if succeeded
39 */
40 static bool test(const double testDuration, const TestSelector& selector);
41
42 /**
43 * Tests the endian conversion.
44 * @param testDuration The number of seconds for each test, with range (0, infinity)
45 * @return True, if succeeded
46 */
47 static bool testEndian(const double testDuration);
48
49 protected:
50
51 /**
52 * Tests the toBigEndian() function for a specified data type.
53 * @param randomGenerator Random generator to be used
54 * @tparam T The data type to be used
55 */
56 template <typename T>
57 static bool testToBigEndian(RandomGenerator& randomGenerator);
58
59 /**
60 * Tests the fromBigEndian() function for a specified data type.
61 * @param randomGenerator Random generator to be used
62 * @tparam T The data type to be used
63 */
64 template <typename T>
65 static bool testFromBigEndian(RandomGenerator& randomGenerator);
66
67 /**
68 * Flips the byte order of a value.
69 * @param value The value for which the byte order will be flipped
70 * @return The value with flipped byte order
71 * @tparam T The data type of the value
72 */
73 template <typename T>
74 static T flipByteOrder(const T& value);
75};
76
77}
78
79}
80
81}
82
83#endif // META_OCEAN_TEST_TESTNETWORK_TEST_DATA_H
This class implements a generator for random numbers.
Definition RandomGenerator.h:42
This class implements test for Data.
Definition testnetwork/TestData.h:31
static bool testEndian(const double testDuration)
Tests the endian conversion.
static bool testToBigEndian(RandomGenerator &randomGenerator)
Tests the toBigEndian() function for a specified data type.
static bool test(const double testDuration, const TestSelector &selector)
Tests all Data functions.
static bool testFromBigEndian(RandomGenerator &randomGenerator)
Tests the fromBigEndian() function for a specified data type.
static T flipByteOrder(const T &value)
Flips the byte order of a value.
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