xtd - Reference Guide  0.1.2
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Loading...
Searching...
No Matches
assert.h
Go to the documentation of this file.
1
4#pragma once
5#include "base_assert.h"
6#include <algorithm>
7#include <cmath>
8#include <cstring>
9#include <exception>
10#include <functional>
11#include <iterator>
12#include <memory>
13#include <string>
14
16#ifdef assert
17#undef assert
18#endif
20
22namespace xtd {
24 namespace tunit {
34 class assert final : public base_assert {
35 public:
37 assert() = delete;
39
49 template<typename expected_t, typename actual_t>
50 static void are_equal(const expected_t& expected, const actual_t& actual) {are_equal(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
51
62 template<typename expected_t, typename actual_t>
63 static void are_equal(const expected_t& expected, const actual_t& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_equal(expected, actual, "", stack_frame);}
64
75 template<typename expected_t, typename actual_t>
76 static void are_equal(const expected_t& expected, const actual_t& actual, const xtd::ustring& message) {are_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
77
89 template<typename expected_t, typename actual_t>
90 static void are_equal(const expected_t& expected, const actual_t& actual, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
91 if (actual == expected)
92 succeed(message, stack_frame);
93 else
94 base_assert::fail(base_assert::to_string(expected), base_assert::to_string(actual), message, stack_frame);
95 }
96
98 static void are_equal(const char* expected, const char* actual, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
99 if (strcmp(actual, expected) == 0)
100 succeed(message, stack_frame);
101 else
102 base_assert::fail(base_assert::to_string(expected), base_assert::to_string(actual), message, stack_frame);
103 }
104
105 static void are_equal(const char8_t* expected, const char8_t* actual, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
106 if (ustring(actual) == ustring(expected))
107 succeed(message, stack_frame);
108 else
109 base_assert::base_assert::fail(base_assert::to_string(expected), base_assert::to_string(actual), message, stack_frame);
110 }
111
112 static void are_equal(const char16_t* expected, const char16_t* actual, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
113 if (std::u16string(actual) == std::u16string(expected))
114 succeed(message, stack_frame);
115 else
116 base_assert::base_assert::fail(base_assert::to_string(expected), base_assert::to_string(actual), message, stack_frame);
117 }
118
119 static void are_equal(const char32_t* expected, const char32_t* actual, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
120 if (std::u32string(actual) == std::u32string(expected))
121 succeed(message, stack_frame);
122 else
123 base_assert::fail(base_assert::to_string(expected), base_assert::to_string(actual), message, stack_frame);
124 }
125
126 static void are_equal(const wchar_t* expected, const wchar_t* actual, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
127 if (wcscmp(actual, expected) == 0)
128 succeed(message, stack_frame);
129 else
130 base_assert::fail(base_assert::to_string(expected), base_assert::to_string(actual), message, stack_frame);
131 }
132
133 static void are_equal(float expected, float actual, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
134 if (std::isnan(actual) && std::isnan(expected))
135 succeed(message, stack_frame);
136 else if (actual == expected)
137 succeed(message, stack_frame);
138 else
139 base_assert::fail(base_assert::to_string(expected), base_assert::to_string(actual), message, stack_frame);
140 }
141
142 static void are_equal(double expected, double actual, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
143 if (std::isnan(actual) && std::isnan(expected))
144 succeed(message, stack_frame);
145 else if (actual == expected)
146 succeed(message, stack_frame);
147 else
148 base_assert::fail(base_assert::to_string(expected), base_assert::to_string(actual), message, stack_frame);
149 }
150
151 static void are_equal(long double expected, long double actual, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
152 if (std::isnan(actual) && std::isnan(expected))
153 succeed(message, stack_frame);
154 else if (actual == expected)
155 succeed(message, stack_frame);
156 else
157 base_assert::fail(base_assert::to_string(expected), base_assert::to_string(actual), message, stack_frame);
158 }
160
172 static void are_equal(float expected, float actual, float tolerance) {are_equal(expected, actual, tolerance, "", csf_);}
173
186 static void are_equal(float expected, float actual, float tolerance, const xtd::diagnostics::stack_frame& stack_frame) {are_equal(expected, actual, tolerance, "", stack_frame);}
187
200 static void are_equal(float expected, float& actual, float tolerance, const xtd::ustring& message) {are_equal(expected, actual, tolerance, message, xtd::diagnostics::stack_frame::empty());}
201
215 static void are_equal(float expected, float actual, float tolerance, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
216 if (fabsf(expected - actual) <= fabsf(tolerance))
217 succeed(message, stack_frame);
218 else
219 base_assert::fail(base_assert::to_string(expected), base_assert::to_string(actual), message, stack_frame);
220 }
221
233 static void are_equal(double expected, double actual, double tolerance) {are_equal(expected, actual, tolerance, "", csf_);}
234
247 static void are_equal(double expected, double actual, double tolerance, const xtd::diagnostics::stack_frame& stack_frame) {are_equal(expected, actual, tolerance, "", stack_frame);}
248
261 static void are_equal(double expected, double actual, double tolerance, const xtd::ustring& message) {are_equal(expected, actual, tolerance, message, xtd::diagnostics::stack_frame::empty());}
262
276 static void are_equal(double expected, double actual, double tolerance, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
277 if (fabs(expected - actual) <= fabs(tolerance))
278 succeed(message, stack_frame);
279 else
280 base_assert::fail(base_assert::to_string(expected), base_assert::to_string(actual), message, stack_frame);
281 }
282
294 static void are_equal(long double expected, long double actual, long double tolerance) {are_equal(expected, actual, tolerance, "", csf_);}
295
308 static void are_equal(long double expected, long double actual, long double tolerance, const xtd::diagnostics::stack_frame& stack_frame) {are_equal(expected, actual, tolerance, "", stack_frame);}
309
322 static void are_equal(long double expected, long double actual, long double tolerance, const xtd::ustring& message) {are_equal(expected, actual, tolerance, message, xtd::diagnostics::stack_frame::empty());}
323
337 static void are_equal(long double expected, long double actual, long double tolerance, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
338 if (fabsl(expected - actual) <= fabsl(tolerance))
339 succeed(message, stack_frame);
340 else
341 base_assert::fail(base_assert::to_string(expected), base_assert::to_string(actual), message, stack_frame);
342 }
343
353 template<typename expected_t, typename actual_t>
354 static void are_not_equal(const expected_t& expected, const actual_t& actual) {are_not_equal(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
355
366 template<typename expected_t, typename actual_t>
367 static void are_not_equal(const expected_t& expected, const actual_t& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_not_equal(expected, actual, "", stack_frame);}
368
379 template<typename expected_t, typename actual_t>
380 static void are_not_equal(const expected_t& expected, const actual_t& actual, const xtd::ustring& message) {are_not_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
381
393 template<typename expected_t, typename actual_t>
394 static void are_not_equal(const expected_t& expected, const actual_t& actual, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
395 if (actual != expected)
396 succeed(message, stack_frame);
397 else
398 base_assert::fail("not " + base_assert::to_string(expected), base_assert::to_string(actual), message, stack_frame);
399 }
400
402 static void are_not_equal(const char* expected, const char* actual, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
403 if (strcmp(actual, expected) != 0)
404 succeed(message, stack_frame);
405 else
406 base_assert::fail("not " + base_assert::to_string(expected), base_assert::to_string(actual), message, stack_frame);
407 }
408
409 static void are_not_equal(const char8_t* expected, const char8_t* actual, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
410 if (ustring(actual) != ustring(expected))
411 succeed(message, stack_frame);
412 else
413 base_assert::fail("not " + base_assert::to_string(expected), base_assert::to_string(actual), message, stack_frame);
414 }
415
416 static void are_not_equal(const char16_t* expected, const char16_t* actual, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
417 if (std::u16string(actual) != std::u16string(expected))
418 succeed(message, stack_frame);
419 else
420 base_assert::fail("not " + base_assert::to_string(expected), base_assert::to_string(actual), message, stack_frame);
421 }
422
423 static void are_not_equal(const char32_t* expected, const char32_t* actual, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
424 if (std::u32string(actual) != std::u32string(expected))
425 succeed(message, stack_frame);
426 else
427 base_assert::fail("not " + base_assert::to_string(expected), base_assert::to_string(actual), message, stack_frame);
428 }
429
430 static void are_not_equal(const wchar_t* expected, const wchar_t* actual, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
431 if (wcscmp(actual, expected) != 0)
432 succeed(message, stack_frame);
433 else
434 base_assert::fail("not " + base_assert::to_string(expected), base_assert::to_string(actual), message, stack_frame);
435 }
437
450 template<typename expected_t, typename actual_t>
451 static void are_not_same(const expected_t& expected, const actual_t& actual) {are_not_same(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
452
466 template<typename expected_t, typename actual_t>
467 static void are_not_same(const expected_t& expected, const actual_t& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_not_same(expected, actual, "", stack_frame);}
468
482 template<typename expected_t, typename actual_t>
483 static void are_not_same(const expected_t& expected, const actual_t& actual, const xtd::ustring& message) {are_not_same(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
484
499 template<typename expected_t, typename actual_t>
500 static void are_not_same(const expected_t& expected, const actual_t& actual, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
501 if (&actual != &expected)
502 succeed(message, stack_frame);
503 else
504 base_assert::fail("not same as " + base_assert::to_string(expected), base_assert::to_string(actual), message, stack_frame);
505 }
506
519 template<typename expected_t, typename actual_t>
520 static void are_same(const expected_t& expected, const actual_t& actual) {are_same(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
521
535 template<typename expected_t, typename actual_t>
536 static void are_same(const expected_t& expected, const actual_t& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_same(expected, actual, "", stack_frame);}
537
551 template<typename expected_t, typename actual_t>
552 static void are_same(const expected_t& expected, const actual_t& actual, const xtd::ustring& message) {are_same(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
553
568 template<typename expected_t, typename actual_t>
569 static void are_same(const expected_t& expected, const actual_t& actual, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
570 if (&actual == &expected)
571 succeed(message, stack_frame);
572 else
573 base_assert::fail("same as " + base_assert::to_string(expected), base_assert::to_string(actual), message, stack_frame);
574 }
575
586 template<typename item_t, typename collection_t>
587 static void contains(const item_t& item, const collection_t& collection) {contains(item, collection, "", xtd::diagnostics::stack_frame::empty());}
588
600 template<typename item_t, typename collection_t>
601 static void contains(const item_t& item, const collection_t& collection, const xtd::diagnostics::stack_frame& stack_frame) {contains(item, collection, "", stack_frame);}
602
614 template<typename item_t, typename collection_t>
615 static void contains(const item_t& item, const collection_t& collection, const xtd::ustring& message) {contains(item, collection, message, xtd::diagnostics::stack_frame::empty());}
616
629 template<typename item_t, typename collection_t>
630 static void contains(const item_t& item, const collection_t& collection, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
631 auto result = std::find(collection.begin(), collection.end(), item);
632 if (result != collection.end())
633 succeed(message, stack_frame);
634 else
635 base_assert::fail("collection containing " + base_assert::to_string(item), base_assert::join_items(collection), message, stack_frame);
636 }
637
639 template<typename item_t, typename value_t>
640 static void contains(const item_t& item, const std::initializer_list<value_t>& values) {contains(item, values, "", xtd::diagnostics::stack_frame::empty());}
641 template<typename item_t, typename value_t>
642 static void contains(const item_t& item, const std::initializer_list<value_t>& values, const xtd::diagnostics::stack_frame& stack_frame) {contains(item, values, "", stack_frame);}
643 template<typename item_t, typename value_t>
644 static void contains(const item_t& item, const std::initializer_list<value_t>& values, const xtd::ustring& message) {contains(item, values, message, xtd::diagnostics::stack_frame::empty());}
645 template<typename item_t, typename value_t>
646 static void contains(const item_t& item, const std::initializer_list<value_t>& values, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
647 auto result = std::find(values.begin(), values.end(), item);
648 if (result != values.end())
649 succeed(message, stack_frame);
650 else
651 base_assert::fail("collection containing " + base_assert::to_string(item), base_assert::join_items(values), message, stack_frame);
652 }
653
654 static void contains(char item, const char* values, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
655 ustring s(values);
656 auto result = std::find(s.begin(), s.end(), item);
657 if (result != s.end())
658 succeed(message, stack_frame);
659 else
660 base_assert::fail("collection containing " + base_assert::to_string(item), base_assert::join_items(s), message, stack_frame);
661 }
662
663 static void contains(char8_t item, const char8_t* values, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
664 std::u8string s(values);
665 auto result = std::find(s.begin(), s.end(), item);
666 if (result != s.end())
667 succeed(message, stack_frame);
668 else
669 base_assert::fail("collection containing " + base_assert::to_string(item), base_assert::join_items(s), message, stack_frame);
670 }
671
672 static void contains(char16_t item, const char16_t* values, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
673 std::u16string s(values);
674 auto result = std::find(s.begin(), s.end(), item);
675 if (result != s.end())
676 succeed(message, stack_frame);
677 else
678 base_assert::fail("collection containing " + base_assert::to_string(item), base_assert::join_items(s), message, stack_frame);
679 }
680
681 static void contains(char32_t item, const char32_t* values, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
682 std::u32string s(values);
683 auto result = std::find(s.begin(), s.end(), item);
684 if (result != s.end())
685 succeed(message, stack_frame);
686 else
687 base_assert::fail("collection containing " + base_assert::to_string(item), base_assert::join_items(s), message, stack_frame);
688 }
689
690 static void contains(wchar_t item, const wchar_t* values, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
691 std::wstring s(values);
692 auto result = std::find(s.begin(), s.end(), item);
693 if (result != s.end())
694 succeed(message, stack_frame);
695 else
696 base_assert::fail("collection containing " + base_assert::to_string(item), base_assert::join_items(s), message, stack_frame);
697 }
699
709 static void does_not_throw(const std::function<void()>& statement) {does_not_throw(statement, "", xtd::diagnostics::stack_frame::empty());}
710
721 static void does_not_throw(const std::function<void()>& statement, const xtd::diagnostics::stack_frame& stack_frame) {does_not_throw(statement, "", stack_frame);}
722
733 static void does_not_throw(const std::function<void()>& statement, const xtd::ustring& message) {does_not_throw(statement, message, xtd::diagnostics::stack_frame::empty());}
734
746 static void does_not_throw(const std::function<void()>& statement, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
747 try {
748 statement();
749 succeed(message, stack_frame);
750 } catch (const std::exception& e) {
751 base_assert::fail("No Exception to be thrown", "<" + __tunit_demangle(typeid(e).name()) + ">", message, stack_frame);
752 } catch (...) {
753 base_assert::fail("No Exception to be thrown", "<exception>", message, stack_frame);
754 }
755 }
756
767 template<typename value_t>
768 static void is_empty(const value_t& value) {is_empty(value, "", xtd::diagnostics::stack_frame::empty());}
769
781 template<typename value_t>
782 static void is_empty(const value_t& value, const xtd::diagnostics::stack_frame& stack_frame) {is_empty(value, "", stack_frame);}
783
795 template<typename value_t>
796 static void is_empty(const value_t& value, const xtd::ustring& message) {is_empty(value, message, xtd::diagnostics::stack_frame::empty());}
797
810 template<typename value_t>
811 static void is_empty(const value_t& value, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
812 if (std::empty(value))
813 succeed(message, stack_frame);
814 else
815 base_assert::fail("collection <empty>", base_assert::join_items(value), message, stack_frame);
816 }
817
819 template<typename value_t>
820 static void is_empty(const std::initializer_list<value_t>& value) {is_empty(value, "", xtd::diagnostics::stack_frame::empty());}
821 template<typename value_t>
822 static void is_empty(const std::initializer_list<value_t>& value, const xtd::diagnostics::stack_frame& stack_frame) {is_empty(value, "", stack_frame);}
823 template<typename value_t>
824 static void is_empty(const std::initializer_list<value_t>& value, const xtd::ustring& message) {is_empty(value, message, xtd::diagnostics::stack_frame::empty());}
825 template<typename value_t>
826 static void is_empty(const std::initializer_list<value_t>& values, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
827 if (std::empty(values))
828 succeed(message, stack_frame);
829 else
830 base_assert::fail("collection <empty>", base_assert::join_items(values), message, stack_frame);
831 }
832
833 static void is_empty(const char* value, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
834 ustring s(value);
835 if (s.is_empty())
836 succeed(message, stack_frame);
837 else
838 base_assert::fail("collection <empty>", base_assert::join_items(s), message, stack_frame);
839 }
840
841 static void is_empty(const char8_t* value, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
842 ustring s(value);
843 if (s.is_empty())
844 succeed(message, stack_frame);
845 else
846 base_assert::fail("collection <empty>", base_assert::join_items(s), message, stack_frame);
847 }
848
849 static void is_empty(const char16_t* value, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
850 ustring s(value);
851 if (s.is_empty())
852 succeed(message, stack_frame);
853 else
854 base_assert::fail("collection <empty>", base_assert::join_items(s), message, stack_frame);
855 }
856
857 static void is_empty(const char32_t* value, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
858 ustring s(value);
859 if (s.is_empty())
860 succeed(message, stack_frame);
861 else
862 base_assert::fail("collection <empty>", base_assert::join_items(s), message, stack_frame);
863 }
864
865 static void is_empty(const wchar_t* value, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
866 ustring s(value);
867 if (s.is_empty())
868 succeed(message, stack_frame);
869 else
870 base_assert::fail("collection <empty>", base_assert::join_items(s), message, stack_frame);
871 }
873
884 static void is_false(bool condition) {is_false(condition, "", xtd::diagnostics::stack_frame::empty());}
885
897 static void is_false(bool condition, const xtd::diagnostics::stack_frame& stack_frame) {is_false(condition, "", stack_frame);}
898
910 static void is_false(bool condition, const xtd::ustring& message) {is_false(condition, message, xtd::diagnostics::stack_frame::empty());}
911
924 static void is_false(bool condition, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
925 if (condition == false)
926 succeed(message, stack_frame);
927 else
928 base_assert::fail("false", "true", message, stack_frame);
929 }
930
940 template<typename value1_t, typename value2_t>
941 static void is_greater(const value1_t& val1, const value2_t& val2) {is_greater(val1, val2, "", xtd::diagnostics::stack_frame::empty());}
942
953 template<typename value1_t, typename value2_t>
954 static void is_greater(const value1_t& val1, const value2_t& val2, const xtd::diagnostics::stack_frame& stack_frame) {is_greater(val1, val2, "", stack_frame);}
955
966 template<typename value1_t, typename value2_t>
967 static void is_greater(const value1_t& val1, const value2_t& val2, const xtd::ustring& message) {is_greater(val1, val2, message, xtd::diagnostics::stack_frame::empty());}
968
980 template<typename value1_t, typename value2_t>
981 static void is_greater(const value1_t& val1, const value2_t& val2, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
982 if (val1 > val2)
983 succeed(message, stack_frame);
984 else
985 base_assert::fail("greater than " + base_assert::to_string(val2), base_assert::to_string(val1), message, stack_frame);
986 }
987
989 static void is_greater(const char* val1, const char* val2, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
990 if (strcmp(val1, val2) > 0)
991 succeed(message, stack_frame);
992 else
993 base_assert::fail("greather than " + base_assert::to_string(val2), base_assert::to_string(val1), message, stack_frame);
994 }
995
996 static void is_greater(const char8_t* val1, const char8_t* val2, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
997 if (ustring(val1) > ustring(val2))
998 succeed(message, stack_frame);
999 else
1000 base_assert::fail("greather than " + base_assert::to_string(val2), base_assert::to_string(val1), message, stack_frame);
1001 }
1002
1003 static void is_greater(const char16_t* val1, const char16_t* val2, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1004 if (std::u16string(val1) > std::u16string(val2))
1005 succeed(message, stack_frame);
1006 else
1007 base_assert::fail("greather than " + base_assert::to_string(val2), base_assert::to_string(val1), message, stack_frame);
1008 }
1009
1010 static void is_greater(const char32_t* val1, const char32_t* val2, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1011 if (std::u32string(val1) > std::u32string(val2))
1012 succeed(message, stack_frame);
1013 else
1014 base_assert::fail("greather than " + base_assert::to_string(val2), base_assert::to_string(val1), message, stack_frame);
1015 }
1016
1017 static void is_greater(const wchar_t* val1, const wchar_t* val2, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1018 if (wcscmp(val1, val2) > 0)
1019 succeed(message, stack_frame);
1020 else
1021 base_assert::fail("greather than " + base_assert::to_string(val2), base_assert::to_string(val1), message, stack_frame);
1022 }
1024
1035 template<typename value1_t, typename value2_t>
1036 static void is_greater_or_equal(const value1_t& val1, const value2_t& val2) {is_greater_or_equal(val1, val2, "", xtd::diagnostics::stack_frame::empty());}
1037
1049 template<typename value1_t, typename value2_t>
1050 static void is_greater_or_equal(const value1_t& val1, const value2_t& val2, const xtd::diagnostics::stack_frame& stack_frame) {is_greater_or_equal(val1, val2, "", stack_frame);}
1051
1063 template<typename value1_t, typename value2_t>
1064 static void is_greater_or_equal(const value1_t& val1, const value2_t& val2, const xtd::ustring& message) {is_greater_or_equal(val1, val2, message, xtd::diagnostics::stack_frame::empty());}
1065
1078 template<typename value1_t, typename value2_t>
1079 static void is_greater_or_equal(const value1_t& val1, const value2_t& val2, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1080 if (val1 >= val2)
1081 succeed(message, stack_frame);
1082 else
1083 base_assert::fail("greater than or equal to " + base_assert::to_string(val2), base_assert::to_string(val1), message, stack_frame);
1084 }
1085
1087 static void is_greater_or_equal(const char* val1, const char* val2, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1088 if (strcmp(val1, val2) >= 0)
1089 succeed(message, stack_frame);
1090 else
1091 base_assert::fail("greather than or equal to " + base_assert::to_string(val2), base_assert::to_string(val1), message, stack_frame);
1092 }
1093
1094 static void is_greater_or_equal(const char8_t* val1, const char8_t* val2, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1095 if (ustring(val1) >= ustring(val2))
1096 succeed(message, stack_frame);
1097 else
1098 base_assert::fail("greather than " + base_assert::to_string(val2), base_assert::to_string(val1), message, stack_frame);
1099 }
1100
1101 static void is_greater_or_equal(const char16_t* val1, const char16_t* val2, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1102 if (std::u16string(val1) >= std::u16string(val2))
1103 succeed(message, stack_frame);
1104 else
1105 base_assert::fail("greather than " + base_assert::to_string(val2), base_assert::to_string(val1), message, stack_frame);
1106 }
1107
1108 static void is_greater_or_equal(const char32_t* val1, const char32_t* val2, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1109 if (std::u32string(val1) >= std::u32string(val2))
1110 succeed(message, stack_frame);
1111 else
1112 base_assert::fail("greather than " + base_assert::to_string(val2), base_assert::to_string(val1), message, stack_frame);
1113 }
1114
1115 static void is_greater_or_equal(const wchar_t* val1, const wchar_t* val2, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1116 if (wcscmp(val1, val2) >= 0)
1117 succeed(message, stack_frame);
1118 else
1119 base_assert::fail("greather than or equal to " + base_assert::to_string(val2), base_assert::to_string(val1), message, stack_frame);
1120 }
1122
1132 template<typename type_t, typename value_t>
1133 static void is_instance_of(const value_t& value) {is_instance_of<type_t>(value, "", xtd::diagnostics::stack_frame::empty());}
1134
1145 template<typename type_t, typename value_t>
1146 static void is_instance_of(const value_t& value, const xtd::diagnostics::stack_frame& stack_frame) {is_instance_of<type_t>(value, "", stack_frame);}
1147
1158 template<typename type_t, typename value_t>
1159 static void is_instance_of(const value_t& value, const xtd::ustring& message) {is_instance_of<type_t>(value, message, xtd::diagnostics::stack_frame::empty());}
1160
1172 template<typename type_t, typename value_t>
1173 static void is_instance_of(const value_t& value, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1174 const type_t* instance = dynamic_cast<const type_t*>(&value);
1175 if (instance != nullptr)
1176 succeed(message, stack_frame);
1177 else
1178 base_assert::fail("instance of <" + __tunit_demangle(typeid(type_t).name()) + ">", "<" + __tunit_demangle(typeid(value).name()) + ">", message, stack_frame);
1179 }
1180
1190 template<typename value1_t, typename value2_t>
1191 static void is_less(const value1_t& val1, const value2_t& val2) {is_less(val1, val2, "", xtd::diagnostics::stack_frame::empty());}
1192
1203 template<typename value1_t, typename value2_t>
1204 static void is_less(const value1_t& val1, const value2_t& val2, const xtd::diagnostics::stack_frame& stack_frame) {is_less(val1, val2, "", stack_frame);}
1205
1216 template<typename value1_t, typename value2_t>
1217 static void is_less(const value1_t& val1, const value2_t& val2, const xtd::ustring& message) {is_less(val1, val2, message, xtd::diagnostics::stack_frame::empty());}
1218
1230 template<typename value1_t, typename value2_t>
1231 static void is_less(const value1_t& val1, const value2_t& val2, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1232 if (val1 < val2)
1233 succeed(message, stack_frame);
1234 else {
1235 base_assert::fail("less than " + base_assert::to_string(val2), base_assert::to_string(val1), message, stack_frame);
1236 }
1237 }
1238
1240 static void is_less(const char* val1, const char* val2, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1241 if (strcmp(val1, val2) < 0)
1242 succeed(message, stack_frame);
1243 else
1244 base_assert::fail("less than " + base_assert::to_string(val2), base_assert::to_string(val1), message, stack_frame);
1245 }
1246
1247 static void is_less(const char8_t* val1, const char8_t* val2, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1248 if (ustring(val1) < ustring(val2))
1249 succeed(message, stack_frame);
1250 else
1251 base_assert::fail("greather than " + base_assert::to_string(val2), base_assert::to_string(val1), message, stack_frame);
1252 }
1253
1254 static void is_less(const char16_t* val1, const char16_t* val2, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1255 if (std::u16string(val1) < std::u16string(val2))
1256 succeed(message, stack_frame);
1257 else
1258 base_assert::fail("greather than " + base_assert::to_string(val2), base_assert::to_string(val1), message, stack_frame);
1259 }
1260
1261 static void is_less(const char32_t* val1, const char32_t* val2, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1262 if (std::u32string(val1) < std::u32string(val2))
1263 succeed(message, stack_frame);
1264 else
1265 base_assert::fail("greather than " + base_assert::to_string(val2), base_assert::to_string(val1), message, stack_frame);
1266 }
1267
1268 static void is_less(const wchar_t* val1, const wchar_t* val2, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1269 if (wcscmp(val1, val2) < 0)
1270 succeed(message, stack_frame);
1271 else
1272 base_assert::fail("less than " + base_assert::to_string(val2), base_assert::to_string(val1), message, stack_frame);
1273 }
1275
1286 template<typename value1_t, typename value2_t>
1287 static void is_less_or_equal(const value1_t& val1, const value2_t& val2) {is_less_or_equal(val1, val2, "", xtd::diagnostics::stack_frame::empty());}
1288
1300 template<typename value1_t, typename value2_t>
1301 static void is_less_or_equal(const value1_t& val1, const value2_t& val2, const xtd::diagnostics::stack_frame& stack_frame) {is_less_or_equal(val1, val2, "", stack_frame);}
1302
1314 template<typename value1_t, typename value2_t>
1315 static void is_less_or_equal(const value1_t& val1, const value2_t& val2, const xtd::ustring& message) {is_less_or_equal(val1, val2, message, xtd::diagnostics::stack_frame::empty());}
1316
1329 template<typename value1_t, typename value2_t>
1330 static void is_less_or_equal(const value1_t& val1, const value2_t& val2, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1331 if (val1 <= val2)
1332 succeed(message, stack_frame);
1333 else
1334 base_assert::fail("less than or equal to " + base_assert::to_string(val2), base_assert::to_string(val1), message, stack_frame);
1335 }
1336
1338 static void is_less_or_equal(const char* val1, const char* val2, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1339 if (strcmp(val1, val2) <= 0)
1340 succeed(message, stack_frame);
1341 else
1342 base_assert::fail("less than or equal to " + base_assert::to_string(val2), base_assert::to_string(val1), message, stack_frame);
1343 }
1344
1345 static void is_less_or_equal(const char8_t* val1, const char8_t* val2, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1346 if (ustring(val1) < ustring(val2))
1347 succeed(message, stack_frame);
1348 else
1349 base_assert::fail("greather than " + base_assert::to_string(val2), base_assert::to_string(val1), message, stack_frame);
1350 }
1351
1352 static void is_less_or_equal(const char16_t* val1, const char16_t* val2, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1353 if (std::u16string(val1) < std::u16string(val2))
1354 succeed(message, stack_frame);
1355 else
1356 base_assert::fail("greather than " + base_assert::to_string(val2), base_assert::to_string(val1), message, stack_frame);
1357 }
1358
1359 static void is_less_or_equal(const char32_t* val1, const char32_t* val2, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1360 if (std::u32string(val1) < std::u32string(val2))
1361 succeed(message, stack_frame);
1362 else
1363 base_assert::fail("greather than " + base_assert::to_string(val2), base_assert::to_string(val1), message, stack_frame);
1364 }
1365
1366 static void is_less_or_equal(const wchar_t* val1, const wchar_t* val2, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1367 if (wcscmp(val1, val2) <= 0)
1368 succeed(message, stack_frame);
1369 else
1370 base_assert::fail("less than or equal to " + base_assert::to_string(val2), base_assert::to_string(val1), message, stack_frame);
1371 }
1373
1384 static void is_NaN(double value) {is_NaN(value, "", xtd::diagnostics::stack_frame::empty());}
1385
1397 static void is_NaN(double value, const xtd::diagnostics::stack_frame& stack_frame) {is_NaN(value, "", stack_frame);}
1398
1410 static void is_NaN(double value, const xtd::ustring& message) {is_NaN(value, message, xtd::diagnostics::stack_frame::empty());}
1411
1424 static void is_NaN(double value, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1425 if (std::isnan(value))
1426 succeed(message, stack_frame);
1427 else
1428 base_assert::fail("NaN", base_assert::to_string(value), message, stack_frame);
1429 }
1430
1441 static void is_NaN(long double value) {is_NaN(value, "", xtd::diagnostics::stack_frame::empty());}
1442
1454 static void is_NaN(long double value, const xtd::diagnostics::stack_frame& stack_frame) {is_NaN(value, "", stack_frame);}
1455
1467 static void is_NaN(long double value, const xtd::ustring& message) {is_NaN(value, message, xtd::diagnostics::stack_frame::empty());}
1468
1481 static void is_NaN(long double value, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1482 if (std::isnan(value))
1483 succeed(message, stack_frame);
1484 else
1485 base_assert::fail("NaN", base_assert::to_string(value), message, stack_frame);
1486 }
1487
1498 static void is_NaN(float value) {is_NaN(value, "", xtd::diagnostics::stack_frame::empty());}
1499
1511 static void is_NaN(float value, const xtd::diagnostics::stack_frame& stack_frame) {is_NaN(value, "", stack_frame);}
1512
1524 static void is_NaN(float value, const xtd::ustring& message) {is_NaN(value, message, xtd::diagnostics::stack_frame::empty());}
1525
1538 static void is_NaN(float value, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1539 if (std::isnan(value))
1540 succeed(message, stack_frame);
1541 else
1542 base_assert::fail("NaN", base_assert::to_string(value), message, stack_frame);
1543 }
1544
1555 template<typename value_t>
1556 static void is_negative(const value_t& value) {is_negative(value, "", xtd::diagnostics::stack_frame::empty());}
1557
1569 template<typename value_t>
1570 static void is_negative(const value_t& value, const xtd::diagnostics::stack_frame& stack_frame) {is_negative(value, "", stack_frame);}
1571
1583 template<typename value_t>
1584 static void is_negative(const value_t& value, const xtd::ustring& message) {is_negative(value, message, xtd::diagnostics::stack_frame::empty());}
1585
1598 template<typename value_t>
1599 static void is_negative(const value_t& value, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1600 if (value < 0)
1601 succeed(message, stack_frame);
1602 else
1603 base_assert::fail("negative", base_assert::to_string(value), message, stack_frame);
1604 }
1605
1616 template<typename value_t>
1617 static void is_not_empty(const value_t& value) {is_not_empty(value, "", xtd::diagnostics::stack_frame::empty());}
1618
1630 template<typename value_t>
1631 static void is_not_empty(const value_t& value, const xtd::diagnostics::stack_frame& stack_frame) {is_not_empty(value, "", stack_frame);}
1632
1644 template<typename value_t>
1645 static void is_not_empty(const value_t& value, const xtd::ustring& message) {is_not_empty(value, message, xtd::diagnostics::stack_frame::empty());}
1646
1659 template<typename value_t>
1660 static void is_not_empty(const value_t& value, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1661 if (!std::empty(value))
1662 succeed(message, stack_frame);
1663 else
1664 base_assert::fail("collection not <empty>", "<empty>", message, stack_frame);
1665 }
1666
1668 template<typename value_t>
1669 static void is_not_empty(const std::initializer_list<value_t>& value) {is_not_empty(value, "", xtd::diagnostics::stack_frame::empty());}
1670 template<typename value_t>
1671 static void is_not_empty(const std::initializer_list<value_t>& value, const xtd::diagnostics::stack_frame& stack_frame) {is_not_empty(value, "", stack_frame);}
1672 template<typename value_t>
1673 static void is_not_empty(const std::initializer_list<value_t>& value, const xtd::ustring& message) {is_not_empty(value, message, xtd::diagnostics::stack_frame::empty());}
1674 template<typename value_t>
1675 static void is_not_empty(const std::initializer_list<value_t>& value, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1676 if (!std::empty(value))
1677 succeed(message, stack_frame);
1678 else
1679 base_assert::fail("collection not <empty>", "<empty>", message, stack_frame);
1680 }
1681
1682 static void is_not_empty(const char* value, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1683 if (!ustring(value).is_empty())
1684 succeed(message, stack_frame);
1685 else
1686 base_assert::fail("collection not <empty>", "<empty>", message, stack_frame);
1687 }
1688
1689 static void is_not_empty(const char8_t* value, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1690 if (!ustring(value).is_empty())
1691 succeed(message, stack_frame);
1692 else
1693 base_assert::fail("collection not <empty>", "<empty>", message, stack_frame);
1694 }
1695
1696 static void is_not_empty(const char16_t* value, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1697 if (!ustring(value).is_empty())
1698 succeed(message, stack_frame);
1699 else
1700 base_assert::fail("collection not <empty>", "<empty>", message, stack_frame);
1701 }
1702
1703 static void is_not_empty(const char32_t* value, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1704 if (!ustring(value).is_empty())
1705 succeed(message, stack_frame);
1706 else
1707 base_assert::fail("collection not <empty>", "<empty>", message, stack_frame);
1708 }
1709
1710 static void is_not_empty(const wchar_t* value, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1711 if (!ustring(value).is_empty())
1712 succeed(message, stack_frame);
1713 else
1714 base_assert::fail("collection not <empty>", "<empty>", message, stack_frame);
1715 }
1717
1727 template<typename type_t, typename value_t>
1728 static void is_not_instance_of(const value_t& value) {is_not_instance_of<type_t>(value, "", xtd::diagnostics::stack_frame::empty());}
1729
1740 template<typename type_t, typename value_t>
1741 static void is_not_instance_of(const value_t& value, const xtd::diagnostics::stack_frame& stack_frame) {is_not_instance_of<type_t>(value, "", stack_frame);}
1742
1753 template<typename type_t, typename value_t>
1754 static void is_not_instance_of(const value_t& value, const xtd::ustring& message) {is_not_instance_of<type_t>(value, message, xtd::diagnostics::stack_frame::empty());}
1755
1767 template<typename type_t, typename value_t>
1768 static void is_not_instance_of(const value_t& value, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1769 if (dynamic_cast<const type_t*>(&value) == nullptr)
1770 succeed(message, stack_frame);
1771 else
1772 base_assert::fail("not instance of <" + __tunit_demangle(typeid(type_t).name()) + ">", "<" + __tunit_demangle(typeid(value).name()) + ">", message, stack_frame);
1773 }
1774
1786 template<typename pointer_t>
1787 static void is_not_null(const pointer_t* pointer) {is_not_null(pointer, "", xtd::diagnostics::stack_frame::empty());}
1788
1801 template<typename pointer_t>
1802 static void is_not_null(const pointer_t* pointer, const xtd::diagnostics::stack_frame& stack_frame) {is_not_null(pointer, "", stack_frame);}
1803
1816 template<typename pointer_t>
1817 static void is_not_null(const pointer_t* pointer, const xtd::ustring& message) {is_not_null(pointer, message, xtd::diagnostics::stack_frame::empty());}
1818
1832 template<typename pointer_t>
1833 static void is_not_null(const pointer_t* pointer, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1834 if (pointer != nullptr)
1835 succeed(message, stack_frame);
1836 else
1837 base_assert::fail("not null", "null", message, stack_frame);
1838 }
1839
1850 template<typename pointer_t>
1851 static void is_not_null(const std::unique_ptr<pointer_t>& pointer) {is_not_null(pointer, "", xtd::diagnostics::stack_frame::empty());}
1852
1864 template<typename pointer_t>
1865 static void is_not_null(const std::unique_ptr<pointer_t>& pointer, const xtd::diagnostics::stack_frame& stack_frame) {is_not_null(pointer, "", stack_frame);}
1866
1878 template<typename pointer_t>
1879 static void is_not_null(const std::unique_ptr<pointer_t>& pointer, const xtd::ustring& message) {is_not_null(pointer, message, xtd::diagnostics::stack_frame::empty());}
1880
1893 template<typename pointer_t>
1894 static void is_not_null(const std::unique_ptr<pointer_t>& pointer, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1895 if (pointer != nullptr)
1896 succeed(message, stack_frame);
1897 else
1898 base_assert::fail("not null", "null", message, stack_frame);
1899 }
1900
1911 template<typename pointer_t>
1912 static void is_not_null(const std::shared_ptr<pointer_t>& pointer) {is_not_null(pointer, "", xtd::diagnostics::stack_frame::empty());}
1913
1925 template<typename pointer_t>
1926 static void is_not_null(const std::shared_ptr<pointer_t>& pointer, const xtd::diagnostics::stack_frame& stack_frame) {is_not_null(pointer, "", stack_frame);}
1927
1939 template<typename pointer_t>
1940 static void is_not_null(const std::shared_ptr<pointer_t>& pointer, const xtd::ustring& message) {is_not_null(pointer, message, xtd::diagnostics::stack_frame::empty());}
1941
1954 template<typename pointer_t>
1955 static void is_not_null(const std::shared_ptr<pointer_t>& pointer, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
1956 if (pointer != nullptr)
1957 succeed(message, stack_frame);
1958 else
1959 base_assert::fail("not null", "null", message, stack_frame);
1960 }
1961
1973 template<typename pointer_t>
1974 static void is_not_null(const std::weak_ptr<pointer_t>& pointer) {is_not_null(pointer, "", xtd::diagnostics::stack_frame::empty());}
1975
1988 template<typename pointer_t>
1989 static void is_not_null(const std::weak_ptr<pointer_t>& pointer, const xtd::diagnostics::stack_frame& stack_frame) {is_not_null(pointer, "", stack_frame);}
1990
2003 template<typename pointer_t>
2004 static void is_not_null(const std::weak_ptr<pointer_t>& pointer, const xtd::ustring& message) {is_not_null(pointer, message, xtd::diagnostics::stack_frame::empty());}
2005
2019 template<typename pointer_t>
2020 static void is_not_null(const std::weak_ptr<pointer_t>& pointer, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {succeed(message, stack_frame);}
2021
2030 static void is_not_null(std::nullptr_t pointer) {is_not_null(pointer, "", xtd::diagnostics::stack_frame::empty());}
2031
2041 static void is_not_null(std::nullptr_t pointer, const xtd::diagnostics::stack_frame& stack_frame) {is_not_null(pointer, "", stack_frame);}
2042
2052 static void is_not_null(std::nullptr_t pointer, const xtd::ustring& message) {is_not_null(pointer, message, xtd::diagnostics::stack_frame::empty());}
2053
2064 static void is_not_null(std::nullptr_t pointer, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {base_assert::fail("not null", "null", message, stack_frame);}
2065
2076 template<typename value_t>
2077 static void is_not_zero(const value_t& value) {is_not_zero(value, "", xtd::diagnostics::stack_frame::empty());}
2078
2090 template<typename value_t>
2091 static void is_not_zero(const value_t& value, const xtd::diagnostics::stack_frame& stack_frame) {is_not_zero(value, "", stack_frame);}
2092
2104 template<typename value_t>
2105 static void is_not_zero(const value_t& value, const xtd::ustring& message) {is_not_zero(value, message, xtd::diagnostics::stack_frame::empty());}
2106
2119 template<typename value_t>
2120 static void is_not_zero(const value_t& value, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
2121 if (value != 0)
2122 succeed(message, stack_frame);
2123 else
2124 base_assert::fail("not zero", "0", message, stack_frame);
2125 }
2126
2138 template<typename pointer_t>
2139 static void is_null(const pointer_t* pointer) {is_null(pointer, "", xtd::diagnostics::stack_frame::empty());}
2140
2153 template<typename pointer_t>
2154 static void is_null(const pointer_t* pointer, const xtd::diagnostics::stack_frame& stack_frame) {is_null(pointer, "", stack_frame);}
2155
2168 template<typename pointer_t>
2169 static void is_null(const pointer_t* pointer, const xtd::ustring& message) {is_null(pointer, message, xtd::diagnostics::stack_frame::empty());}
2170
2184 template<typename pointer_t>
2185 static void is_null(const pointer_t* pointer, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
2186 if (pointer == nullptr)
2187 succeed(message, stack_frame);
2188 else
2189 base_assert::fail("null", "not null", message, stack_frame);
2190 }
2191
2202 template<typename pointer_t>
2203 static void is_null(const std::unique_ptr<pointer_t>& pointer) {is_null(pointer, "", xtd::diagnostics::stack_frame::empty());}
2204
2216 template<typename pointer_t>
2217 static void is_null(const std::unique_ptr<pointer_t>& pointer, const xtd::diagnostics::stack_frame& stack_frame) {is_null(pointer, "", stack_frame);}
2218
2230 template<typename pointer_t>
2231 static void is_null(const std::unique_ptr<pointer_t>& pointer, const xtd::ustring& message) {is_null(pointer, message, xtd::diagnostics::stack_frame::empty());}
2232
2245 template<typename pointer_t>
2246 static void is_null(const std::unique_ptr<pointer_t>& pointer, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
2247 if (pointer == nullptr)
2248 succeed(message, stack_frame);
2249 else
2250 base_assert::fail("null", "not null", message, stack_frame);
2251 }
2252
2263 template<typename pointer_t>
2264 static void is_null(const std::shared_ptr<pointer_t>& pointer) {is_null(pointer, "", xtd::diagnostics::stack_frame::empty());}
2265
2277 template<typename pointer_t>
2278 static void is_null(const std::shared_ptr<pointer_t>& pointer, const xtd::diagnostics::stack_frame& stack_frame) {is_null(pointer, "", stack_frame);}
2279
2291 template<typename pointer_t>
2292 static void is_null(const std::shared_ptr<pointer_t>& pointer, const xtd::ustring& message) {is_null(pointer, message, xtd::diagnostics::stack_frame::empty());}
2293
2306 template<typename pointer_t>
2307 static void is_null(const std::shared_ptr<pointer_t>& pointer, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
2308 if (pointer == nullptr)
2309 succeed(message, stack_frame);
2310 else
2311 base_assert::fail("null", "not null", message, stack_frame);
2312 }
2313
2325 template<typename pointer_t>
2326 static void is_null(const std::weak_ptr<pointer_t>& pointer) {is_null(pointer, "", xtd::diagnostics::stack_frame::empty());}
2327
2340 template<typename pointer_t>
2341 static void is_null(const std::weak_ptr<pointer_t>& pointer, const xtd::diagnostics::stack_frame& stack_frame) {is_null(pointer, "", stack_frame);}
2342
2355 template<typename pointer_t>
2356 static void is_null(const std::weak_ptr<pointer_t>& pointer, const xtd::ustring& message) {is_null(pointer, message, xtd::diagnostics::stack_frame::empty());}
2357
2371 template<typename pointer_t>
2372 static void is_null(const std::weak_ptr<pointer_t>& pointer, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {base_assert::fail("null", "not null", message, stack_frame);}
2373
2382 static void is_null(std::nullptr_t pointer) {is_null(pointer, "", xtd::diagnostics::stack_frame::empty());}
2383
2393 static void is_null(std::nullptr_t pointer, const xtd::diagnostics::stack_frame& stack_frame) {is_null(pointer, "", stack_frame);}
2394
2404 static void is_null(std::nullptr_t pointer, const xtd::ustring& message) {is_null(pointer, message, xtd::diagnostics::stack_frame::empty());}
2405
2416 static void is_null(std::nullptr_t pointer, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {succeed(message, stack_frame);}
2417
2428 template<typename value_t>
2429 static void is_positive(const value_t& value) {is_positive(value, "", xtd::diagnostics::stack_frame::empty());}
2430
2442 template<typename value_t>
2443 static void is_positive(const value_t& value, const xtd::diagnostics::stack_frame& stack_frame) {is_positive(value, "", stack_frame);}
2444
2456 template<typename value_t>
2457 static void is_positive(const value_t& value, const xtd::ustring& message) {is_positive(value, message, xtd::diagnostics::stack_frame::empty());}
2458
2471 template<typename value_t>
2472 static void is_positive(const value_t& value, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
2473 if (value > 0)
2474 succeed(message, stack_frame);
2475 else
2476 base_assert::fail("positive", base_assert::to_string(value), message, stack_frame);
2477 }
2478
2489 static void is_true(bool condition) {is_true(condition, "", xtd::diagnostics::stack_frame::empty());}
2490
2502 static void is_true(bool condition, const xtd::diagnostics::stack_frame& stack_frame) {is_true(condition, "", stack_frame);}
2503
2515 static void is_true(bool condition, const xtd::ustring& message) {is_true(condition, message, xtd::diagnostics::stack_frame::empty());}
2516
2529 static void is_true(bool condition, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
2530 if (condition == true)
2531 succeed(message, stack_frame);
2532 else
2533 base_assert::fail("true", "false", message, stack_frame);
2534 }
2535
2546 template<typename value_t>
2547 static void is_zero(const value_t& value) {is_zero(value, "", xtd::diagnostics::stack_frame::empty());}
2548
2560 template<typename value_t>
2561 static void is_zero(const value_t& value, const xtd::diagnostics::stack_frame& stack_frame) {is_zero(value, "", stack_frame);}
2562
2574 template<typename value_t>
2575 static void is_zero(const value_t& value, const xtd::ustring& message) {is_zero(value, message, xtd::diagnostics::stack_frame::empty());}
2576
2589 template<typename value_t>
2590 static void is_zero(const value_t& value, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
2591 if (value == 0)
2592 succeed(message, stack_frame);
2593 else
2594 base_assert::fail("zero", base_assert::to_string(value), message, stack_frame);
2595 }
2596
2607 template<typename exception_t>
2608 static void throws(const std::function<void()>& statement) {throws<exception_t>(statement, "", xtd::diagnostics::stack_frame::empty());}
2609
2621 template<typename exception_t>
2622 static void throws(const std::function<void()>& statement, const xtd::diagnostics::stack_frame& stack_frame) {throws<exception_t>(statement, "", stack_frame);}
2623
2635 template<typename exception_t>
2636 static void throws(const std::function<void()>& statement, const xtd::ustring& message) {throws<exception_t>(statement, message, xtd::diagnostics::stack_frame::empty());}
2637
2650 template<typename exception_t>
2651 static void throws(const std::function<void()>& statement, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
2652 try {
2653 statement();
2654 base_assert::fail("<" + __tunit_demangle(typeid(exception_t).name()) + ">", "<nothing>", message, stack_frame);
2655 } catch (const exception_t&) {
2656 succeed(message, stack_frame);
2657 } catch (const xtd::tunit::assert_error&) {
2658 throw;
2659 } catch (const std::exception& e) {
2660 base_assert::fail("<" + __tunit_demangle(typeid(exception_t).name()) + ">", "<" + __tunit_demangle(typeid(e).name()) + ">", message, stack_frame);
2661 } catch (...) {
2662 base_assert::fail("<" + __tunit_demangle(typeid(exception_t).name()) + ">", "<exception>", message, stack_frame);
2663 }
2664 }
2665
2675 static void throws_any(const std::function<void()>& statement) {throws_any(statement, "", xtd::diagnostics::stack_frame::empty());}
2676
2687 static void throws_any(const std::function<void()>& statement, const xtd::diagnostics::stack_frame& stack_frame) {throws_any(statement, "", stack_frame);}
2688
2699 static void throws_any(const std::function<void()>& statement, const xtd::ustring& message) {throws_any(statement, message, xtd::diagnostics::stack_frame::empty());}
2700
2712 static void throws_any(const std::function<void()>& statement, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
2713 try {
2714 statement();
2715 base_assert::fail("<exception>", "<nothing>", message, stack_frame);
2716 } catch (const xtd::tunit::assert_error&) {
2717 throw;
2718 } catch (...) {
2719 succeed(message, stack_frame);
2720 }
2721 }
2722
2723 private:
2724 };
2725 }
2726}
2727
2729#define __CMD_ASSERT_0_ARGS__(cmd) cmd(csf_)
2730#define __CMD_ASSERT_1_ARGS__(cmd, arg1) cmd(arg1, csf_)
2731#define __CMD_ASSERT_2_ARGS__(cmd, arg1, arg2) cmd(arg1, arg2, csf_)
2732#define __CMD_ASSERT_3_ARGS__(cmd, arg1, arg2, arg3) cmd(arg1, arg2, arg3, csf_)
2733#define __CMD_ASSERT_4_ARGS__(cmd, arg1, arg2, arg3, arg4) cmd(arg1, arg2, arg3, arg4, csf_)
2734#define __CMD_ASSERT_5_ARGS__(cmd, arg1, arg2, arg3, arg4) cmd(arg1, arg2, arg3, arg4, arg5, csf_)
2735#define __GET_LAST_ARG(arg1, arg2, arg3, arg4, arg5, arg6, ...) arg6
2736#define __CMD_ASSERT_MACRO_CHOOSER(cmd, ...) __GET_LAST_ARG(__VA_ARGS__, __CMD_ASSERT_5_ARGS__, __CMD_ASSERT_4_ARGS__, __CMD_ASSERT_3_ARGS__, __CMD_ASSERT_2_ARGS__, __CMD_ASSERT_1_ARGS__, __CMD_ASSERT_0_ARGS__, )
2737#define __CMD_ASSERT_ARGS(cmd, ...) __CMD_ASSERT_MACRO_CHOOSER(cmd, __VA_ARGS__)(cmd, __VA_ARGS__)
2739
2740#define abort_() abort(csf_)
2741
2742#define are_equal_(...) __CMD_ASSERT_ARGS(are_equal, __VA_ARGS__)
2743
2744#define are_not_equal_(...) __CMD_ASSERT_ARGS(are_not_equal, __VA_ARGS__)
2745
2746#define are_not_same_(...) __CMD_ASSERT_ARGS(are_not_same, __VA_ARGS__)
2747
2748#define are_same_(...) __CMD_ASSERT_ARGS(are_same, __VA_ARGS__)
2749
2750#define contains_(...) __CMD_ASSERT_ARGS(contains, __VA_ARGS__)
2751
2752#define does_not_throw_(...) __CMD_ASSERT_ARGS(does_not_throw, __VA_ARGS__)
2753
2754#define fail_() base_assert::fail(csf_)
2755
2756#define ignore_() ignore(csf_)
2757
2758#define is_empty_(...) __CMD_ASSERT_ARGS(is_empty, __VA_ARGS__)
2759
2760#define is_false_(...) __CMD_ASSERT_ARGS(is_false, __VA_ARGS__)
2761
2762#define is_greater_(...) __CMD_ASSERT_ARGS(is_greater, __VA_ARGS__)
2763
2764#define is_greater_or_equal_(...) __CMD_ASSERT_ARGS(is_greater_or_equal, __VA_ARGS__)
2765
2766#define is_instance_of_(type_t, ...) __CMD_ASSERT_ARGS(is_instance_of<type_t>, __VA_ARGS__)
2767
2768#define is_less_(...) __CMD_ASSERT_ARGS(is_less, __VA_ARGS__)
2769
2770#define is_less_or_equal_(...) __CMD_ASSERT_ARGS(is_less_or_equal, __VA_ARGS__)
2771
2772#define is_NaN_(...) __CMD_ASSERT_ARGS(is_NaN, __VA_ARGS__)
2773
2774#define is_negative_(...) __CMD_ASSERT_ARGS(is_negative, __VA_ARGS__)
2775
2776#define is_not_empty_(...) __CMD_ASSERT_ARGS(is_not_empty, __VA_ARGS__)
2777
2778#define is_not_instance_of_(type_t, ...) __CMD_ASSERT_ARGS(is_not_instance_of<type_t>, __VA_ARGS__)
2779
2780#define is_not_null_(...) __CMD_ASSERT_ARGS(is_not_null, __VA_ARGS__)
2781
2782#define is_not_zero_(...) __CMD_ASSERT_ARGS(is_not_zero, __VA_ARGS__)
2783
2784#define is_null_(...) __CMD_ASSERT_ARGS(is_null, __VA_ARGS__)
2785
2786#define is_positive_(...) __CMD_ASSERT_ARGS(is_positive, __VA_ARGS__)
2787
2788#define is_true_(...) __CMD_ASSERT_ARGS(is_true, __VA_ARGS__)
2789
2790#define is_zero_(...) __CMD_ASSERT_ARGS(is_zero, __VA_ARGS__)
2791
2792#define succeed_() succeed(csf_)
2793
2794#define throws_(exception_t, ...) __CMD_ASSERT_ARGS(throws<exception_t>, __VA_ARGS__)
2795
2796#define throws_any_(...) __CMD_ASSERT_ARGS(throws_any, __VA_ARGS__)
Contains xtd::tunit::assert class.
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.
Exception thow when an assertion failed.
Definition assert_error.h:18
The assert class contains a collection of static methods that implement the most common assertions us...
Definition assert.h:34
static void are_equal(const expected_t &expected, const actual_t &actual, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that two type are equal.
Definition assert.h:90
static void is_null(const std::unique_ptr< pointer_t > &pointer, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the pointer is null.
Definition assert.h:2246
static void is_null(const pointer_t *pointer, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the pointer is null.
Definition assert.h:2154
static void is_not_zero(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that ta condition is not zero.
Definition assert.h:2091
static void are_equal(float expected, float actual, float tolerance)
Asserts that two type are equal.
Definition assert.h:172
static void is_null(const std::shared_ptr< pointer_t > &pointer, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the pointer is null.
Definition assert.h:2278
static void is_greater_or_equal(const value1_t &val1, const value2_t &val2, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the first value is greater than or equal to the second value.
Definition assert.h:1050
static void is_not_null(std::nullptr_t pointer, const xtd::ustring &message)
Asserts that the pointer is not null.
Definition assert.h:2052
static void are_not_same(const expected_t &expected, const actual_t &actual)
Asserts that two objects do refer to differents objects.
Definition assert.h:451
static void is_negative(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that ta condition is negative.
Definition assert.h:1570
static void is_NaN(double value, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that a value is NaN.
Definition assert.h:1424
static void is_null(const std::shared_ptr< pointer_t > &pointer)
Asserts that the pointer is null.
Definition assert.h:2264
static void is_null(std::nullptr_t pointer, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the pointer is null.
Definition assert.h:2393
static void is_NaN(long double value, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that a value is NaN.
Definition assert.h:1481
static void is_not_null(std::nullptr_t pointer, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the pointer is not null.
Definition assert.h:2064
static void is_null(std::nullptr_t pointer, const xtd::ustring &message)
Asserts that the pointer is null.
Definition assert.h:2404
static void are_same(const expected_t &expected, const actual_t &actual)
Asserts that two objects do refer to differents objects.
Definition assert.h:520
static void are_equal(double expected, double actual, double tolerance, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that two type are equal.
Definition assert.h:276
static void throws_any(const std::function< void()> &statement, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the staement does not throw an exception.
Definition assert.h:2712
static void is_not_null(const std::unique_ptr< pointer_t > &pointer, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the pointer is not null.
Definition assert.h:1894
static void is_null(const std::unique_ptr< pointer_t > &pointer)
Asserts that the pointer is null.
Definition assert.h:2203
static void is_not_null(const std::shared_ptr< pointer_t > &pointer, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the pointer is not null.
Definition assert.h:1955
static void is_null(const std::weak_ptr< pointer_t > &pointer, const xtd::ustring &message)
Asserts that the pointer is null.
Definition assert.h:2356
static void is_instance_of(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that an object is of the type supplied or a derived type.
Definition assert.h:1146
static void is_null(const std::weak_ptr< pointer_t > &pointer)
Asserts that the pointer is null.
Definition assert.h:2326
static void are_not_same(const expected_t &expected, const actual_t &actual, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that two objects do refer to differents objects.
Definition assert.h:500
static void is_greater(const value1_t &val1, const value2_t &val2, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the first value is greater than the second value.
Definition assert.h:954
static void is_not_null(const pointer_t *pointer, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the pointer is not null.
Definition assert.h:1802
static void is_less_or_equal(const value1_t &val1, const value2_t &val2, const xtd::ustring &message)
Asserts that the first value is is_less than or equal to the second value.
Definition assert.h:1315
static void is_not_zero(const value_t &value, const xtd::ustring &message)
Asserts that ta condition is not zero.
Definition assert.h:2105
static void is_empty(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that collection contains an item.
Definition assert.h:782
static void is_zero(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that ta condition is zero.
Definition assert.h:2561
static void is_not_zero(const value_t &value, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that ta condition is not zero.
Definition assert.h:2120
static void is_not_null(const std::unique_ptr< pointer_t > &pointer)
Asserts that the pointer is not null.
Definition assert.h:1851
static void is_not_null(const std::weak_ptr< pointer_t > &pointer, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the pointer is not null.
Definition assert.h:1989
static void is_null(const pointer_t *pointer, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the pointer is null.
Definition assert.h:2185
static void is_null(const pointer_t *pointer, const xtd::ustring &message)
Asserts that the pointer is null.
Definition assert.h:2169
static void is_greater_or_equal(const value1_t &val1, const value2_t &val2, const xtd::ustring &message)
Asserts that the first value is greater than or equal to the second value.
Definition assert.h:1064
static void is_false(bool condition)
Asserts that ta condition is false.
Definition assert.h:884
static void are_not_equal(const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that two type are not equal.
Definition assert.h:367
static void is_null(std::nullptr_t pointer)
Asserts that the pointer is null.
Definition assert.h:2382
static void are_equal(float expected, float actual, float tolerance, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that two type are equal.
Definition assert.h:215
static void are_same(const expected_t &expected, const actual_t &actual, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that two objects do refer to differents objects.
Definition assert.h:569
static void is_less(const value1_t &val1, const value2_t &val2)
Asserts that the first value is is_less than the second value.
Definition assert.h:1191
static void is_instance_of(const value_t &value, const xtd::ustring &message)
Asserts that an object is of the type supplied or a derived type.
Definition assert.h:1159
static void is_greater_or_equal(const value1_t &val1, const value2_t &val2)
Asserts that the first value is greater than or equal to the second value.
Definition assert.h:1036
static void is_true(bool condition, const xtd::ustring &message)
Asserts that a condition is true.
Definition assert.h:2515
static void contains(const item_t &item, const collection_t &collection, const xtd::ustring &message)
Asserts that collection contains an item.
Definition assert.h:615
static void is_not_null(std::nullptr_t pointer, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the pointer is not null.
Definition assert.h:2041
static void is_not_null(const pointer_t *pointer, const xtd::ustring &message)
Asserts that the pointer is not null.
Definition assert.h:1817
static void is_less_or_equal(const value1_t &val1, const value2_t &val2)
Asserts that the first value is is_less than or equal to the second value.
Definition assert.h:1287
static void does_not_throw(const std::function< void()> &statement, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the staement does not throw an exception.
Definition assert.h:721
static void is_zero(const value_t &value, const xtd::ustring &message)
Asserts that ta condition is zero.
Definition assert.h:2575
static void are_equal(float expected, float actual, float tolerance, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that two type are equal.
Definition assert.h:186
static void is_less(const value1_t &val1, const value2_t &val2, const xtd::ustring &message)
Asserts that the first value is is_less than the second value.
Definition assert.h:1217
static void is_greater(const value1_t &val1, const value2_t &val2, const xtd::ustring &message)
Asserts that the first value is greater than the second value.
Definition assert.h:967
static void is_empty(const value_t &value, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that collection contains an item.
Definition assert.h:811
static void is_not_instance_of(const value_t &value)
Asserts that an object is not of the type supplied or a derived type.
Definition assert.h:1728
static void is_instance_of(const value_t &value)
Asserts that an object is of the type supplied or a derived type.
Definition assert.h:1133
static void is_empty(const value_t &value, const xtd::ustring &message)
Asserts that collection contains an item.
Definition assert.h:796
static void is_true(bool condition, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that a condition is true.
Definition assert.h:2502
static void are_equal(long double expected, long double actual, long double tolerance)
Asserts that two type are equal.
Definition assert.h:294
static void is_less(const value1_t &val1, const value2_t &val2, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the first value is is_less than the second value.
Definition assert.h:1231
static void is_NaN(double value)
that a value is NaN.
Definition assert.h:1384
static void is_not_null(const std::shared_ptr< pointer_t > &pointer, const xtd::ustring &message)
Asserts that the pointer is not null.
Definition assert.h:1940
static void is_NaN(long double value, const xtd::diagnostics::stack_frame &stack_frame)
that a value is NaN.
Definition assert.h:1454
static void is_less_or_equal(const value1_t &val1, const value2_t &val2, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the first value is is_less than or equal to the second value.
Definition assert.h:1330
static void are_equal(double expected, double actual, double tolerance, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that two type are equal.
Definition assert.h:247
static void is_positive(const value_t &value, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that ta condition is positive.
Definition assert.h:2472
static void is_not_null(const std::unique_ptr< pointer_t > &pointer, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the pointer is not null.
Definition assert.h:1865
static void does_not_throw(const std::function< void()> &statement, const xtd::ustring &message)
Asserts that the staement does not throw an exception.
Definition assert.h:733
static void are_equal(const expected_t &expected, const actual_t &actual, const xtd::ustring &message)
Asserts that two type are equal.
Definition assert.h:76
static void is_not_null(std::nullptr_t pointer)
Asserts that the pointer is not null.
Definition assert.h:2030
static void are_equal(long double expected, long double actual, long double tolerance, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that two type are equal.
Definition assert.h:308
static void is_not_null(const std::unique_ptr< pointer_t > &pointer, const xtd::ustring &message)
Asserts that the pointer is not null.
Definition assert.h:1879
static void is_not_zero(const value_t &value)
Asserts that ta condition is not zero.
Definition assert.h:2077
static void is_false(bool condition, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that a condition is false.
Definition assert.h:897
static void contains(const item_t &item, const collection_t &collection, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that collection contains an item.
Definition assert.h:630
static void are_equal(long double expected, long double actual, long double tolerance, const xtd::ustring &message)
Asserts that two type are equal.
Definition assert.h:322
static void are_equal(float expected, float &actual, float tolerance, const xtd::ustring &message)
Asserts that two type are equal.
Definition assert.h:200
static void is_zero(const value_t &value, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that ta condition is zero.
Definition assert.h:2590
static void is_positive(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that ta condition is positive.
Definition assert.h:2443
static void does_not_throw(const std::function< void()> &statement, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the staement does not throw an exception.
Definition assert.h:746
static void is_true(bool condition, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that a condition is true.
Definition assert.h:2529
static void throws_any(const std::function< void()> &statement)
Asserts that the staement does not throw an exception.
Definition assert.h:2675
static void is_NaN(float value, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that a value is NaN.
Definition assert.h:1538
static void are_equal(long double expected, long double actual, long double tolerance, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that two type are equal.
Definition assert.h:337
static void is_negative(const value_t &value)
Asserts that ta condition is negative.
Definition assert.h:1556
static void is_positive(const value_t &value, const xtd::ustring &message)
Asserts that ta condition is positive.
Definition assert.h:2457
static void is_false(bool condition, const xtd::ustring &message)
Asserts that a condition is false.
Definition assert.h:910
static void is_negative(const value_t &value, const xtd::ustring &message)
Asserts that ta condition is negative.
Definition assert.h:1584
static void is_empty(const value_t &value)
Asserts that collection contains an item.
Definition assert.h:768
static void is_not_empty(const value_t &value, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that collection does not contain any item.
Definition assert.h:1660
static void is_null(const std::shared_ptr< pointer_t > &pointer, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the pointer is null.
Definition assert.h:2307
static void is_null(const std::weak_ptr< pointer_t > &pointer, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the pointer is null.
Definition assert.h:2341
static void is_less_or_equal(const value1_t &val1, const value2_t &val2, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the first value is is_less than or equal to the second value.
Definition assert.h:1301
static void is_null(const std::unique_ptr< pointer_t > &pointer, const xtd::ustring &message)
Asserts that the pointer is null.
Definition assert.h:2231
static void are_not_same(const expected_t &expected, const actual_t &actual, const xtd::ustring &message)
Asserts that two objects do refer to differents objects.
Definition assert.h:483
static void is_NaN(float value, const xtd::diagnostics::stack_frame &stack_frame)
that a value is NaN.
Definition assert.h:1511
static void is_true(bool condition)
Asserts that ta condition is true.
Definition assert.h:2489
static void is_NaN(long double value)
that a value is NaN.
Definition assert.h:1441
static void is_NaN(double value, const xtd::ustring &message)
Asserts that a value is NaN.
Definition assert.h:1410
static void is_not_empty(const value_t &value, const xtd::ustring &message)
Asserts that collection does not contain any item.
Definition assert.h:1645
static void is_not_empty(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that collection does not contain any item.
Definition assert.h:1631
static void does_not_throw(const std::function< void()> &statement)
Asserts that the staement does not throw an exception.
Definition assert.h:709
static void is_not_null(const std::shared_ptr< pointer_t > &pointer, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the pointer is not null.
Definition assert.h:1926
static void is_greater(const value1_t &val1, const value2_t &val2, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the first value is greater than the second value.
Definition assert.h:981
static void is_NaN(float value, const xtd::ustring &message)
Asserts that a value is NaN.
Definition assert.h:1524
static void is_null(const std::unique_ptr< pointer_t > &pointer, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the pointer is null.
Definition assert.h:2217
static void is_not_null(const std::weak_ptr< pointer_t > &pointer, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the pointer is not null.
Definition assert.h:2020
static void is_not_empty(const value_t &value)
Asserts that collection oes not contain any item.
Definition assert.h:1617
static void contains(const item_t &item, const collection_t &collection, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that collection contains an item.
Definition assert.h:601
static void are_equal(const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that two type are equal.
Definition assert.h:63
static void is_not_null(const pointer_t *pointer)
Asserts that the pointer is not null.
Definition assert.h:1787
static void is_null(const std::weak_ptr< pointer_t > &pointer, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the pointer is null.
Definition assert.h:2372
static void is_negative(const value_t &value, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that ta condition is negative.
Definition assert.h:1599
static void is_positive(const value_t &value)
Asserts that ta condition is positive.
Definition assert.h:2429
static void is_less(const value1_t &val1, const value2_t &val2, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the first value is is_less than the second value.
Definition assert.h:1204
static void throws_any(const std::function< void()> &statement, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the staement does not throw an exception.
Definition assert.h:2687
static void is_not_instance_of(const value_t &value, const xtd::ustring &message)
Asserts that an object is not of the type supplied or a derived type.
Definition assert.h:1754
static void is_null(const pointer_t *pointer)
Asserts that the pointer is null.
Definition assert.h:2139
static void is_greater(const value1_t &val1, const value2_t &val2)
Asserts that the first value is greater than the second value.
Definition assert.h:941
static void is_zero(const value_t &value)
Asserts that ta condition is zero.
Definition assert.h:2547
static void is_not_null(const std::weak_ptr< pointer_t > &pointer)
Asserts that the pointer is not null.
Definition assert.h:1974
static void are_equal(double expected, double actual, double tolerance)
Asserts that two type are equal.
Definition assert.h:233
static void is_not_instance_of(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that an object is not of the type supplied or a derived type.
Definition assert.h:1741
static void is_null(const std::shared_ptr< pointer_t > &pointer, const xtd::ustring &message)
Asserts that the pointer is null.
Definition assert.h:2292
static void are_equal(const expected_t &expected, const actual_t &actual)
Asserts that two type are equal.
Definition assert.h:50
static void are_not_equal(const expected_t &expected, const actual_t &actual)
Asserts that two type are not equal.
Definition assert.h:354
static void are_same(const expected_t &expected, const actual_t &actual, const xtd::ustring &message)
Asserts that two objects do refer to differents objects.
Definition assert.h:552
static void is_not_null(const std::shared_ptr< pointer_t > &pointer)
Asserts that the pointer is not null.
Definition assert.h:1912
static void are_not_equal(const expected_t &expected, const actual_t &actual, const xtd::ustring &message)
Asserts that two type are not equal.
Definition assert.h:380
static void is_not_null(const pointer_t *pointer, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the pointer is not null.
Definition assert.h:1833
static void are_not_equal(const expected_t &expected, const actual_t &actual, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that two type are not equal.
Definition assert.h:394
static void is_NaN(float value)
that a value is NaN.
Definition assert.h:1498
static void is_false(bool condition, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that a condition is false.
Definition assert.h:924
static void is_NaN(long double value, const xtd::ustring &message)
Asserts that a value is NaN.
Definition assert.h:1467
static void are_not_same(const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that two objects do refer to differents objects.
Definition assert.h:467
static void is_not_instance_of(const value_t &value, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that an object is not of the type supplied or a derived type.
Definition assert.h:1768
static void is_NaN(double value, const xtd::diagnostics::stack_frame &stack_frame)
that a value is NaN.
Definition assert.h:1397
static void throws_any(const std::function< void()> &statement, const xtd::ustring &message)
Asserts that the staement does not throw an exception.
Definition assert.h:2699
static void are_same(const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that two objects do refer to differents objects.
Definition assert.h:536
static void are_equal(double expected, double actual, double tolerance, const xtd::ustring &message)
Asserts that two type are equal.
Definition assert.h:261
static void is_instance_of(const value_t &value, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that an object is of the type supplied or a derived type.
Definition assert.h:1173
static void is_null(std::nullptr_t pointer, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the pointer is null.
Definition assert.h:2416
static void contains(const item_t &item, const collection_t &collection)
Asserts that collection contains an item.
Definition assert.h:587
static void is_not_null(const std::weak_ptr< pointer_t > &pointer, const xtd::ustring &message)
Asserts that the pointer is not null.
Definition assert.h:2004
static void is_greater_or_equal(const value1_t &val1, const value2_t &val2, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that the first value is greater than or equal to the second value.
Definition assert.h:1079
The base class for assert.
Definition base_assert.h:25
static void fail()
Throws an xtd::tunit::assertion_error exception. This is used by the other Assert functions.
Definition base_assert.h:70
static void succeed()
Generates a success with a generic message. This is used by the other Assert functions.
Definition base_assert.h:140
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:48
#define csf_
Provides information about the current stack frame.
Definition stack_frame.h:213
@ s
The S key.
@ e
The E key.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition system_report.h:17