xtd 0.2.0
Loading...
Searching...
No Matches
assert.h
Go to the documentation of this file.
1
4#pragma once
5#include "base_assert.h"
6#include <functional>
7
9#if defined(assert)
10#undef assert
11#endif
13
15namespace xtd {
17 namespace tunit {
30 class tunit_export_ assert final : public base_assert {
31 public:
33 assert() = delete;
35
37
49 template<typename expected_t, typename actual_t>
50 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);}
62 template<typename expected_t, typename actual_t>
63 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()) {
64 if (actual == expected)
65 succeed(message, stack_frame);
66 else
67 fail(to_string(expected), to_string(actual), message, stack_frame);
68 }
69
71 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());
72#if defined(__xtd__cpp_lib_char8_t)
73 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());
74#endif
75 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());
76 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());
77 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());
78 static void are_equal(float expected, float actual, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
79 static void are_equal(double expected, double actual, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
80 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());
94 static void are_equal(float expected, float actual, float tolerance, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
108 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());
121 static void are_equal(double expected, double actual, double tolerance, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
135 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());
148 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());
162 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());
163
174 template<typename expected_t, typename actual_t>
175 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);}
187 template<typename expected_t, typename actual_t>
188 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()) {
189 if (actual != expected)
190 succeed(message, stack_frame);
191 else
192 fail("not " + to_string(expected), to_string(actual), message, stack_frame);
193 }
194
196 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());
197#if defined(__xtd__cpp_lib_char8_t)
198 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());
199#endif
200 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());
201 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());
202 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());
204
218 template<typename expected_t, typename actual_t>
219 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);}
234 template<typename expected_t, typename actual_t>
235 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()) {
236 if (&actual != &expected)
237 succeed(message, stack_frame);
238 else
239 fail("not same as " + to_string(expected), to_string(actual), message, stack_frame);
240 }
241
255 template<typename expected_t, typename actual_t>
256 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);}
271 template<typename expected_t, typename actual_t>
272 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()) {
273 if (&actual == &expected)
274 succeed(message, stack_frame);
275 else
276 fail("same as " + to_string(expected), to_string(actual), message, stack_frame);
277 }
278
290 template<typename item_t, typename collection_t>
291 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);}
304 template<typename item_t, typename collection_t>
305 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()) {
306 auto result = std::find(collection.begin(), collection.end(), item);
307 if (result != collection.end())
308 succeed(message, stack_frame);
309 else
310 fail("collection containing " + to_string(item), join_items(collection), message, stack_frame);
311 }
312
314 template<typename item_t, typename value_t>
315 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);}
316 template<typename item_t, typename value_t>
317 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()) {
318 auto result = std::find(values.begin(), values.end(), item);
319 if (result != values.end())
320 succeed(message, stack_frame);
321 else
322 fail("collection containing " + to_string(item), join_items(values), message, stack_frame);
323 }
324 static void contains(char item, const char* values, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
325#if defined(__xtd__cpp_lib_char8_t)
326 static void contains(char8 item, const char8* values, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
327#endif
328 static void contains(char16 item, const char16* values, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
329 static void contains(char32 item, const char32* values, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
330 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());
332
343 static void does_not_throw(const std::function<void()>& statement, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
355 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());
356
368 template<typename value_t>
369 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);}
382 template<typename value_t>
383 static void is_empty(const value_t& value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
384 if (std::empty(value))
385 succeed(message, stack_frame);
386 else
387 fail("collection <empty>", join_items(value), message, stack_frame);
388 }
389
391 template<typename value_t>
392 static void is_empty(const std::initializer_list<value_t>& values, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {is_empty(values, xtd::string::empty_string, stack_frame);}
393 template<typename value_t>
394 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()) {
395 if (std::empty(values))
396 succeed(message, stack_frame);
397 else
398 fail("collection <empty>", join_items(values), message, stack_frame);
399 }
400 static void is_empty(const char* value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
401#if defined(__xtd__cpp_lib_char8_t)
402 static void is_empty(const char8* value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
403#endif
404 static void is_empty(const char16* value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
405 static void is_empty(const char32* value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
406 static void is_empty(const wchar_t* value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
408
420 static void is_false(bool condition, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
433 static void is_false(bool condition, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
434
445 template<typename value1_t, typename value2_t>
446 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);}
458 template<typename value1_t, typename value2_t>
459 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()) {
460 if (val1 > val2)
461 succeed(message, stack_frame);
462 else
463 fail("greater than " + to_string(val2), to_string(val1), message, stack_frame);
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 if (val1 >= val2)
504 succeed(message, stack_frame);
505 else
506 fail("greater than or equal to " + to_string(val2), to_string(val1), message, stack_frame);
507 }
508
510 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());
511#if defined(__xtd__cpp_lib_char8_t)
512 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());
513#endif
514 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());
515 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());
516 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());
518
529 template<typename type_t, typename value_t>
530 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);}
542 template<typename type_t, typename value_t>
543 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()) {
544 const type_t* instance = dynamic_cast<const type_t*>(&value);
545 if (instance != nullptr)
546 succeed(message, stack_frame);
547 else
548 fail("instance of <" + typeof_<type_t>().full_name() + ">", "<" + typeof_(value).full_name() + ">", message, stack_frame);
549 }
550
561 template<typename value1_t, typename value2_t>
562 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);}
574 template<typename value1_t, typename value2_t>
575 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()) {
576 if (val1 < val2)
577 succeed(message, stack_frame);
578 else
579 fail("less than " + to_string(val2), to_string(val1), message, stack_frame);
580 }
581
583 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());
584#if defined(__xtd__cpp_lib_char8_t)
585 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());
586#endif
587 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());
588 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());
589 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());
591
603 template<typename value1_t, typename value2_t>
604 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);}
617 template<typename value1_t, typename value2_t>
618 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()) {
619 if (val1 <= val2)
620 succeed(message, stack_frame);
621 else
622 fail("less than or equal to " + to_string(val2), to_string(val1), message, stack_frame);
623 }
624
626 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());
627#if defined(__xtd__cpp_lib_char8_t)
628 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());
629#endif
630 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());
631 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());
632 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());
634
646 static void is_NaN(double value, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
659 static void is_NaN(double value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
671 static void is_NaN(long double value, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
684 static void is_NaN(long double value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
696 static void is_NaN(float value, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
709 static void is_NaN(float value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
710
722 template<typename value_t>
723 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);}
736 template<typename value_t>
737 static void is_negative(const value_t& value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
738 if (value < 0)
739 succeed(message, stack_frame);
740 else
741 fail("negative", to_string(value), message, stack_frame);
742 }
743
755 template<typename value_t>
756 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);}
769 template<typename value_t>
770 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()) {
771 if (!std::empty(value))
772 succeed(message, stack_frame);
773 else
774 fail("collection not <empty>", "<empty>", message, stack_frame);
775 }
776
778 template<typename value_t>
779 static void is_not_empty(const std::initializer_list<value_t>& values, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {is_not_empty(values, xtd::string::empty_string, stack_frame);}
780 template<typename value_t>
781 static void is_not_empty(const std::initializer_list<value_t>& values, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
782 if (!std::empty(values))
783 succeed(message, stack_frame);
784 else
785 fail("collection not <empty>", "<empty>", message, stack_frame);
786 }
787 static void is_not_empty(const char* value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
788#if defined(__xtd__cpp_lib_char8_t)
789 static void is_not_empty(const char8* value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
790#endif
791 static void is_not_empty(const char16* value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
792 static void is_not_empty(const char32* value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
793 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());
795
806 template<typename type_t, typename value_t>
807 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);}
819 template<typename type_t, typename value_t>
820 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()) {
821 const type_t* instance = dynamic_cast<const type_t*>(&value);
822 if (instance == nullptr)
823 succeed(message, stack_frame);
824 else
825 fail("not instance of <" + typeof_<type_t>().full_name() + ">", "<" + typeof_(value).full_name() + ">", message, stack_frame);
826 }
827
840 template<typename pointer_t>
841 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);}
855 template<typename pointer_t>
856 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()) {
857 if (pointer != nullptr)
858 succeed(message, stack_frame);
859 else
860 fail("not null", "null", message, stack_frame);
861 }
873 template<typename optional_t>
874 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);}
887 template<typename optional_t>
888 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()) {
889 if (opt != std::nullopt)
890 succeed(message, stack_frame);
891 else
892 fail("not null", "null", message, stack_frame);
893 }
905 template<typename pointer_t>
919 template<typename pointer_t>
921 if (pointer != nullptr)
922 succeed(message, stack_frame);
923 else
924 fail("not null", "null", message, stack_frame);
925 }
937 template<typename pointer_t>
951 template<typename pointer_t>
953 if (pointer != nullptr)
954 succeed(message, stack_frame);
955 else
956 fail("not null", "null", message, stack_frame);
957 }
969 template<typename pointer_t>
983 template<typename pointer_t>
985 if (pointer.owner_before(xtd::wptr<pointer_t> {}) || xtd::wptr<pointer_t> {}.owner_before(pointer))
986 succeed(message, stack_frame);
987 else
988 fail("not null", "null", message, stack_frame);
989 }
999 static void is_not_null(std::nullptr_t pointer, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
1010 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());
1011
1023 template<typename value_t>
1024 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);}
1037 template<typename value_t>
1038 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()) {
1039 if (value != static_cast<value_t>(0))
1040 succeed(message, stack_frame);
1041 else
1042 fail("not zero", "0", message, stack_frame);
1043 }
1044
1057 template<typename pointer_t>
1058 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);}
1072 template<typename pointer_t>
1073 static void is_null(const pointer_t* pointer, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
1074 if (pointer == nullptr)
1075 succeed(message, stack_frame);
1076 else
1077 fail("null", "not null", message, stack_frame);
1078 }
1090 template<typename optional_t>
1091 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);}
1104 template<typename optional_t>
1105 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()) {
1106 if (opt == std::nullopt)
1107 succeed(message, stack_frame);
1108 else
1109 fail("null", "not null", message, stack_frame);
1110 }
1122 template<typename pointer_t>
1136 template<typename pointer_t>
1137 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()) {
1138 if (pointer == nullptr)
1139 succeed(message, stack_frame);
1140 else
1141 fail("null", "not null", message, stack_frame);
1142 }
1154 template<typename pointer_t>
1168 template<typename pointer_t>
1169 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()) {
1170 if (pointer == nullptr)
1171 succeed(message, stack_frame);
1172 else
1173 fail("null", "not null", message, stack_frame);
1174 }
1187 template<typename pointer_t>
1202 template<typename pointer_t>
1203 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()) {
1204 if (!pointer.owner_before(xtd::wptr<pointer_t> {}) && !xtd::wptr<pointer_t> {}.owner_before(pointer))
1205 succeed(message, stack_frame);
1206 else
1207 fail("null", "not null", message, stack_frame);
1208 }
1218 static void is_null(std::nullptr_t pointer, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
1229 static void is_null(std::nullptr_t pointer, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
1230
1242 template<typename value_t>
1243 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);}
1256 template<typename value_t>
1257 static void is_positive(const value_t& value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
1258 if (value > 0)
1259 succeed(message, stack_frame);
1260 else
1261 fail("positive", to_string(value), message, stack_frame);
1262 }
1263
1275 static void is_true(bool condition, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
1288 static void is_true(bool condition, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
1289
1301 template<typename value_t>
1302 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);}
1315 template<typename value_t>
1316 static void is_zero(const value_t& value, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
1317 if (value == static_cast<value_t>(0))
1318 succeed(message, stack_frame);
1319 else
1320 fail("zero", to_string(value), message, stack_frame);
1321 }
1322
1334 template<typename exception_t>
1335 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);}
1348 template<typename exception_t>
1349 static void throws(const std::function<void()>& statement, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
1350 try {
1351 statement();
1352 fail("<" + typeof_<exception_t>().full_name() + ">", "<nothing>", message, stack_frame);
1353 } catch (const exception_t&) {
1354 succeed(message, stack_frame);
1355 } catch (const xtd::tunit::assert_error&) {
1356 throw;
1357 } catch (const std::exception& e) {
1358 fail("<" + typeof_<exception_t>().full_name() + ">", "<" + typeof_(e).full_name() + ">", message, stack_frame);
1359 } catch (...) {
1360 fail("<" + typeof_<exception_t>().full_name() + ">", "<exception>", message, stack_frame);
1361 }
1362 }
1363
1374 static void throws_any(const std::function<void()>& statement, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
1386 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());
1388
1389 private:
1390 };
1391 }
1392}
Contains xtd::tunit::assert class.
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.
Exception thow when an assertion failed.
Definition assert_error.h:17
The assert class contains a collection of static methods that implement the most common assertions us...
Definition assert.h:30
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())
Asserts that two type are equal.
Definition assert.h:63
static void is_empty(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that collection contains an item.
Definition assert.h:369
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())
Asserts that two type are equal.
static void is_zero(const value_t &value, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that ta condition is zero.
Definition assert.h:1316
static void is_not_instance_of(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that an object is not of the type supplied or a derived type.
Definition assert.h:807
static void is_not_null(std::nullptr_t pointer, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that the pointer is not null.
static void is_negative(const value_t &value, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that ta condition is negative.
Definition assert.h:737
static void is_null(const pointer_t *pointer, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that the pointer is null.
Definition assert.h:1073
static void is_NaN(float value, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that a value is NaN.
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())
Asserts that two objects do refer to differents objects.
Definition assert.h:235
static void is_zero(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that ta condition is zero.
Definition assert.h:1302
static void is_not_empty(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that collection does not contain any item.
Definition assert.h:756
static void are_equal(float expected, float actual, float tolerance, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that two type are equal.
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())
Asserts that the pointer is null.
Definition assert.h:1137
static void is_not_null(const xtd::uptr< pointer_t > &pointer, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that the pointer is not null.
Definition assert.h:906
static void is_greater(const value1_t &val1, const value2_t &val2, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that the first value is greater than the second value.
Definition assert.h:446
static void is_not_null(const pointer_t *pointer, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that the pointer is not null.
Definition assert.h:841
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())
Asserts that the pointer is null.
Definition assert.h:1203
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())
Asserts that two type are equal.
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())
Asserts that two objects do refer to differents objects.
Definition assert.h:272
static void is_NaN(long double value, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that a value is NaN.
static void is_not_null(const xtd::wptr< pointer_t > &pointer, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that the pointer is not null.
Definition assert.h:970
static void is_null(const std::optional< optional_t > &opt, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that the optional is std::nullopt.
Definition assert.h:1091
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())
Asserts that the first value is is_less than or equal to the second value.
Definition assert.h:604
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())
Asserts that the first value is is_less than or equal to the second value.
Definition assert.h:618
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())
Asserts that two type are equal.
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())
Asserts that the pointer is not null.
Definition assert.h:984
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_positive(const value_t &value, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that ta condition is positive.
Definition assert.h:1257
static void are_equal(double expected, double actual, double tolerance, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that two type are equal.
static void throws_any(const std::function< void()> &statement, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that the staement does not throw an exception.
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())
Asserts that the pointer is not null.
Definition assert.h:920
static void is_instance_of(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that an object is of the type supplied or a derived type.
Definition assert.h:530
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())
Asserts that an object is not of the type supplied or a derived type.
Definition assert.h:820
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())
Asserts that the first value is greater than or equal to the second value.
Definition assert.h:502
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())
Asserts that the staement does not throw an exception.
static void are_equal(const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that two type are equal.
Definition assert.h:50
static void is_negative(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that ta condition is negative.
Definition assert.h:723
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())
Asserts that collection does not contain any item.
Definition assert.h:770
static void is_empty(const value_t &value, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that collection contains an item.
Definition assert.h:383
static void is_true(bool condition, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that a condition is true.
static void is_null(const xtd::uptr< pointer_t > &pointer, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that the pointer is null.
Definition assert.h:1123
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())
Asserts that two type are equal.
static void is_null(const xtd::sptr< pointer_t > &pointer, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that the pointer is null.
Definition assert.h:1155
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_not_zero(const value_t &value, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that ta condition is not zero.
Definition assert.h:1038
static void is_positive(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that ta condition is positive.
Definition assert.h:1243
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())
Asserts that the pointer is not null.
Definition assert.h:856
static void is_null(std::nullptr_t pointer, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that the pointer is null.
static void does_not_throw(const std::function< void()> &statement, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that the staement does not throw an exception.
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())
Asserts that the staement does not throw an exception.
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())
Asserts that the pointer is not null.
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())
Asserts that the pointer is not null.
Definition assert.h:952
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())
Asserts that collection contains an item.
Definition assert.h:305
static void is_not_null(const xtd::sptr< pointer_t > &pointer, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that the pointer is not null.
Definition assert.h:938
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())
Asserts that the first value is is_less than the second value.
Definition assert.h:575
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())
Asserts that two objects do refer to differents objects.
Definition assert.h:219
static void are_same(const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that two objects do refer to differents objects.
Definition assert.h:256
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())
Asserts that the optional is std::nullopt.
Definition assert.h:1105
static void is_null(std::nullptr_t pointer, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that the pointer is null.
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())
Asserts that an object is of the type supplied or a derived type.
Definition assert.h:543
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_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())
Asserts that the first value is greater than the second value.
Definition assert.h:459
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())
Asserts that the optional is not std::nullopt.
Definition assert.h:888
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())
Asserts that two type are not equal.
Definition assert.h:188
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())
Asserts that two type are not equal.
Definition assert.h:175
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())
Asserts that the pointer is null.
Definition assert.h:1169
static void is_null(const pointer_t *pointer, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that the pointer is null.
Definition assert.h:1058
static void is_false(bool condition, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that a condition is false.
static void contains(const item_t &item, const collection_t &collection, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that collection contains an item.
Definition assert.h:291
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())
Asserts that the first value is greater than or equal to the second value.
Definition assert.h:488
static void is_true(bool condition, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that a condition is true.
static void is_NaN(double value, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that a value is NaN.
static void is_less(const value1_t &val1, const value2_t &val2, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that the first value is is_less than the second value.
Definition assert.h:562
static void is_false(bool condition, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that a condition is false.
static void is_not_null(const std::optional< optional_t > &opt, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that the optional is not std::nullopt.
Definition assert.h:874
static void is_null(const xtd::wptr< pointer_t > &pointer, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that the pointer is null.
Definition assert.h:1188
static void is_not_zero(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that ta condition is not zero.
Definition assert.h:1024
The base class for assert.
Definition base_assert.h:29
#define tunit_export_
Define shared library export.
Definition tunit_export.h:13
#define typeof_
Used to obtain the type object of a specified type or object.
Definition typeof.h:45
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
std::string to_string(const value_t &value, const std::string &fmt, const std::locale &loc)
Convert a specified value into a string with specified format and locale.
Definition to_string.h:41
@ e
The E key.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10