Ocean
TestString.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_TESTBASE_TEST_STRING_H
9 #define META_OCEAN_TEST_TESTBASE_TEST_STRING_H
10 
12 
13 namespace Ocean
14 {
15 
16 namespace Test
17 {
18 
19 namespace TestBase
20 {
21 
22 /**
23  * This class implements a test for the string class.
24  * @ingroup testbase
25  */
26 class OCEAN_TEST_BASE_EXPORT TestString
27 {
28  protected:
29 
30  /**
31  * Definition of a pair combining two strings.
32  * @tparam The data type of the character to be used
33  */
34  template <typename T>
35  using StringPair = std::pair<std::basic_string<T>, std::basic_string<T>>;
36 
37  /**
38  * Definition of a vector holding string pairs.
39  * @tparam The data type of the character to be used
40  */
41  template <typename T>
42  using StringPairs = std::vector<StringPair<T>>;
43 
44  public:
45 
46  /**
47  * Tests the string functionalities.
48  * @param testDuration Number of seconds for each test, with range (0, infinity)
49  * @return True, if succeeded
50  */
51  static bool test(const double testDuration);
52 
53  /**
54  * Tests the toAString() function.
55  * @return True, if succeeded
56  */
57  static bool testToAString();
58 
59  /**
60  * Tests the towString() function.
61  * @return True, if succeeded
62  */
63  static bool testToWString();
64 
65  /**
66  * Tests the boolean value function.
67  * @return True, if succeeded
68  */
69  static bool testIsBoolean();
70 
71  /**
72  * Tests the integer value function.
73  * @return True, if succeeded
74  */
75  static bool testIsInteger32();
76 
77  /**
78  * Tests the unsigned integer 64bit value function.
79  * @return True, if succeeded
80  */
81  static bool testIsUnsignedInteger64();
82 
83  /**
84  * Tests the hex value function for 64 bit.
85  * @return True, if succeeded
86  */
87  static bool testIsHexValue64();
88 
89  /**
90  * Tests the number value function.
91  * @return True, if succeeded
92  */
93  static bool testIsNumber();
94 
95  /**
96  * Tests the trim functions.
97  * @param testDuration Number of seconds for each test, with range (0, infinity)
98  * @return True, if succeeded
99  */
100  static bool testTrim(const double testDuration);
101 
102  /**
103  * Tests the replace functions.
104  * @return True, if succeeded
105  */
106  static bool testReplace();
107 
108  /**
109  * Tests the to-lower function.
110  * @return True, if succeeded
111  */
112  static bool testToLower();
113 
114  /**
115  * Tests the to-upper function.
116  * @return True, if succeeded
117  */
118  static bool testToUpper();
119 };
120 
121 }
122 
123 }
124 
125 }
126 
127 #endif // META_OCEAN_TEST_TESTBASE_TEST_STRING_H
This class implements a test for the string class.
Definition: TestString.h:27
static bool testIsInteger32()
Tests the integer value function.
static bool testIsUnsignedInteger64()
Tests the unsigned integer 64bit value function.
static bool testToUpper()
Tests the to-upper function.
std::pair< std::basic_string< T >, std::basic_string< T > > StringPair
Definition of a pair combining two strings.
Definition: TestString.h:35
static bool testTrim(const double testDuration)
Tests the trim functions.
static bool testIsNumber()
Tests the number value function.
static bool testReplace()
Tests the replace functions.
static bool test(const double testDuration)
Tests the string functionalities.
std::vector< StringPair< T > > StringPairs
Definition of a vector holding string pairs.
Definition: TestString.h:42
static bool testIsHexValue64()
Tests the hex value function for 64 bit.
static bool testIsBoolean()
Tests the boolean value function.
static bool testToWString()
Tests the towString() function.
static bool testToLower()
Tests the to-lower function.
static bool testToAString()
Tests the toAString() function.
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15