xtd - Reference Guide  0.1.1
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
collection_assume.h
Go to the documentation of this file.
1 #pragma once
5 #include "assume.h"
6 #include "collection_assert.h"
7 
9 namespace xtd {
11  namespace tunit {
21  class collection_assume final : private base_assert {
22  public:
24  collection_assume() = delete;
26 
38  template<typename expected_t, typename collection_t>
39  static void all_items_are_instances_of(const collection_t& collection) {all_items_are_instances_of<expected_t>(collection, "", xtd::diagnostics::stack_frame::empty());}
40 
52  template<typename expected_t, typename collection_t>
53  static void all_items_are_instances_of(const collection_t& collection, const std::string& message) {all_items_are_instances_of<expected_t>(collection, message, xtd::diagnostics::stack_frame::empty());}
54 
66  template<typename expected_t, typename collection_t>
67  static void all_items_are_instances_of(const collection_t& collection, const xtd::diagnostics::stack_frame& stack_frame) {all_items_are_instances_of<expected_t>(collection, "", stack_frame);}
68 
80  template<typename expected_t, typename collection_t>
81  static void all_items_are_instances_of(const collection_t& collection, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
82  try {
83  collection_assert::all_items_are_instances_of<expected_t>(collection, message, stack_frame);
84  } catch(...) {
85  assert::abort();
86  }
87  }
88 
90  template<typename expected_t, typename item_t>
91  static void all_items_are_instances_of(const std::initializer_list<item_t>& collection) {all_items_are_instances_of<expected_t>(collection, "", xtd::diagnostics::stack_frame::empty());}
92  template<typename expected_t, typename item_t>
93  static void all_items_are_instances_of(const std::initializer_list<item_t>& collection, const std::string& message) {all_items_are_instances_of<expected_t>(collection, message, xtd::diagnostics::stack_frame::empty());}
94  template<typename expected_t, typename item_t>
95  static void all_items_are_instances_of(const std::initializer_list<item_t>& collection, const xtd::diagnostics::stack_frame& stack_frame) {all_items_are_instances_of<expected_t>(collection, "", stack_frame);}
96  template<typename expected_t, typename item_t>
97  static void all_items_are_instances_of(const std::initializer_list<item_t>& collection, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
98  try {
99  collection_assert::all_items_are_instances_of<expected_t>(collection, message, stack_frame);
100  } catch(...) {
101  assert::abort();
102  }
103  }
105 
119  template<typename collection_t>
120  static void all_items_are_not_null(const collection_t& collection) {all_items_are_not_null(collection, "", xtd::diagnostics::stack_frame::empty());}
121 
135  template<typename collection_t>
136  static void all_items_are_not_null(const collection_t& collection, const std::string& message) {all_items_are_not_null(collection, message, xtd::diagnostics::stack_frame::empty());}
137 
151  template<typename collection_t>
152  static void all_items_are_not_null(const collection_t& collection, const xtd::diagnostics::stack_frame& stack_frame) {all_items_are_instances_of(collection, "", stack_frame);}
153 
167  template<typename collection_t>
168  static void all_items_are_not_null(const collection_t& collection, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
169  try {
170  collection_assert::all_items_are_not_null(collection, message, stack_frame);
171  } catch(...) {
172  assert::abort();
173  }
174  }
175 
177  template<typename item_t>
178  static void all_items_are_not_null(const std::initializer_list<item_t>& collection) {all_items_are_not_null(collection, "", xtd::diagnostics::stack_frame::empty());}
179  template<typename item_t>
180  static void all_items_are_not_null(const std::initializer_list<item_t>& collection, const std::string& message) {all_items_are_not_null(collection, message, xtd::diagnostics::stack_frame::empty());}
181  template<typename item_t>
182  static void all_items_are_not_null(const std::initializer_list<item_t>& collection, const xtd::diagnostics::stack_frame& stack_frame) {all_items_are_instances_of(collection, "", stack_frame);}
183  template<typename item_t>
184  static void all_items_are_not_null(const std::initializer_list<item_t>& collection, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
185  try {
186  collection_assert::all_items_are_not_null(collection, message, stack_frame);
187  } catch(...) {
188  assert::abort();
189  }
190  }
192 
205  template<typename collection_t>
206  static void all_items_are_unique(const collection_t& collection) {all_items_are_unique(collection, "", xtd::diagnostics::stack_frame::empty());}
207 
220  template<typename collection_t>
221  static void all_items_are_unique(const collection_t& collection, const std::string& message) {all_items_are_unique(collection, message, xtd::diagnostics::stack_frame::empty());}
222 
235  template<typename collection_t>
236  static void all_items_are_unique(const collection_t& collection, const xtd::diagnostics::stack_frame& stack_frame) {all_items_are_unique(collection, "", stack_frame);}
237 
250  template<typename collection_t>
251  static void all_items_are_unique(const collection_t& collection, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
252  try {
253  collection_assert::all_items_are_unique(collection, message, stack_frame);
254  } catch(...) {
255  assert::abort();
256  }
257  }
258 
260  template<typename item_t>
261  static void all_items_are_unique(const std::initializer_list<item_t>& collection) {all_items_are_unique(collection, "", xtd::diagnostics::stack_frame::empty());}
262  template<typename item_t>
263  static void all_items_are_unique(const std::initializer_list<item_t>& collection, const xtd::diagnostics::stack_frame& stack_frame) {all_items_are_unique(collection, "", stack_frame);}
264  template<typename item_t>
265  static void all_items_are_unique(const std::initializer_list<item_t>& collection, const std::string& message) {all_items_are_unique(collection, message, xtd::diagnostics::stack_frame::empty());}
266  template<typename item_t>
267  static void all_items_are_unique(const std::initializer_list<item_t>& collection, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
268  try {
269  collection_assert::all_items_are_unique(collection, message, stack_frame);
270  } catch(...) {
271  assert::abort();
272  }
273  }
275 
287  template<typename expected_t, typename actual_t>
288  static void are_equal(const expected_t& expected, const actual_t& actual) {are_equal(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
289 
301  template<typename expected_t, typename actual_t>
302  static void are_equal(const expected_t& expected, const actual_t& actual, const std::string& message) {are_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
303 
315  template<typename expected_t, typename actual_t>
316  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);}
317 
329  template<typename expected_t, typename actual_t>
330  static void are_equal(const expected_t& expected, const actual_t& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
331  try {
332  collection_assert::are_equal(expected, actual, message, stack_frame);
333  } catch(...) {
334  assert::abort();
335  }
336  }
337 
339  template<typename item_t>
340  static void are_equal(const std::initializer_list<item_t>& expected, const std::initializer_list<item_t>& actual) {are_equal(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
341  template<typename item_t>
342  static void are_equal(const std::initializer_list<item_t>& expected, const std::initializer_list<item_t>& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_equal(expected, actual, "", stack_frame);}
343  template<typename item_t>
344  static void are_equal(const std::initializer_list<item_t>& expected, const std::initializer_list<item_t>& actual, const std::string& message) {are_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
345  template<typename item_t>
346  static void are_equal(const std::initializer_list<item_t>& expected, const std::initializer_list<item_t>& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
347  try {
348  collection_assert::are_equal(expected, actual, message, stack_frame);
349  } catch(...) {
350  assert::abort();
351  }
352  }
353 
355  template<typename collection_t, typename item_t>
356  static void are_equal(const collection_t& expected, const std::initializer_list<item_t>& actual) {are_equal(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
357  template<typename collection_t, typename item_t>
358  static void are_equal(const collection_t& expected, const std::initializer_list<item_t>& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_equal(expected, actual, "", stack_frame);}
359  template<typename collection_t, typename item_t>
360  static void are_equal(const collection_t& expected, const std::initializer_list<item_t>& actual, const std::string& message) {are_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
361  template<typename collection_t, typename item_t>
362  static void are_equal(const collection_t& expected, const std::initializer_list<item_t>& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
363  try {
364  collection_assert::are_equal(expected, actual, message, stack_frame);
365  } catch(...) {
366  assert::abort();
367  }
368  }
369 
371  template<typename item_t, typename collection_t>
372  static void are_equal(const std::initializer_list<item_t>& expected, const collection_t& actual) {are_equal(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
373  template<typename item_t, typename collection_t>
374  static void are_equal(const std::initializer_list<item_t>& expected, const collection_t& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_equal(expected, actual, "", stack_frame);}
375  template<typename item_t, typename collection_t>
376  static void are_equal(const std::initializer_list<item_t>& expected, const collection_t& actual, const std::string& message) {are_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
377  template<typename item_t, typename collection_t>
378  static void are_equal(const std::initializer_list<item_t>& expected, const collection_t& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
379  try {
380  collection_assert::are_equal(expected, actual, message, stack_frame);
381  } catch(...) {
382  assert::abort();
383  }
384  }
386 
398  template<typename expected_t, typename actual_t>
399  static void are_equivalent(const expected_t& expected, const actual_t& actual) {are_equivalent(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
400 
412  template<typename expected_t, typename actual_t>
413  static void are_equivalent(const expected_t& expected, const actual_t& actual, const std::string& message) {are_equivalent(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
414 
426  template<typename expected_t, typename actual_t>
427  static void are_equivalent(const expected_t& expected, const actual_t& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_equivalent(expected, actual, "", stack_frame);}
428 
440  template<typename expected_t, typename actual_t>
441  static void are_equivalent(const expected_t& expected, const actual_t& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
442  try {
443  collection_assert::are_equivalent(expected, actual, message, stack_frame);
444  } catch(...) {
445  assert::abort();
446  }
447  }
448 
450  template<typename expected_t, typename actual_t>
451  static void are_equivalent(const std::initializer_list<expected_t>& expected, const std::initializer_list<actual_t>& actual) {are_equivalent(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
452  template<typename expected_t, typename actual_t>
453  static void are_equivalent(const std::initializer_list<expected_t>& expected, const std::initializer_list<actual_t>& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_equivalent(expected, actual, "", stack_frame);}
454  template<typename expected_t, typename actual_t>
455  static void are_equivalent(const std::initializer_list<expected_t>& expected, const std::initializer_list<actual_t>& actual, const std::string& message) {are_equal(are_equivalent, actual, message, xtd::diagnostics::stack_frame::empty());}
456  template<typename expected_t, typename actual_t>
457  static void are_equivalent(const std::initializer_list<expected_t>& expected, const std::initializer_list<actual_t>& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
458  try {
459  collection_assert::are_equivalent(expected, actual, message, stack_frame);
460  } catch(...) {
461  assert::abort();
462  }
463  }
464 
466  template<typename collection_t, typename item_t>
467  static void are_equivalent(const collection_t& expected, const std::initializer_list<item_t>& actual) {are_equivalent(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
468  template<typename collection_t, typename item_t>
469  static void are_equivalent(const collection_t& expected, const std::initializer_list<item_t>& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_equivalent(expected, actual, "", stack_frame);}
470  template<typename collection_t, typename item_t>
471  static void are_equivalent(const collection_t& expected, const std::initializer_list<item_t>& actual, const std::string& message) {are_equivalent(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
472  template<typename collection_t, typename item_t>
473  static void are_equivalent(const collection_t& expected, const std::initializer_list<item_t>& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
474  try {
475  collection_assert::are_equivalent(expected, actual, message, stack_frame);
476  } catch(...) {
477  assert::abort();
478  }
479  }
480 
482  template<typename item_t, typename collection_t>
483  static void are_equivalent(const std::initializer_list<item_t>& expected, const collection_t& actual) {are_equivalent(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
484  template<typename item_t, typename collection_t>
485  static void are_equivalent(const std::initializer_list<item_t>& expected, const collection_t& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_equivalent(expected, actual, "", stack_frame);}
486  template<typename item_t, typename collection_t>
487  static void are_equivalent(const std::initializer_list<item_t>& expected, const collection_t& actual, const std::string& message) {are_equivalent(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
488  template<typename item_t, typename collection_t>
489  static void are_equivalent(const std::initializer_list<item_t>& expected, const collection_t& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
490  try {
491  collection_assert::are_equivalent(expected, actual, message, stack_frame);
492  } catch(...) {
493  assert::abort();
494  }
495  }
497 
509  template<typename expected_t, typename actual_t>
510  static void are_not_equal(const expected_t& expected, const actual_t& actual) {are_not_equal(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
511 
523  template<typename expected_t, typename actual_t>
524  static void are_not_equal(const expected_t& expected, const actual_t& actual, const std::string& message) {are_not_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
525 
537  template<typename expected_t, typename actual_t>
538  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);}
539 
551  template<typename expected_t, typename actual_t>
552  static void are_not_equal(const expected_t& expected, const actual_t& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
553  try {
554  collection_assert::are_not_equal(expected, actual, message, stack_frame);
555  } catch(...) {
556  assert::abort();
557  }
558  }
559 
561  template<typename item_t>
562  static void are_not_equal(const std::initializer_list<item_t>& expected, const std::initializer_list<item_t>& actual) {are_not_equal(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
563  template<typename item_t>
564  static void are_not_equal(const std::initializer_list<item_t>& expected, const std::initializer_list<item_t>& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_not_equal(expected, actual, "", stack_frame);}
565  template<typename item_t>
566  static void are_not_equal(const std::initializer_list<item_t>& expected, const std::initializer_list<item_t>& actual, const std::string& message) {are_not_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
567  template<typename item_t>
568  static void are_not_equal(const std::initializer_list<item_t>& expected, const std::initializer_list<item_t>& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
569  try {
570  collection_assert::are_not_equal(expected, actual, message, stack_frame);
571  } catch(...) {
572  assert::abort();
573  }
574  }
575 
577  template<typename collection_t, typename item_t>
578  static void are_not_equal(const collection_t& expected, const std::initializer_list<item_t>& actual) {are_not_equal(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
579  template<typename collection_t, typename item_t>
580  static void are_not_equal(const collection_t& expected, const std::initializer_list<item_t>& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_not_equal(expected, actual, "", stack_frame);}
581  template<typename collection_t, typename item_t>
582  static void are_not_equal(const collection_t& expected, const std::initializer_list<item_t>& actual, const std::string& message) {are_not_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
583  template<typename collection_t, typename item_t>
584  static void are_not_equal(const collection_t& expected, const std::initializer_list<item_t>& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
585  try {
586  collection_assert::are_not_equal(expected, actual, message, stack_frame);
587  } catch(...) {
588  assert::abort();
589  }
590  }
591 
593  template<typename item_t, typename collection_t>
594  static void are_not_equal(const std::initializer_list<item_t>& expected, const collection_t& actual) {are_not_equal(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
595  template<typename item_t, typename collection_t>
596  static void are_not_equal(const std::initializer_list<item_t>& expected, const collection_t& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_not_equal(expected, actual, "", stack_frame);}
597  template<typename item_t, typename collection_t>
598  static void are_not_equal(const std::initializer_list<item_t>& expected, const collection_t& actual, const std::string& message) {are_not_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
599  template<typename item_t, typename collection_t>
600  static void are_not_equal(const std::initializer_list<item_t>& expected, const collection_t& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
601  try {
602  collection_assert::are_not_equal(expected, actual, message, stack_frame);
603  } catch(...) {
604  assert::abort();
605  }
606  }
608 
620  template<typename expected_t, typename actual_t>
621  static void are_not_equivalent(const expected_t& expected, const actual_t& actual) {are_not_equivalent(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
622 
634  template<typename expected_t, typename actual_t>
635  static void are_not_equivalent(const expected_t& expected, const actual_t& actual, const std::string& message) {are_not_equivalent(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
636 
648  template<typename expected_t, typename actual_t>
649  static void are_not_equivalent(const expected_t& expected, const actual_t& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_not_equivalent(expected, actual, "", stack_frame);}
650 
662  template<typename expected_t, typename actual_t>
663  static void are_not_equivalent(const expected_t& expected, const actual_t& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
664  try {
665  collection_assert::are_not_equivalent(expected, actual, message, stack_frame);
666  } catch(...) {
667  assert::abort();
668  }
669  }
670 
672  template<typename expected_t, typename actual_t>
673  static void are_not_equivalent(const std::initializer_list<expected_t>& expected, const std::initializer_list<actual_t>& actual) {are_not_equivalent(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
674  template<typename expected_t, typename actual_t>
675  static void are_not_equivalent(const std::initializer_list<expected_t>& expected, const std::initializer_list<actual_t>& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_not_equivalent(expected, actual, "", stack_frame);}
676  template<typename expected_t, typename actual_t>
677  static void are_not_equivalent(const std::initializer_list<expected_t>& expected, const std::initializer_list<actual_t>& actual, const std::string& message) {are_not_equivalent(are_equivalent, actual, message, xtd::diagnostics::stack_frame::empty());}
678  template<typename expected_t, typename actual_t>
679  static void are_not_equivalent(const std::initializer_list<expected_t>& expected, const std::initializer_list<actual_t>& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
680  try {
681  collection_assert::are_not_equivalent(expected, actual, message, stack_frame);
682  } catch(...) {
683  assert::abort();
684  }
685  }
686 
688  template<typename collection_t, typename item_t>
689  static void are_not_equivalent(const collection_t& expected, const std::initializer_list<item_t>& actual) {are_not_equivalent(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
690  template<typename collection_t, typename item_t>
691  static void are_not_equivalent(const collection_t& expected, const std::initializer_list<item_t>& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_not_equivalent(expected, actual, "", stack_frame);}
692  template<typename collection_t, typename item_t>
693  static void are_not_equivalent(const collection_t& expected, const std::initializer_list<item_t>& actual, const std::string& message) {are_not_equivalent(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
694  template<typename collection_t, typename item_t>
695  static void are_not_equivalent(const collection_t& expected, const std::initializer_list<item_t>& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
696  try {
697  collection_assert::are_not_equivalent(expected, actual, message, stack_frame);
698  } catch(...) {
699  assert::abort();
700  }
701  }
702 
704  template<typename item_t, typename collection_t>
705  static void are_not_equivalent(const std::initializer_list<item_t>& expected, const collection_t& actual) {are_not_equivalent(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
706  template<typename item_t, typename collection_t>
707  static void are_not_equivalent(const std::initializer_list<item_t>& expected, const collection_t& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_not_equivalent(expected, actual, "", stack_frame);}
708  template<typename item_t, typename collection_t>
709  static void are_not_equivalent(const std::initializer_list<item_t>& expected, const collection_t& actual, const std::string& message) {are_not_equivalent(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
710  template<typename item_t, typename collection_t>
711  static void are_not_equivalent(const std::initializer_list<item_t>& expected, const collection_t& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
712  try {
713  collection_assert::are_not_equivalent(expected, actual, message, stack_frame);
714  } catch(...) {
715  assert::abort();
716  }
717  }
719 
731  template<typename expected_t, typename actual_t>
732  static void contains(const expected_t& expected, const actual_t& actual) {contains(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
733 
745  template<typename expected_t, typename actual_t>
746  static void contains(const expected_t& expected, const actual_t& actual, const std::string& message) {contains(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
747 
759  template<typename expected_t, typename actual_t>
760  static void contains(const expected_t& expected, const actual_t& actual, const xtd::diagnostics::stack_frame& stack_frame) {contains(expected, actual, "", stack_frame);}
761 
773  template<typename expected_t, typename actual_t>
774  static void contains(const expected_t& expected, const actual_t& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
775  try {
776  collection_assert::contains(expected, actual, message, stack_frame);
777  } catch(...) {
778  assert::abort();
779  }
780  }
781 
783  template<typename item_t>
784  static void contains(const std::initializer_list<item_t>& expected, const std::initializer_list<item_t>& actual) {contains(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
785  template<typename item_t>
786  static void contains(const std::initializer_list<item_t>& expected, const std::initializer_list<item_t>& actual, const xtd::diagnostics::stack_frame& stack_frame) {contains(expected, actual, "", stack_frame);}
787  template<typename item_t>
788  static void contains(const std::initializer_list<item_t>& expected, const std::initializer_list<item_t>& actual, const std::string& message) {contains(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
789  template<typename item_t>
790  static void contains(const std::initializer_list<item_t>& expected, const std::initializer_list<item_t>& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
791  try {
792  collection_assert::contains(expected, actual, message, stack_frame);
793  } catch(...) {
794  assert::abort();
795  }
796  }
797 
799  template<typename collection_t, typename item_t>
800  static void contains(const collection_t& expected, const std::initializer_list<item_t>& actual) {contains(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
801  template<typename collection_t, typename item_t>
802  static void contains(const collection_t& expected, const std::initializer_list<item_t>& actual, const xtd::diagnostics::stack_frame& stack_frame) {contains(expected, actual, "", stack_frame);}
803  template<typename collection_t, typename item_t>
804  static void contains(const collection_t& expected, const std::initializer_list<item_t>& actual, const std::string& message) {contains(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
805  template<typename collection_t, typename item_t>
806  static void contains(const collection_t& expected, const std::initializer_list<item_t>& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
807  try {
808  collection_assert::contains(expected, actual, message, stack_frame);
809  } catch(...) {
810  assert::abort();
811  }
812  }
813 
815  template<typename item_t, typename collection_t>
816  static void contains(const std::initializer_list<item_t>& expected, const collection_t& actual) {contains(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
817  template<typename item_t, typename collection_t>
818  static void contains(const std::initializer_list<item_t>& expected, const collection_t& actual, const xtd::diagnostics::stack_frame& stack_frame) {contains(expected, actual, "", stack_frame);}
819  template<typename item_t, typename collection_t>
820  static void contains(const std::initializer_list<item_t>& expected, const collection_t& actual, const std::string& message) {contains(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
821  template<typename item_t, typename collection_t>
822  static void contains(const std::initializer_list<item_t>& expected, const collection_t& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
823  try {
824  collection_assert::contains(expected, actual, message, stack_frame);
825  } catch(...) {
826  assert::abort();
827  }
828  }
830 
842  template<typename expected_t, typename actual_t>
843  static void does_not_contain(const expected_t& expected, const actual_t& actual) {does_not_contain(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
844 
856  template<typename expected_t, typename actual_t>
857  static void does_not_contain(const expected_t& expected, const actual_t& actual, const std::string& message) {does_not_contain(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
858 
870  template<typename expected_t, typename actual_t>
871  static void does_not_contain(const expected_t& expected, const actual_t& actual, const xtd::diagnostics::stack_frame& stack_frame) {does_not_contain(expected, actual, "", stack_frame);}
872 
884  template<typename expected_t, typename actual_t>
885  static void does_not_contain(const expected_t& expected, const actual_t& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
886  try {
887  collection_assert::does_not_contain(expected, actual, message, stack_frame);
888  } catch(...) {
889  assert::abort();
890  }
891  }
892 
894  template<typename item_t>
895  static void does_not_contain(const std::initializer_list<item_t>& expected, const std::initializer_list<item_t>& actual) {does_not_contain(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
896  template<typename item_t>
897  static void does_not_contain(const std::initializer_list<item_t>& expected, const std::initializer_list<item_t>& actual, const xtd::diagnostics::stack_frame& stack_frame) {does_not_contain(expected, actual, "", stack_frame);}
898  template<typename item_t>
899  static void does_not_contain(const std::initializer_list<item_t>& expected, const std::initializer_list<item_t>& actual, const std::string& message) {does_not_contain(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
900  template<typename item_t>
901  static void does_not_contain(const std::initializer_list<item_t>& expected, const std::initializer_list<item_t>& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
902  try {
903  collection_assert::does_not_contain(expected, actual, message, stack_frame);
904  } catch(...) {
905  assert::abort();
906  }
907  }
908 
910  template<typename collection_t, typename item_t>
911  static void does_not_contain(const collection_t& expected, const std::initializer_list<item_t>& actual) {does_not_contain(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
912  template<typename collection_t, typename item_t>
913  static void does_not_contain(const collection_t& expected, const std::initializer_list<item_t>& actual, const xtd::diagnostics::stack_frame& stack_frame) {does_not_contain(expected, actual, "", stack_frame);}
914  template<typename collection_t, typename item_t>
915  static void does_not_contain(const collection_t& expected, const std::initializer_list<item_t>& actual, const std::string& message) {does_not_contain(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
916  template<typename collection_t, typename item_t>
917  static void does_not_contain(const collection_t& expected, const std::initializer_list<item_t>& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
918  try {
919  collection_assert::does_not_contain(expected, actual, message, stack_frame);
920  } catch(...) {
921  assert::abort();
922  }
923  }
924 
926  template<typename item_t, typename collection_t>
927  static void does_not_contain(const std::initializer_list<item_t>& expected, const collection_t& actual) {does_not_contain(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
928  template<typename item_t, typename collection_t>
929  static void does_not_contain(const std::initializer_list<item_t>& expected, const collection_t& actual, const xtd::diagnostics::stack_frame& stack_frame) {does_not_contain(expected, actual, "", stack_frame);}
930  template<typename item_t, typename collection_t>
931  static void does_not_contain(const std::initializer_list<item_t>& expected, const collection_t& actual, const std::string& message) {does_not_contain(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
932  template<typename item_t, typename collection_t>
933  static void does_not_contain(const std::initializer_list<item_t>& expected, const collection_t& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
934  try {
935  collection_assert::does_not_contain(expected, actual, message, stack_frame);
936  } catch(...) {
937  assert::abort();
938  }
939  }
941 
952  template<typename value_t>
953  static void is_empty(const value_t& value) {is_empty(value, "", xtd::diagnostics::stack_frame::empty());}
954 
966  template<typename value_t>
967  static void is_empty(const value_t& value, const xtd::diagnostics::stack_frame& stack_frame) {is_empty(value, "", stack_frame);}
968 
980  template<typename value_t>
981  static void is_empty(const value_t& value, const std::string& message) {is_empty(value, message, xtd::diagnostics::stack_frame::empty());}
982 
995  template<typename value_t>
996  static void is_empty(const value_t& value, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
997  try {
998  collection_assert::is_empty(value, message, stack_frame);
999  } catch(...) {
1000  assert::abort();
1001  }
1002  }
1003 
1005  template<typename value_t>
1006  static void is_empty(const std::initializer_list<value_t>& value) {is_empty(value, "", xtd::diagnostics::stack_frame::empty());}
1007  template<typename value_t>
1008  static void is_empty(const std::initializer_list<value_t>& value, const xtd::diagnostics::stack_frame& stack_frame) {is_empty(value, "", stack_frame);}
1009  template<typename value_t>
1010  static void is_empty(const std::initializer_list<value_t>& value, const std::string& message) {is_empty(value, message, xtd::diagnostics::stack_frame::empty());}
1011  template<typename value_t>
1012  static void is_empty(const std::initializer_list<value_t>& value, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
1013  try {
1014  collection_assert::is_empty(value, message, stack_frame);
1015  } catch(...) {
1016  assert::abort();
1017  }
1018  }
1020 
1031  template<typename value_t>
1032  static void is_not_empty(const value_t& value) {is_not_empty(value, "", xtd::diagnostics::stack_frame::empty());}
1033 
1045  template<typename value_t>
1046  static void is_not_empty(const value_t& value, const xtd::diagnostics::stack_frame& stack_frame) {is_not_empty(value, "", stack_frame);}
1047 
1059  template<typename value_t>
1060  static void is_not_empty(const value_t& value, const std::string& message) {is_not_empty(value, message, xtd::diagnostics::stack_frame::empty());}
1061 
1074  template<typename value_t>
1075  static void is_not_empty(const value_t& value, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
1076  try {
1077  collection_assert::is_not_empty(value, message, stack_frame);
1078  } catch(...) {
1079  assert::abort();
1080  }
1081  }
1082 
1084  template<typename value_t>
1085  static void is_not_empty(const std::initializer_list<value_t>& value) {is_not_empty(value, "", xtd::diagnostics::stack_frame::empty());}
1086  template<typename value_t>
1087  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);}
1088  template<typename value_t>
1089  static void is_not_empty(const std::initializer_list<value_t>& value, const std::string& message) {is_not_empty(value, message, xtd::diagnostics::stack_frame::empty());}
1090  template<typename value_t>
1091  static void is_not_empty(const std::initializer_list<value_t>& value, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
1092  try {
1093  collection_assert::is_not_empty(value, message, stack_frame);
1094  } catch(...) {
1095  assert::abort();
1096  }
1097  }
1099 
1110  template<typename value_t>
1111  static void is_ordered(const value_t& value) {is_ordered(value, "", xtd::diagnostics::stack_frame::empty());}
1112 
1124  template<typename value_t>
1125  static void is_ordered(const value_t& value, const xtd::diagnostics::stack_frame& stack_frame) {is_ordered(value, "", stack_frame);}
1126 
1138  template<typename value_t>
1139  static void is_ordered(const value_t& value, const std::string& message) {is_ordered(value, message, xtd::diagnostics::stack_frame::empty());}
1140 
1153  template<typename value_t>
1154  static void is_ordered(const value_t& value, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
1155  try {
1156  collection_assert::is_ordered(value, message, stack_frame);
1157  } catch(...) {
1158  assert::abort();
1159  }
1160  }
1161 
1163  template<typename value_t>
1164  static void is_ordered(const std::initializer_list<value_t>& value) {is_ordered(value, "", xtd::diagnostics::stack_frame::empty());}
1165  template<typename value_t>
1166  static void is_ordered(const std::initializer_list<value_t>& value, const xtd::diagnostics::stack_frame& stack_frame) {is_ordered(value, "", stack_frame);}
1167  template<typename value_t>
1168  static void is_ordered(const std::initializer_list<value_t>& value, const std::string& message) {is_ordered(value, message, xtd::diagnostics::stack_frame::empty());}
1169  template<typename value_t>
1170  static void is_ordered(const std::initializer_list<value_t>& value, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
1171  try {
1172  collection_assert::is_ordered(value, message, stack_frame);
1173  } catch(...) {
1174  assert::abort();
1175  }
1176  }
1178  };
1179  }
1180 }
Contains xtd::tunit::assume 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.
The base class for assert.
Definition: base_assert.h:25
static void abort()
Abort current test. This is used by the other Assert functions.
Definition: base_assert.h:36
static void does_not_contain(const expected_t &expected, const actual_t &actual)
Asserts that collection contains all items.
Definition: collection_assert.h:875
static void are_equal(const expected_t &expected, const actual_t &actual)
Asserts that all collection items are equal.
Definition: collection_assert.h:296
static void are_equivalent(const expected_t &expected, const actual_t &actual)
Asserts that all collection items are equivalent.
Definition: collection_assert.h:403
static void is_ordered(const value_t &value)
Asserts that collection is ordered.
Definition: collection_assert.h:1147
static void are_not_equivalent(const expected_t &expected, const actual_t &actual)
Asserts that all collection items are not equivalent.
Definition: collection_assert.h:633
static void all_items_are_unique(const collection_t &collection)
Asserts that all collection items are unique.
Definition: collection_assert.h:209
static void are_not_equal(const expected_t &expected, const actual_t &actual)
Asserts that all collection items are not equal.
Definition: collection_assert.h:526
static void is_empty(const value_t &value)
Asserts that collection contains an item.
Definition: collection_assert.h:993
static void contains(const expected_t &expected, const actual_t &actual)
Asserts that collection contains all items.
Definition: collection_assert.h:756
static void is_not_empty(const value_t &value)
Asserts that collection does not contain any item.
Definition: collection_assert.h:1070
static void all_items_are_not_null(const collection_t &collection)
Asserts that all collection items are not null.
Definition: collection_assert.h:121
The collection_assume class contains a collection of static methods that implement the most collectio...
Definition: collection_assume.h:21
static void are_not_equal(const expected_t &expected, const actual_t &actual, const std::string &message)
Assumes that all collection items are not equal.
Definition: collection_assume.h:524
static void all_items_are_not_null(const collection_t &collection, const std::string &message)
Assumes that all collection items are not null.
Definition: collection_assume.h:136
static void are_not_equal(const expected_t &expected, const actual_t &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that all collection items arenot equal.
Definition: collection_assume.h:552
static void are_equivalent(const expected_t &expected, const actual_t &actual, const std::string &message)
Assumes that all collection items are equivalent.
Definition: collection_assume.h:413
static void is_ordered(const value_t &value)
Assumes that collection is ordered.
Definition: collection_assume.h:1111
static void all_items_are_unique(const collection_t &collection)
Assumes that all collection items are unique.
Definition: collection_assume.h:206
static void is_not_empty(const value_t &value)
Assumes that collection does not contain any item.
Definition: collection_assume.h:1032
static void is_empty(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that collection contains an item.
Definition: collection_assume.h:967
static void are_not_equivalent(const expected_t &expected, const actual_t &actual, const std::string &message)
Assumes that all collection items are not equivalent.
Definition: collection_assume.h:635
static void are_equivalent(const expected_t &expected, const actual_t &actual)
Assumes that all collection items are equivalent.
Definition: collection_assume.h:399
static void are_equivalent(const expected_t &expected, const actual_t &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that all collection items are equivalent.
Definition: collection_assume.h:441
static void all_items_are_instances_of(const collection_t &collection, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that all collection items are of the type supplied or a derived type.
Definition: collection_assume.h:81
static void is_ordered(const value_t &value, const std::string &message)
Assumes that collection is ordered.
Definition: collection_assume.h:1139
static void is_not_empty(const value_t &value, const std::string &message)
Assumes that collection or traits does not contain any item.
Definition: collection_assume.h:1060
static void are_not_equal(const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that all collection items are not equal.
Definition: collection_assume.h:538
static void all_items_are_instances_of(const collection_t &collection, const std::string &message)
Assumes that all collection items are of the type supplied or a derived type.
Definition: collection_assume.h:53
static void are_not_equivalent(const expected_t &expected, const actual_t &actual)
Assumes that all collection items are not equivalent.
Definition: collection_assume.h:621
static void does_not_contain(const expected_t &expected, const actual_t &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that collection contains all items.
Definition: collection_assume.h:885
static void contains(const expected_t &expected, const actual_t &actual)
Assumes that ollection contains all items.
Definition: collection_assume.h:732
static void does_not_contain(const expected_t &expected, const actual_t &actual, const std::string &message)
Assumes that collection contains all items.
Definition: collection_assume.h:857
static void is_not_empty(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that collection or traits does not contain any item.
Definition: collection_assume.h:1046
static void contains(const expected_t &expected, const actual_t &actual, const std::string &message)
Assumes that collection contains all items.
Definition: collection_assume.h:746
static void all_items_are_not_null(const collection_t &collection, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that all collection items are not null.
Definition: collection_assume.h:168
static void are_equal(const expected_t &expected, const actual_t &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that all collection items are equal.
Definition: collection_assume.h:330
static void does_not_contain(const expected_t &expected, const actual_t &actual)
Assumes that collection contains all items.
Definition: collection_assume.h:843
static void are_equivalent(const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that all collection items are equivalent.
Definition: collection_assume.h:427
static void all_items_are_unique(const collection_t &collection, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that all collection items are unique.
Definition: collection_assume.h:251
static void are_not_equivalent(const expected_t &expected, const actual_t &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that all collection items are not equivalent.
Definition: collection_assume.h:663
static void all_items_are_instances_of(const collection_t &collection)
Assumes that all collection items are of the type supplied or a derived type.
Definition: collection_assume.h:39
static void all_items_are_unique(const collection_t &collection, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that all collection items are unique.
Definition: collection_assume.h:236
static void are_equal(const expected_t &expected, const actual_t &actual)
Assumes that all collection items are equal.
Definition: collection_assume.h:288
static void is_not_empty(const value_t &value, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that collection or traits does not contain any item.
Definition: collection_assume.h:1075
static void all_items_are_not_null(const collection_t &collection, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that all collection items are not null.
Definition: collection_assume.h:152
static void are_equal(const expected_t &expected, const actual_t &actual, const std::string &message)
Assumes that all collection items are equal.
Definition: collection_assume.h:302
static void are_equal(const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that all collection items are equal.
Definition: collection_assume.h:316
static void all_items_are_not_null(const collection_t &collection)
Assumes that all collection items are not null.
Definition: collection_assume.h:120
static void is_ordered(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that collection is ordered.
Definition: collection_assume.h:1125
static void are_not_equivalent(const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that all collection items are not equivalent.
Definition: collection_assume.h:649
static void contains(const expected_t &expected, const actual_t &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that collection contains all items.
Definition: collection_assume.h:774
static void all_items_are_unique(const collection_t &collection, const std::string &message)
Assumes that all collection items are unique.
Definition: collection_assume.h:221
static void are_not_equal(const expected_t &expected, const actual_t &actual)
Assumes that all collection items are not equal.
Definition: collection_assume.h:510
static void all_items_are_instances_of(const collection_t &collection, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that all collection items are of the type supplied or a derived type.
Definition: collection_assume.h:67
static void is_empty(const value_t &value, const std::string &message)
Assumes that collection contains an item.
Definition: collection_assume.h:981
static void contains(const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that collection contains all items.
Definition: collection_assume.h:760
static void is_empty(const value_t &value, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that collection contains an item.
Definition: collection_assume.h:996
static void is_empty(const value_t &value)
Assumes that collection contains an item.
Definition: collection_assume.h:953
static void is_ordered(const value_t &value, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that collection is ordered.
Definition: collection_assume.h:1154
static void does_not_contain(const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that collection contains all items.
Definition: collection_assume.h:871
Contains xtd::tunit::collection_assert class.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17