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