xtd 0.2.0
Loading...
Searching...
No Matches
assume.h
Go to the documentation of this file.
1
4#pragma once
5#include "assert.h"
6
8namespace xtd {
10 namespace tunit {
21 class tunit_export_ assume final : private base_assert {
22 public:
24 assume() = delete;
26
28
40 template<typename expected_t, typename actual_t>
41 static void are_equal(const expected_t& expected, const actual_t& actual, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {are_equal(expected, actual, xtd::string::empty_string, stack_frame);}
53 template<typename expected_t, typename actual_t>
54 static void are_equal(const expected_t& expected, const actual_t& actual, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
55 try {
56 assert::are_equal(expected, actual, message, stack_frame);
57 } catch (...) {
58 assert::abort();
59 }
60 }
61
63 static void are_equal(const char* expected, const char* actual, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
64#if defined(__xtd__cpp_lib_char8_t)
65 static void are_equal(const char8* expected, const char8* actual, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
66#endif
67 static void are_equal(const char16* expected, const char16* actual, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
68 static void are_equal(const char32* expected, const char32* actual, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
69 static void are_equal(const wchar_t* expected, const wchar_t* actual, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
70 static void are_equal(float expected, float actual, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
71 static void are_equal(double expected, double actual, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
72 static void are_equal(long double expected, long double actual, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
74
87 static void are_equal(float expected, float actual, float tolerance, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
101 static void are_equal(float expected, float actual, float tolerance, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
114 static void are_equal(double expected, double actual, double tolerance, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
128 static void are_equal(double expected, double actual, double tolerance, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
141 static void are_equal(long double expected, long double actual, long double tolerance, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
155 static void are_equal(long double expected, long double actual, long double tolerance, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
156
167 template<typename expected_t, typename actual_t>
168 static void are_not_equal(const expected_t& expected, const actual_t& actual, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {are_not_equal(expected, actual, xtd::string::empty_string, stack_frame);}
169
181 template<typename expected_t, typename actual_t>
182 static void are_not_equal(const expected_t& expected, const actual_t& actual, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
183 try {
184 assert::are_not_equal(expected, actual, message, stack_frame);
185 } catch (...) {
186 assert::abort();
187 }
188 }
189
191 static void are_not_equal(const char* expected, const char* actual, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
192#if defined(__xtd__cpp_lib_char8_t)
193 static void are_not_equal(const char8* expected, const char8* actual, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
194#endif
195 static void are_not_equal(const char16* expected, const char16* actual, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
196 static void are_not_equal(const char32* expected, const char32* actual, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
197 static void are_not_equal(const wchar_t* expected, const wchar_t* actual, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
199
213 template<typename expected_t, typename actual_t>
214 static void are_not_same(const expected_t& expected, const actual_t& actual, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {are_not_same(expected, actual, xtd::string::empty_string, stack_frame);}
229 template<typename expected_t, typename actual_t>
230 static void are_not_same(const expected_t& expected, const actual_t& actual, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
231 try {
232 assert::are_not_same(expected, actual, message, stack_frame);
233 } catch (...) {
234 assert::abort();
235 }
236 }
237
251 template<typename expected_t, typename actual_t>
252 static void are_same(const expected_t& expected, const actual_t& actual, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {are_same(expected, actual, xtd::string::empty_string, stack_frame);}
267 template<typename expected_t, typename actual_t>
268 static void are_same(const expected_t& expected, const actual_t& actual, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
269 try {
270 assert::are_same(expected, actual, message, stack_frame);
271 } catch (...) {
272 assert::abort();
273 }
274 }
275
287 template<typename item_t, typename collection_t>
288 static void contains(const item_t& item, const collection_t& collection, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {contains(item, collection, xtd::string::empty_string, stack_frame);}
301 template<typename item_t, typename collection_t>
302 static void contains(const item_t& item, const collection_t& collection, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
303 try {
304 assert::contains(item, collection, message, stack_frame);
305 } catch (...) {
306 assert::abort();
307 }
308 }
309
311 template<typename item_t, typename value_t>
312 static void contains(const item_t& item, const std::initializer_list<value_t>& values, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {contains(item, values, xtd::string::empty_string, stack_frame);}
313 template<typename item_t, typename value_t>
314 static void contains(const item_t& item, const std::initializer_list<value_t>& values, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
315 try {
316 assert::contains(item, values, message, stack_frame);
317 } catch (...) {
318 assert::abort();
319 }
320 }
321 static void contains(char item, const char* values, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
322#if defined(__xtd__cpp_lib_char8_t)
323 static void contains(char8 item, const char8* values, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
324#endif
325 static void contains(char16 item, const char16* values, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
326 static void contains(char32 item, const char32* values, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
327 static void contains(wchar_t item, const wchar_t* values, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
329
340 static void does_not_throw(const std::function<void()>& statement, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
352 static void does_not_throw(const std::function<void()>& statement, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
353
365 template<typename value_t>
366 static void is_empty(const value_t& value, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {is_empty(value, xtd::string::empty_string, stack_frame);}
379 template<typename value_t>
380 static void is_empty(const value_t& value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
381 try {
382 assert::is_empty(value, message, stack_frame);
383 } catch (...) {
384 assert::abort();
385 }
386 }
387
389 template<typename value_t>
390 static void is_empty(const std::initializer_list<value_t>& value, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {is_empty(value, xtd::string::empty_string, stack_frame);}
391 template<typename value_t>
392 static void is_empty(const std::initializer_list<value_t>& values, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
393 try {
394 assert::is_empty(values, message, stack_frame);
395 } catch (...) {
396 assert::abort();
397 }
398 }
399 static void is_empty(const char* value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
400#if defined(__xtd__cpp_lib_char8_t)
401 static void is_empty(const char8* value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
402#endif
403 static void is_empty(const char16* value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
404 static void is_empty(const char32* value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
405 static void is_empty(const wchar_t* value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
407
419 static void is_false(bool condition, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
432 static void is_false(bool condition, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
433
444 template<typename value1_t, typename value2_t>
445 static void is_greater(const value1_t& val1, const value2_t& val2, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {is_greater(val1, val2, xtd::string::empty_string, stack_frame);}
457 template<typename value1_t, typename value2_t>
458 static void is_greater(const value1_t& val1, const value2_t& val2, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
459 try {
460 assert::is_greater(val1, val2, message, stack_frame);
461 } catch (...) {
462 assert::abort();
463 }
464 }
465
467 static void is_greater(const char* val1, const char* val2, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
468#if defined(__xtd__cpp_lib_char8_t)
469 static void is_greater(const char8* val1, const char8* val2, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
470#endif
471 static void is_greater(const char16* val1, const char16* val2, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
472 static void is_greater(const char32* val1, const char32* val2, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
473 static void is_greater(const wchar_t* val1, const wchar_t* val2, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
475
487 template<typename value1_t, typename value2_t>
488 static void is_greater_or_equal(const value1_t& val1, const value2_t& val2, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {is_greater_or_equal(val1, val2, xtd::string::empty_string, stack_frame);}
501 template<typename value1_t, typename value2_t>
502 static void is_greater_or_equal(const value1_t& val1, const value2_t& val2, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
503 try {
504 assert::is_greater_or_equal(val1, val2, message, stack_frame);
505 } catch (...) {
506 assert::abort();
507 }
508 }
509
511 static void is_greater_or_equal(const char* val1, const char* val2, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
512#if defined(__xtd__cpp_lib_char8_t)
513 static void is_greater_or_equal(const char8* val1, const char8* val2, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
514#endif
515 static void is_greater_or_equal(const char16* val1, const char16* val2, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
516 static void is_greater_or_equal(const char32* val1, const char32* val2, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
517 static void is_greater_or_equal(const wchar_t* val1, const wchar_t* val2, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
519
530 template<typename type_t, typename value_t>
531 static void is_instance_of(const value_t& value, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {is_instance_of<type_t>(value, xtd::string::empty_string, stack_frame);}
543 template<typename type_t, typename value_t>
544 static void is_instance_of(const value_t& value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
545 try {
546 assert::is_instance_of<type_t>(value, message, stack_frame);
547 } catch (...) {
548 assert::abort();
549 }
550 }
551
562 template<typename value1_t, typename value2_t>
563 static void is_less(const value1_t& val1, const value2_t& val2, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {is_less(val1, val2, xtd::string::empty_string, stack_frame);}
575 template<typename value1_t, typename value2_t>
576 static void is_less(const value1_t& val1, const value2_t& val2, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
577 try {
578 assert::is_less(val1, val2, message, stack_frame);
579 } catch (...) {
580 assert::abort();
581 }
582 }
583
585 static void is_less(const char* val1, const char* val2, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
586#if defined(__xtd__cpp_lib_char8_t)
587 static void is_less(const char8* val1, const char8* val2, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
588#endif
589 static void is_less(const char16* val1, const char16* val2, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
590 static void is_less(const char32* val1, const char32* val2, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
591 static void is_less(const wchar_t* val1, const wchar_t* val2, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
593
605 template<typename value1_t, typename value2_t>
606 static void is_less_or_equal(const value1_t& val1, const value2_t& val2, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {is_less_or_equal(val1, val2, xtd::string::empty_string, stack_frame);}
619 template<typename value1_t, typename value2_t>
620 static void is_less_or_equal(const value1_t& val1, const value2_t& val2, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
621 try {
622 assert::is_less_or_equal(val1, val2, message, stack_frame);
623 } catch (...) {
624 assert::abort();
625 }
626 }
627
629 static void is_less_or_equal(const char* val1, const char* val2, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
630#if defined(__xtd__cpp_lib_char8_t)
631 static void is_less_or_equal(const char8* val1, const char8* val2, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
632#endif
633 static void is_less_or_equal(const char16* val1, const char16* val2, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
634 static void is_less_or_equal(const char32* val1, const char32* val2, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
635 static void is_less_or_equal(const wchar_t* val1, const wchar_t* val2, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
637
649 static void is_NaN(double value, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
662 static void is_NaN(double value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
674 static void is_NaN(long double value, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
687 static void is_NaN(long double value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
699 static void is_NaN(float value, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
712 static void is_NaN(float value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
713
725 template<typename value_t>
726 static void is_negative(const value_t& value, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {is_negative(value, xtd::string::empty_string, stack_frame);}
739 template<typename value_t>
740 static void is_negative(const value_t& value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
741 try {
742 assert::is_negative(value, message, stack_frame);
743 } catch (...) {
744 assert::abort();
745 }
746 }
747
759 template<typename value_t>
760 static void is_not_empty(const value_t& value, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {is_not_empty(value, xtd::string::empty_string, stack_frame);}
773 template<typename value_t>
774 static void is_not_empty(const value_t& value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
775 try {
776 assert::is_not_empty(value, message, stack_frame);
777 } catch (...) {
778 assert::abort();
779 }
780 }
781
783 template<typename value_t>
784 static void is_not_empty(const std::initializer_list<value_t>& value, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {is_not_empty(value, xtd::string::empty_string, stack_frame);}
785 template<typename value_t>
786 static void is_not_empty(const std::initializer_list<value_t>& value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
787 try {
788 assert::is_not_empty(value, message, stack_frame);
789 } catch (...) {
790 assert::abort();
791 }
792 }
793 static void is_not_empty(const char* value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
794#if defined(__xtd__cpp_lib_char8_t)
795 static void is_not_empty(const char8* value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
796#endif
797 static void is_not_empty(const char16* value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
798 static void is_not_empty(const char32* value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
799 static void is_not_empty(const wchar_t* value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
801
812 template<typename type_t, typename value_t>
813 static void is_not_instance_of(const value_t& value, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {is_not_instance_of<type_t>(value, xtd::string::empty_string, stack_frame);}
825 template<typename type_t, typename value_t>
826 static void is_not_instance_of(const value_t& value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
827 try {
828 assert::is_not_instance_of<type_t>(value, message, stack_frame);
829 } catch (...) {
830 assert::abort();
831 }
832 }
833
846 template<typename pointer_t>
847 static void is_not_null(const pointer_t* pointer, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {is_not_null(pointer, xtd::string::empty_string, stack_frame);}
861 template<typename pointer_t>
862 static void is_not_null(const pointer_t* pointer, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
863 try {
864 assert::is_not_null(pointer, message, stack_frame);
865 } catch (...) {
866 assert::abort();
867 }
868 }
880 template<typename optional_t>
881 static void is_not_null(const std::optional<optional_t>& opt, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {is_not_null(opt, xtd::string::empty_string, stack_frame);}
894 template<typename optional_t>
895 static void is_not_null(const std::optional<optional_t>& opt, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
896 try {
897 assert::is_not_null(opt, message, stack_frame);
898 } catch (...) {
899 assert::abort();
900 }
901 }
913 template<typename pointer_t>
927 template<typename pointer_t>
929 try {
930 assert::is_not_null(pointer, message, stack_frame);
931 } catch (...) {
932 assert::abort();
933 }
934 }
946 template<typename pointer_t>
960 template<typename pointer_t>
962 try {
963 assert::is_not_null(pointer, message, stack_frame);
964 } catch (...) {
965 assert::abort();
966 }
967 }
980 template<typename pointer_t>
995 template<typename pointer_t>
997 try {
998 assert::is_not_null(pointer, message, stack_frame);
999 } catch (...) {
1000 assert::abort();
1001 }
1002 }
1012 static void is_not_null(std::nullptr_t pointer, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
1023 static void is_not_null(std::nullptr_t pointer, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
1024
1036 template<typename value_t>
1037 static void is_not_zero(const value_t& value, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {is_not_zero(value, xtd::string::empty_string, stack_frame);}
1050 template<typename value_t>
1051 static void is_not_zero(const value_t& value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
1052 try {
1053 assert::is_not_zero(value, message, stack_frame);
1054 } catch (...) {
1055 assert::abort();
1056 }
1057 }
1058
1071 template<typename pointer_t>
1072 static void is_null(const pointer_t* pointer, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {is_null(pointer, xtd::string::empty_string, stack_frame);}
1086 template<typename pointer_t>
1087 static void is_null(const pointer_t* pointer, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
1088 try {
1089 assert::is_null(pointer, message, stack_frame);
1090 } catch (...) {
1091 assert::abort();
1092 }
1093 }
1105 template<typename optional_t>
1106 static void is_null(const std::optional<optional_t>& opt, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {is_null(opt, xtd::string::empty_string, stack_frame);}
1119 template<typename optional_t>
1120 static void is_null(const std::optional<optional_t>& opt, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
1121 try {
1122 assert::is_null(opt, message, stack_frame);
1123 } catch (...) {
1124 assert::abort();
1125 }
1126 }
1138 template<typename pointer_t>
1152 template<typename pointer_t>
1153 static void is_null(const xtd::uptr<pointer_t>& pointer, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
1154 try {
1155 assert::is_null(pointer, message, stack_frame);
1156 } catch (...) {
1157 assert::abort();
1158 }
1159 }
1171 template<typename pointer_t>
1185 template<typename pointer_t>
1186 static void is_null(const xtd::sptr<pointer_t>& pointer, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
1187 try {
1188 assert::is_null(pointer, message, stack_frame);
1189 } catch (...) {
1190 assert::abort();
1191 }
1192 }
1206 template<typename pointer_t>
1222 template<typename pointer_t>
1223 static void is_null(const xtd::wptr<pointer_t>& pointer, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
1224 try {
1225 assert::is_null(pointer, message, stack_frame);
1226 } catch (...) {
1227 assert::abort();
1228 }
1229 }
1239 static void is_null(std::nullptr_t pointer, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
1250 static void is_null(std::nullptr_t pointer, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
1251
1263 template<typename value_t>
1264 static void is_positive(const value_t& value, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {is_positive(value, xtd::string::empty_string, stack_frame);}
1277 template<typename value_t>
1278 static void is_positive(const value_t& value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
1279 try {
1280 assert::is_positive(value, message, stack_frame);
1281 } catch (...) {
1282 assert::abort();
1283 }
1284 }
1285
1297 static void is_true(bool condition, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
1310 static void is_true(bool condition, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
1311
1323 template<typename value_t>
1324 static void is_zero(const value_t& value, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {is_zero(value, xtd::string::empty_string, stack_frame);}
1337 template<typename value_t>
1338 static void is_zero(const value_t& value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
1339 try {
1340 assert::is_zero(value, message, stack_frame);
1341 } catch (...) {
1342 assert::abort();
1343 }
1344 }
1345
1357 template<typename exception_t>
1358 static void throws(const std::function<void()>& statement, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {throws<exception_t>(statement, xtd::string::empty_string, stack_frame);}
1371 template<typename exception_t>
1372 static void throws(const std::function<void()>& statement, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
1373 try {
1374 assert::throws<exception_t>(statement, message, stack_frame);
1375 } catch (...) {
1376 assert::abort();
1377 }
1378 }
1379
1390 static void throws_any(const std::function<void()>& statement, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
1402 static void throws_any(const std::function<void()>& statement, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
1404 };
1405 }
1406}
Represents text as a sequence of character units.
Definition basic_string.h:79
static const basic_string empty_string
Represents the empty basic_string.
Definition basic_string.h:124
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition stack_frame.h:47
static stack_frame current(const xtd::source_location &value=xtd::source_location::current()) noexcept
Crates a new xtd::diagnostics::stack_frame object corresponding to the location of the call site.
The assume class contains a collection of static methods that implement the most common assertions us...
Definition assume.h:21
static void is_empty(const value_t &value, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that collection contains an item.
Definition assume.h:380
static void are_same(const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that two objects do refer to differents objects.
Definition assume.h:252
static void is_NaN(long double value, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that a value is NaN.
static void is_null(const xtd::sptr< pointer_t > &pointer, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the pointer is null.
Definition assume.h:1186
static void is_positive(const value_t &value, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that ta condition is positive.
Definition assume.h:1278
static void is_less(const value1_t &val1, const value2_t &val2, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the first value is is_less than the second value.
Definition assume.h:563
static void is_true(bool condition, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that a condition is true.
static void is_less_or_equal(const value1_t &val1, const value2_t &val2, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the first value is is_less than or equal to the second value.
Definition assume.h:620
static void is_not_empty(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that collection does not contain any item.
Definition assume.h:760
static void are_equal(const expected_t &expected, const actual_t &actual, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that two type are equal.
Definition assume.h:54
static void contains(const item_t &item, const collection_t &collection, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that collection contains an item.
Definition assume.h:288
static void is_NaN(float value, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that a value is NaN.
static void is_instance_of(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that an object is of the type supplied or a derived type.
Definition assume.h:531
static void is_not_null(const std::optional< optional_t > &opt, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the optional is not std::nullopt.
Definition assume.h:895
static void is_NaN(float value, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
that a value is NaN.
static void is_null(const std::optional< optional_t > &opt, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the optional is std::nullopt.
Definition assume.h:1120
static void is_not_null(std::nullptr_t pointer, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the pointer is not null.
static void are_equal(float expected, float actual, float tolerance, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that two type are equal.
static void is_true(bool condition, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that a condition is true.
static void does_not_throw(const std::function< void()> &statement, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the staement does not throw an exception.
static void is_not_null(const xtd::uptr< pointer_t > &pointer, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the pointer is not null.
Definition assume.h:914
static void are_not_equal(const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that two type are not equal.
Definition assume.h:168
static void is_negative(const value_t &value, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that ta condition is negative.
Definition assume.h:740
static void is_not_zero(const value_t &value, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that ta condition is not zero.
Definition assume.h:1051
static void throws_any(const std::function< void()> &statement, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the staement does not throw an exception.
static void are_not_same(const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that two objects do refer to differents objects.
Definition assume.h:214
static void is_null(const xtd::uptr< pointer_t > &pointer, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the pointer is null.
Definition assume.h:1139
static void are_not_same(const expected_t &expected, const actual_t &actual, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that two objects do refer to differents objects.
Definition assume.h:230
static void is_not_instance_of(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that an object is not of the type supplied or a derived type.
Definition assume.h:813
static void is_less(const value1_t &val1, const value2_t &val2, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the first value is is_less than the second value.
Definition assume.h:576
static void is_not_null(const xtd::wptr< pointer_t > &pointer, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the pointer is not null.
Definition assume.h:996
static void is_NaN(double value, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that a value is NaN.
static void is_null(const xtd::uptr< pointer_t > &pointer, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the pointer is null.
Definition assume.h:1153
static void is_null(const pointer_t *pointer, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the pointer is null.
Definition assume.h:1087
static void is_not_null(const xtd::sptr< pointer_t > &pointer, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the pointer is not null.
Definition assume.h:961
static void is_null(const pointer_t *pointer, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the pointer is null.
Definition assume.h:1072
static void is_instance_of(const value_t &value, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that an object is of the type supplied or a derived type.
Definition assume.h:544
static void is_null(const xtd::wptr< pointer_t > &pointer, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the pointer is null.
Definition assume.h:1223
static void is_null(std::nullptr_t pointer, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the pointer is null.
static void are_equal(double expected, double actual, double tolerance, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that two type are equal.
static void is_false(bool condition, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that a condition is false.
static void is_NaN(long double value, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
that a value is NaN.
static void is_zero(const value_t &value, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that ta condition is zero.
Definition assume.h:1338
static void does_not_throw(const std::function< void()> &statement, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the staement does not throw an exception.
static void is_false(bool condition, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that a condition is false.
static void is_greater_or_equal(const value1_t &val1, const value2_t &val2, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the first value is greater than or equal to the second value.
Definition assume.h:502
static void is_zero(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that ta condition is zero.
Definition assume.h:1324
static void are_equal(const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that two type are equal.
Definition assume.h:41
static void is_less_or_equal(const value1_t &val1, const value2_t &val2, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the first value is is_less than or equal to the second value.
Definition assume.h:606
static void is_empty(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that collection contains an item.
Definition assume.h:366
static void is_greater(const value1_t &val1, const value2_t &val2, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the first value is greater than the second value.
Definition assume.h:445
static void is_not_null(const xtd::sptr< pointer_t > &pointer, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the pointer is not null.
Definition assume.h:947
static void is_not_null(const std::optional< optional_t > &opt, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the optional is not std::nullopt.
Definition assume.h:881
static void is_not_instance_of(const value_t &value, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that an object is not of the type supplied or a derived type.
Definition assume.h:826
static void is_null(const std::optional< optional_t > &opt, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the optional is std::nullopt.
Definition assume.h:1106
static void are_equal(long double expected, long double actual, long double tolerance, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that two type are equal.
static void is_not_null(const xtd::wptr< pointer_t > &pointer, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the pointer is not null.
Definition assume.h:981
static void throws_any(const std::function< void()> &statement, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the staement does not throw an exception.
static void is_not_null(const pointer_t *pointer, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the pointer is not null.
Definition assume.h:847
static void is_greater(const value1_t &val1, const value2_t &val2, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the first value is greater than the second value.
Definition assume.h:458
static void is_negative(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that ta condition is negative.
Definition assume.h:726
static void is_NaN(double value, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
that a value is NaN.
static void is_not_null(const xtd::uptr< pointer_t > &pointer, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the pointer is not null.
Definition assume.h:928
static void are_equal(long double expected, long double actual, long double tolerance, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that two type are equal.
static void are_not_equal(const expected_t &expected, const actual_t &actual, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that two type are not equal.
Definition assume.h:182
static void is_not_null(const pointer_t *pointer, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the pointer is not null.
Definition assume.h:862
static void is_null(const xtd::wptr< pointer_t > &pointer, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the pointer is null.
Definition assume.h:1207
static void are_same(const expected_t &expected, const actual_t &actual, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that two objects do refer to differents objects.
Definition assume.h:268
static void is_not_null(std::nullptr_t pointer, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the pointer is not null.
static void is_greater_or_equal(const value1_t &val1, const value2_t &val2, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the first value is greater than or equal to the second value.
Definition assume.h:488
static void is_null(const xtd::sptr< pointer_t > &pointer, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the pointer is null.
Definition assume.h:1172
static void is_positive(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that ta condition is positive.
Definition assume.h:1264
static void are_equal(double expected, double actual, double tolerance, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that two type are equal.
static void contains(const item_t &item, const collection_t &collection, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that collection contains an item.
Definition assume.h:302
static void is_not_empty(const value_t &value, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that collection does not contain any item.
Definition assume.h:774
static void are_equal(float expected, float actual, float tolerance, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that two type are equal.
static void is_not_zero(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that ta condition is not zero.
Definition assume.h:1037
static void is_null(std::nullptr_t pointer, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that the pointer is null.
The base class for assert.
Definition base_assert.h:29
#define tunit_export_
Define shared library export.
Definition tunit_export.h:13
char8_t char8
Represents a 8-bit unicode character.
Definition char8.h:27
char16_t char16
Represents a 16-bit unicode character.
Definition char16.h:26
std::unique_ptr< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.h:25
std::weak_ptr< type_t > wptr
The xtd::uptr object is a weak pointer.
Definition wptr.h:17
char32_t char32
Represents a 32-bit unicode character.
Definition char32.h:26
std::shared_ptr< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.h:25
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Contains xtd::tunit::assert class.