![]() |
micro-test-plus 3.2.2
µTest++ Testing Framework
|
Utility functions for advanced string handling in tests. More...
Functions | |
bool | micro_os_plus::micro_test_plus::utility::is_match (std::string_view input, std::string_view pattern) |
Check if a string matches a pattern. | |
template<class T> | |
constexpr auto | micro_os_plus::micro_test_plus::mut (const T &t) noexcept -> T & |
Generic mutator to remove const qualification from any type. | |
template<class T, class Delim_T> | |
auto | micro_os_plus::micro_test_plus::utility::split (T input, Delim_T delim) -> std::vector< T > |
Split a string into a vector of sub-strings. |
The µTest++ framework includes a collection of utility functions designed to simplify advanced string operations commonly required during test development. These functions support tasks such as partial string matching, splitting long strings for improved readability, and other manipulations that enhance the clarity and effectiveness of test code.
|
nodiscard |
[in] | input | The string view to be checked. |
[in] | pattern | The string view containing the pattern to match. |
This function enables pattern-based string comparison for tests, supporting both exact matches and wildcard patterns. The pattern may include * to match any sequence of characters and ? to match any single character. This allows for flexible validation of string content in test assertions, accommodating variable or partially known values.
Definition at line 171 of file micro-test-plus.cpp.
References is_match().
Referenced by is_match().
|
nodiscardconstexprnoexcept |
T | The type of the input object. |
[in] | t | The object from which to remove const qualification. |
The mut function template provides a safe and generic mechanism to remove the const qualifier from any type. It returns a non-const reference to the input object, enabling modification of objects that were originally declared as const. This utility is particularly useful in testing scenarios where controlled mutation of test data is required.
Definition at line 321 of file function-comparators-inlines.h.
|
nodiscard |
T | Type of the input string. |
Delim_T | Type of the delimiter. |
[in] | input | Input string to split. |
[in] | delim | Delimiter string. |
This function template facilitates string handling in tests by splitting a string into a vector of substrings, using the specified delimiter.
The function iterates through the input string, identifying delimiter positions and extracting substrings between them. Each resulting substring is added to the output vector. This approach supports flexible parsing of delimited data, which is particularly useful for validating string processing logic in test cases.
Definition at line 275 of file micro-test-plus-inlines.h.