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