xtd - Reference Guide  0.1.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Loading...
Searching...
No Matches
string_valid.h
Go to the documentation of this file.
1
4#pragma once
5#include "valid.h"
6#include "string_assert.h"
7
9namespace xtd {
11 namespace tunit {
21 class string_valid final : private base_assert {
22 public:
24 string_valid() = delete;
26
35 static void are_equal_ignoring_case(const xtd::ustring& expected, const xtd::ustring& actual) {are_equal_ignoring_case(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
36
46 static void are_equal_ignoring_case(const xtd::ustring& expected, const xtd::ustring& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_equal_ignoring_case(expected, actual, "", stack_frame);}
47
57 static void are_equal_ignoring_case(const xtd::ustring& expected, const xtd::ustring& actual, const xtd::ustring& message) {are_equal_ignoring_case(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
58
69 static void are_equal_ignoring_case(const xtd::ustring& expected, const xtd::ustring& actual, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
70 try {
71 string_assert::are_equal_ignoring_case(expected, actual, message, stack_frame);
72 } catch (...) {
73 base_assert::error();
74 }
75 }
76
86
96 static void are_not_equal_ignoring_case(const xtd::ustring& expected, const xtd::ustring& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_not_equal_ignoring_case(expected, actual, "", stack_frame);}
97
107 static void are_not_equal_ignoring_case(const xtd::ustring& expected, const xtd::ustring& actual, const xtd::ustring& message) {are_not_equal_ignoring_case(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
108
119 static void are_not_equal_ignoring_case(const xtd::ustring& expected, const xtd::ustring& actual, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
120 try {
121 string_assert::are_not_equal_ignoring_case(expected, actual, message, stack_frame);
122 } catch (...) {
123 base_assert::error();
124 }
125 }
126
136 static void contains(const xtd::ustring& item, const xtd::ustring& string) {contains(item, string, "", xtd::diagnostics::stack_frame::empty());}
137
148 static void contains(const xtd::ustring& item, const xtd::ustring& string, const xtd::diagnostics::stack_frame& stack_frame) {contains(item, string, "", stack_frame);}
149
160 static void contains(const xtd::ustring& item, const xtd::ustring& string, const xtd::ustring& message) {contains(item, string, message, xtd::diagnostics::stack_frame::empty());}
161
173 static void contains(const xtd::ustring& item, const xtd::ustring& string, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
174 try {
175 string_assert::contains(item, string, message, stack_frame);
176 } catch (...) {
177 base_assert::error();
178 }
179 }
180
190 static void does_not_contain(const xtd::ustring& item, const xtd::ustring& string) {does_not_contain(item, string, "", xtd::diagnostics::stack_frame::empty());}
191
202 static void does_not_contain(const xtd::ustring& item, const xtd::ustring& string, const xtd::diagnostics::stack_frame& stack_frame) {does_not_contain(item, string, "", stack_frame);}
203
214 static void does_not_contain(const xtd::ustring& item, const xtd::ustring& string, const xtd::ustring& message) {does_not_contain(item, string, message, xtd::diagnostics::stack_frame::empty());}
215
227 static void does_not_contain(const xtd::ustring& item, const xtd::ustring& string, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
228 try {
229 string_assert::does_not_contain(item, string, message, stack_frame);
230 } catch (...) {
231 base_assert::error();
232 }
233 }
234
244 static void starts_with(const xtd::ustring& item, const xtd::ustring& string) {starts_with(item, string, "", xtd::diagnostics::stack_frame::empty());}
245
256 static void starts_with(const xtd::ustring& item, const xtd::ustring& string, const xtd::diagnostics::stack_frame& stack_frame) {starts_with(item, string, "", stack_frame);}
257
268 static void starts_with(const xtd::ustring& item, const xtd::ustring& string, const xtd::ustring& message) {starts_with(item, string, message, xtd::diagnostics::stack_frame::empty());}
269
281 static void starts_with(const xtd::ustring& item, const xtd::ustring& string, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
282 try {
283 string_assert::starts_with(item, string, message, stack_frame);
284 } catch (...) {
285 base_assert::error();
286 }
287 }
288
298 static void does_not_start_with(const xtd::ustring& item, const xtd::ustring& string) {does_not_start_with(item, string, "", xtd::diagnostics::stack_frame::empty());}
299
310 static void does_not_start_with(const xtd::ustring& item, const xtd::ustring& string, const xtd::diagnostics::stack_frame& stack_frame) {does_not_start_with(item, string, "", stack_frame);}
311
322 static void does_not_start_with(const xtd::ustring& item, const xtd::ustring& string, const xtd::ustring& message) {does_not_start_with(item, string, message, xtd::diagnostics::stack_frame::empty());}
323
335 static void does_not_start_with(const xtd::ustring& item, const xtd::ustring& string, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
336 try {
337 string_assert::does_not_start_with(item, string, message, stack_frame);
338 } catch (...) {
339 base_assert::error();
340 }
341 }
342
352 static void ends_with(const xtd::ustring& item, const xtd::ustring& string) {ends_with(item, string, "", xtd::diagnostics::stack_frame::empty());}
353
364 static void ends_with(const xtd::ustring& item, const xtd::ustring& string, const xtd::diagnostics::stack_frame& stack_frame) {ends_with(item, string, "", stack_frame);}
365
376 static void ends_with(const xtd::ustring& item, const xtd::ustring& string, const xtd::ustring& message) {ends_with(item, string, message, xtd::diagnostics::stack_frame::empty());}
377
389 static void ends_with(const xtd::ustring& item, const xtd::ustring& string, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
390 try {
391 string_assert::ends_with(item, string, message, stack_frame);
392 } catch (...) {
393 base_assert::error();
394 }
395 }
396
406 static void does_not_end_with(const xtd::ustring& item, const xtd::ustring& string) {does_not_end_with(item, string, "", xtd::diagnostics::stack_frame::empty());}
407
418 static void does_not_end_with(const xtd::ustring& item, const xtd::ustring& string, const xtd::diagnostics::stack_frame& stack_frame) {does_not_end_with(item, string, "", stack_frame);}
419
430 static void does_not_end_with(const xtd::ustring& item, const xtd::ustring& string, const xtd::ustring& message) {does_not_end_with(item, string, message, xtd::diagnostics::stack_frame::empty());}
431
443 static void does_not_end_with(const xtd::ustring& item, const xtd::ustring& string, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
444 try {
445 string_assert::does_not_end_with(item, string, message, stack_frame);
446 } catch (...) {
447 base_assert::error();
448 }
449 }
450
459 static void matches(const xtd::ustring& regex_pattern, const xtd::ustring& actual) {matches(regex_pattern, actual, "", xtd::diagnostics::stack_frame::empty());}
460
470 static void matches(const xtd::ustring& regex_pattern, const xtd::ustring& actual, const xtd::diagnostics::stack_frame& stack_frame) {matches(regex_pattern, actual, "", stack_frame);}
471
481 static void matches(const xtd::ustring& regex_pattern, const xtd::ustring& actual, const xtd::ustring& message) {matches(regex_pattern, actual, message, xtd::diagnostics::stack_frame::empty());}
482
493 static void matches(const xtd::ustring& regex_pattern, const xtd::ustring& actual, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
494 try {
495 string_assert::matches(regex_pattern, actual, message, stack_frame);
496 } catch (...) {
497 base_assert::error();
498 }
499 }
500
509 static void does_not_match(const xtd::ustring& regex_pattern, const xtd::ustring& actual) {does_not_match(regex_pattern, actual, "", xtd::diagnostics::stack_frame::empty());}
510
520 static void does_not_match(const xtd::ustring& regex_pattern, const xtd::ustring& actual, const xtd::diagnostics::stack_frame& stack_frame) {does_not_match(regex_pattern, actual, "", stack_frame);}
521
531 static void does_not_match(const xtd::ustring& regex_pattern, const xtd::ustring& actual, const xtd::ustring& message) {does_not_match(regex_pattern, actual, message, xtd::diagnostics::stack_frame::empty());}
532
543 static void does_not_match(const xtd::ustring& regex_pattern, const xtd::ustring& actual, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
544 try {
545 string_assert::does_not_match(regex_pattern, actual, message, stack_frame);
546 } catch (...) {
547 base_assert::error();
548 }
549 }
550 };
551 }
552}
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition: stack_frame.h:29
static stack_frame empty() noexcept
Return an empty stack frame.
The base class for assert.
Definition: base_assert.h:25
static void does_not_start_with(const xtd::ustring &item, const xtd::ustring &string)
Asserts that string does not start with a specific item.
Definition: string_assert.h:317
static void does_not_end_with(const xtd::ustring &item, const xtd::ustring &string)
Asserts that string does not end with a specific item.
Definition: string_assert.h:431
static void contains(const xtd::ustring &item, const xtd::ustring &string)
Asserts that string contains an item.
Definition: string_assert.h:146
static void does_not_contain(const xtd::ustring &item, const xtd::ustring &string)
Asserts that string contains an item.
Definition: string_assert.h:203
static void does_not_match(const xtd::ustring &regex_pattern, const xtd::ustring &actual)
Asserts that does not match regex pattern.
Definition: string_assert.h:544
static void starts_with(const xtd::ustring &item, const xtd::ustring &string)
Asserts that string starts witdh item.
Definition: string_assert.h:260
static void are_not_equal_ignoring_case(const xtd::ustring &expected, const xtd::ustring &actual)
Asserts that two type are not equal ignoring case.
Definition: string_assert.h:92
static void ends_with(const xtd::ustring &item, const xtd::ustring &string)
Asserts that string ends with a specific item.
Definition: string_assert.h:374
static void are_equal_ignoring_case(const xtd::ustring &expected, const xtd::ustring &actual)
Asserts that two type are equal ignoring case.
Definition: string_assert.h:39
static void matches(const xtd::ustring &regex_pattern, const xtd::ustring &actual)
Asserts that matches regex pattern.
Definition: string_assert.h:487
The string_valid class contains a collection of static methods that implement the most string asserti...
Definition: string_valid.h:21
static void contains(const xtd::ustring &item, const xtd::ustring &string)
Validates that string contains an item.
Definition: string_valid.h:136
static void contains(const xtd::ustring &item, const xtd::ustring &string, const xtd::diagnostics::stack_frame &stack_frame)
Validates that string contains an item.
Definition: string_valid.h:148
static void starts_with(const xtd::ustring &item, const xtd::ustring &string, const xtd::ustring &message)
Validates that string starts with item.
Definition: string_valid.h:268
static void are_not_equal_ignoring_case(const xtd::ustring &expected, const xtd::ustring &actual)
Validates that two type are not equal ignoring case.
Definition: string_valid.h:85
static void are_not_equal_ignoring_case(const xtd::ustring &expected, const xtd::ustring &actual, const xtd::diagnostics::stack_frame &stack_frame)
Validates that two type are not equal ignoring case.
Definition: string_valid.h:96
static void does_not_match(const xtd::ustring &regex_pattern, const xtd::ustring &actual, const xtd::diagnostics::stack_frame &stack_frame)
Validates that does not match regex pattern.
Definition: string_valid.h:520
static void does_not_start_with(const xtd::ustring &item, const xtd::ustring &string, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that string starts with item.
Definition: string_valid.h:335
static void does_not_start_with(const xtd::ustring &item, const xtd::ustring &string, const xtd::diagnostics::stack_frame &stack_frame)
Validates that string starts with item.
Definition: string_valid.h:310
static void ends_with(const xtd::ustring &item, const xtd::ustring &string, const xtd::ustring &message)
Validates that string starts with item.
Definition: string_valid.h:376
static void does_not_match(const xtd::ustring &regex_pattern, const xtd::ustring &actual)
Validates that does not match regex pattern.
Definition: string_valid.h:509
static void starts_with(const xtd::ustring &item, const xtd::ustring &string)
Validates that string starts with a specific item.
Definition: string_valid.h:244
static void does_not_start_with(const xtd::ustring &item, const xtd::ustring &string, const xtd::ustring &message)
Validates that string starts with item.
Definition: string_valid.h:322
static void contains(const xtd::ustring &item, const xtd::ustring &string, const xtd::ustring &message)
Validates that string contains an item.
Definition: string_valid.h:160
static void starts_with(const xtd::ustring &item, const xtd::ustring &string, const xtd::diagnostics::stack_frame &stack_frame)
Validates that string starts with item.
Definition: string_valid.h:256
static void does_not_match(const xtd::ustring &regex_pattern, const xtd::ustring &actual, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that does not match regex pattern.
Definition: string_valid.h:543
static void contains(const xtd::ustring &item, const xtd::ustring &string, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that string contains an item.
Definition: string_valid.h:173
static void matches(const xtd::ustring &regex_pattern, const xtd::ustring &actual, const xtd::ustring &message)
Validates that matches regex pattern.
Definition: string_valid.h:481
static void are_not_equal_ignoring_case(const xtd::ustring &expected, const xtd::ustring &actual, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that two type are not equal ignoring case.
Definition: string_valid.h:119
static void does_not_end_with(const xtd::ustring &item, const xtd::ustring &string, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that string starts with item.
Definition: string_valid.h:443
static void does_not_end_with(const xtd::ustring &item, const xtd::ustring &string)
Validates that string does not end with a specific item.
Definition: string_valid.h:406
static void starts_with(const xtd::ustring &item, const xtd::ustring &string, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that string starts with item.
Definition: string_valid.h:281
static void are_equal_ignoring_case(const xtd::ustring &expected, const xtd::ustring &actual, const xtd::diagnostics::stack_frame &stack_frame)
Validates that two type are equal ignoring case.
Definition: string_valid.h:46
static void ends_with(const xtd::ustring &item, const xtd::ustring &string, const xtd::diagnostics::stack_frame &stack_frame)
Validates that string starts with item.
Definition: string_valid.h:364
static void does_not_contain(const xtd::ustring &item, const xtd::ustring &string, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that string contains an item.
Definition: string_valid.h:227
static void does_not_match(const xtd::ustring &regex_pattern, const xtd::ustring &actual, const xtd::ustring &message)
Validates that does not match regex pattern.
Definition: string_valid.h:531
static void does_not_contain(const xtd::ustring &item, const xtd::ustring &string, const xtd::diagnostics::stack_frame &stack_frame)
Validates that string contains an item.
Definition: string_valid.h:202
static void matches(const xtd::ustring &regex_pattern, const xtd::ustring &actual)
Validates that matches regex pattern.
Definition: string_valid.h:459
static void does_not_start_with(const xtd::ustring &item, const xtd::ustring &string)
Validates that string does not start with a specific item.
Definition: string_valid.h:298
static void are_equal_ignoring_case(const xtd::ustring &expected, const xtd::ustring &actual, const xtd::ustring &message)
Validates that two type are equal ignoring case.
Definition: string_valid.h:57
static void are_not_equal_ignoring_case(const xtd::ustring &expected, const xtd::ustring &actual, const xtd::ustring &message)
Validates that two type are not equal ignoring case.
Definition: string_valid.h:107
static void does_not_end_with(const xtd::ustring &item, const xtd::ustring &string, const xtd::diagnostics::stack_frame &stack_frame)
Validates that string starts with item.
Definition: string_valid.h:418
static void are_equal_ignoring_case(const xtd::ustring &expected, const xtd::ustring &actual, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that two type are equal ignoring case.
Definition: string_valid.h:69
static void does_not_end_with(const xtd::ustring &item, const xtd::ustring &string, const xtd::ustring &message)
Validates that string starts with item.
Definition: string_valid.h:430
static void ends_with(const xtd::ustring &item, const xtd::ustring &string)
Validates that string ends with a specific item.
Definition: string_valid.h:352
static void matches(const xtd::ustring &regex_pattern, const xtd::ustring &actual, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that matches regex pattern.
Definition: string_valid.h:493
static void does_not_contain(const xtd::ustring &item, const xtd::ustring &string)
Validates that string contains an item.
Definition: string_valid.h:190
static void are_equal_ignoring_case(const xtd::ustring &expected, const xtd::ustring &actual)
Validates that two type are equal ignoring case.
Definition: string_valid.h:35
static void does_not_contain(const xtd::ustring &item, const xtd::ustring &string, const xtd::ustring &message)
Validates that string contains an item.
Definition: string_valid.h:214
static void ends_with(const xtd::ustring &item, const xtd::ustring &string, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that string starts with item.
Definition: string_valid.h:389
static void matches(const xtd::ustring &regex_pattern, const xtd::ustring &actual, const xtd::diagnostics::stack_frame &stack_frame)
Validates that matches regex pattern.
Definition: string_valid.h:470
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17
Contains xtd::tunit::string_assert class.
Contains xtd::tunit::valid class.