The String Operators Reference
Overloaded operators for string comparison. More...
Operators Index
constexpr auto | operator!= (std::string_view lhs, std::string_view rhs) |
Non-equality operator for string_view objects. More... | |
constexpr auto | operator== (std::string_view lhs, std::string_view rhs) |
Equality operator for string_view objects. More... | |
Description
Overloaded operators for string comparison.
The µTest++ framework provides overloaded operators specifically for comparing string types, such as std::string_view. These operators enable clear and expressive assertions when verifying string values within test cases, supporting both equality and inequality checks.
By using these dedicated string operators, developers can write concise and readable tests that accurately reflect the intended logic. The framework ensures that string comparisons are performed correctly and that any failed checks are reported with both the actual and expected values for straightforward diagnostics.
- Examples
Operators
operator!=()
| nodiscard constexpr |
Non-equality operator for string_view objects.
- Parameters
-
[in] lhs The left hand side std::string_view operand.
[in] rhs The right hand side std::string_view operand.
- Returns
A comparator object that evaluates to true if the string views are not equal.
This overload of the non-equality operator enables direct comparison of two std::string_view objects within the µTest++ framework. It constructs a comparator object that can be used in test expectations and assertions to verify that two string views are not equal.
Definition at line 149 of file operators.h.
operator==()
| nodiscard constexpr |
Equality operator for string_view objects.
- Parameters
-
[in] lhs The left hand side std::string_view operand.
[in] rhs The right hand side std::string_view operand.
- Returns
A comparator object that evaluates to true if the string views are equal.
This overload of the equality operator enables direct comparison of two std::string_view objects within the µTest++ framework. It constructs a comparator object that can be used in test expectations and assertions to verify that two string views are equal.
Definition at line 128 of file operators.h.
Generated via doxygen2docusaurus by Doxygen 1.14.0.