@@ -218,6 +218,36 @@ class Integration : public testing::Test {
218218 */
219219 std::string format_string (const char * format, ...) const ;
220220
221+ /* *
222+ * Calculate the elapsed time in milliseconds
223+ *
224+ * @return Elapsed time in milliseconds
225+ */
226+ inline uint64_t elapsed_time () {
227+ if (start_time_ > 0 ) {
228+ return (uv_hrtime () - start_time_) / 1000000UL ;
229+ }
230+ return 0 ;
231+ }
232+
233+ /* *
234+ * Start the timer to calculate the elapsed time
235+ */
236+ inline void start_timer () {
237+ start_time_ = uv_hrtime ();
238+ }
239+
240+ /* *
241+ * Stop the timer - Calculate the elapsed time and reset the timer
242+ *
243+ * @return Elapsed time in milliseconds
244+ */
245+ inline uint64_t stop_timer () {
246+ uint64_t duration = elapsed_time ();
247+ start_time_ = 0ull ;
248+ return duration;
249+ }
250+
221251protected:
222252 /* *
223253 * Get the current working directory
@@ -228,6 +258,18 @@ class Integration : public testing::Test {
228258 return Utils::cwd ();
229259 }
230260
261+ /* *
262+ * Determine if a string contains another string
263+ *
264+ * @param input String being evaluated
265+ * @param search String to find
266+ * @return True if string is contained in other string; false otherwise
267+ */
268+ inline static bool contains (const std::string& input,
269+ const std::string& search) {
270+ return Utils::contains (input, search);
271+ }
272+
231273 /* *
232274 * Split a string into an array/vector
233275 *
@@ -247,7 +289,7 @@ class Integration : public testing::Test {
247289 * @return True if file exists; false otherwise
248290 */
249291 inline static bool file_exists (const std::string& filename) {
250- return test:: Utils::file_exists (filename);
292+ return Utils::file_exists (filename);
251293 }
252294
253295 /* *
@@ -259,7 +301,7 @@ class Integration : public testing::Test {
259301 */
260302 inline static std::string implode (const std::vector<std::string>& elements,
261303 const char delimiter = ' ' ) {
262- return test:: Utils::implode (elements, delimiter);
304+ return Utils::implode (elements, delimiter);
263305 }
264306
265307 /* *
@@ -268,7 +310,7 @@ class Integration : public testing::Test {
268310 * @param path Directory/Path to create
269311 */
270312 inline static void mkdir (const std::string& path) {
271- test:: Utils::mkdir (path);
313+ Utils::mkdir (path);
272314 }
273315
274316 /* *
@@ -277,7 +319,7 @@ class Integration : public testing::Test {
277319 * @param milliseconds Time in milliseconds to sleep
278320 */
279321 inline static void msleep (unsigned int milliseconds) {
280- test:: Utils::msleep (milliseconds);
322+ Utils::msleep (milliseconds);
281323 }
282324
283325 /* *
@@ -290,7 +332,7 @@ class Integration : public testing::Test {
290332 */
291333 inline static std::string replace_all (const std::string& input,
292334 const std::string& from, const std::string& to) {
293- return test:: Utils::replace_all (input, from, to);
335+ return Utils::replace_all (input, from, to);
294336 }
295337
296338 /* *
@@ -299,7 +341,7 @@ class Integration : public testing::Test {
299341 * @param input String to convert to lowercase
300342 */
301343 inline static std::string to_lower (const std::string& input) {
302- return test:: Utils::to_lower (input);
344+ return Utils::to_lower (input);
303345 }
304346
305347 /* *
@@ -309,14 +351,18 @@ class Integration : public testing::Test {
309351 * @return Trimmed string
310352 */
311353 inline static std::string trim (const std::string& input) {
312- return test:: Utils::trim (input);
354+ return Utils::trim (input);
313355 }
314356
315357private:
316358 /* *
317359 * Keyspace creation query (generated via SetUp)
318360 */
319361 std::string create_keyspace_query_;
362+ /* *
363+ * High-resolution real time when the timer was started (in nanoseconds)
364+ */
365+ uint64_t start_time_;
320366};
321367
322368#endif // __INTEGRATION_HPP__
0 commit comments