micro-test-plus 4.1.0
µTest++ Testing Framework
Loading...
Searching...
No Matches
utility.h
Go to the documentation of this file.
1/*
2 * This file is part of the µOS++ project (https://micro-os-plus.github.io/).
3 * Copyright (c) 2021-2026 Liviu Ionescu. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose is hereby granted, under the terms of the MIT license.
7 *
8 * If a copy of the license was not distributed with this file, it can be
9 * obtained from https://opensource.org/licenses/mit.
10 *
11 * Major parts of the code are inspired from v1.1.8 of the Boost UT project,
12 * released under the terms of the Boost Version 1.0 Software License,
13 * which can be obtained from https://www.boost.org/LICENSE_1_0.txt.
14 */
15
16// ----------------------------------------------------------------------------
17
27
28#ifndef MICRO_TEST_PLUS_UTILITY_H_
29#define MICRO_TEST_PLUS_UTILITY_H_
30
31// ----------------------------------------------------------------------------
32
33#ifdef __cplusplus
34
35// ----------------------------------------------------------------------------
36
37#include <string_view>
38#include <vector>
39
40// ----------------------------------------------------------------------------
41
42#if defined(__GNUC__)
43#pragma GCC diagnostic push
44#if defined(__clang__)
45#pragma clang diagnostic ignored "-Wc++98-compat"
46#endif
47#endif
48
49// ============================================================================
50
52{
53 // --------------------------------------------------------------------------
54
73 namespace utility
74 {
83 [[nodiscard]] const char*
84 extract_file_name (const char* path) noexcept;
85
95 [[nodiscard]] bool
96 is_match (std::string_view input, std::string_view pattern);
97
109 template <class T, class Delim_T>
110 [[nodiscard]] auto
111 split (T input, Delim_T delim) -> std::vector<T>;
112
113 // ------------------------------------------------------------------------
114 } // namespace utility
115
116 // --------------------------------------------------------------------------
117} // namespace micro_os_plus::micro_test_plus
118
119#if defined(__GNUC__)
120#pragma GCC diagnostic pop
121#endif
122
123// ----------------------------------------------------------------------------
124
125#endif // __cplusplus
126
127// ============================================================================
128// Templates & constexpr implementations.
129
131
132// ----------------------------------------------------------------------------
133
134#endif // MICRO_TEST_PLUS_UTILITY_H_
135
136// ----------------------------------------------------------------------------
auto split(T input, Delim_T delim) -> std::vector< T >
Split a string into a vector of sub-strings.
const char * extract_file_name(const char *path) noexcept
Extracts the file name component from a full path.
Definition utility.cpp:85
bool is_match(std::string_view input, std::string_view pattern)
Check if a string matches a pattern.
Definition utility.cpp:124
Utility functions for the µTest++ testing framework.
Primary namespace for the µTest++ testing framework.
C++ header file with inline implementations for the µTest++ utility functions.