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_valid.h
Go to the documentation of this file.
1 #pragma once
5 #include "valid.h"
6 #include "collection_valid.h"
7 
9 namespace xtd {
11  namespace tunit {
21  class collection_valid final : private base_assert {
22  public:
24  collection_valid() = delete;
26 
37  template<typename expected_t, typename collection_t>
38  static void all_items_are_instances_of(const collection_t& collection) {all_items_are_instances_of<expected_t>(collection, "", xtd::diagnostics::stack_frame::empty());}
39 
50  template<typename expected_t, typename collection_t>
51  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());}
52 
63  template<typename expected_t, typename collection_t>
64  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);}
65 
76  template<typename expected_t, typename collection_t>
77  static void all_items_are_instances_of(const collection_t& collection, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
78  try {
79  collection_assert::all_items_are_instances_of<expected_t>(collection, message, stack_frame);
80  } catch(...) {
81  base_assert::error();
82  }
83  }
84 
86  template<typename expected_t, typename item_t>
87  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());}
88  template<typename expected_t, typename item_t>
89  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());}
90  template<typename expected_t, typename item_t>
91  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);}
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, const xtd::diagnostics::stack_frame& stack_frame) {
94  try {
95  collection_assert::all_items_are_instances_of<expected_t>(collection, message, stack_frame);
96  } catch(...) {
97  base_assert::error();
98  }
99  }
101 
114  template<typename collection_t>
115  static void all_items_are_not_null(const collection_t& collection) {all_items_are_not_null(collection, "", xtd::diagnostics::stack_frame::empty());}
116 
129  template<typename collection_t>
130  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());}
131 
144  template<typename collection_t>
145  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);}
146 
159  template<typename collection_t>
160  static void all_items_are_not_null(const collection_t& collection, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
161  try {
162  collection_assert::all_items_are_not_null(collection, message, stack_frame);
163  } catch(...) {
164  base_assert::error();
165  }
166  }
167 
169  template<typename item_t>
170  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());}
171  template<typename item_t>
172  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());}
173  template<typename item_t>
174  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);}
175  template<typename item_t>
176  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) {
177  try {
178  collection_assert::all_items_are_not_null(collection, message, stack_frame);
179  } catch(...) {
180  base_assert::error();
181  }
182  }
184 
196  template<typename collection_t>
197  static void all_items_are_unique(const collection_t& collection) {all_items_are_unique(collection, "", xtd::diagnostics::stack_frame::empty());}
198 
210  template<typename collection_t>
211  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());}
212 
224  template<typename collection_t>
225  static void all_items_are_unique(const collection_t& collection, const xtd::diagnostics::stack_frame& stack_frame) {all_items_are_unique(collection, "", stack_frame);}
226 
238  template<typename collection_t>
239  static void all_items_are_unique(const collection_t& collection, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
240  try {
241  collection_assert::all_items_are_unique(collection, message, stack_frame);
242  } catch(...) {
243  base_assert::error();
244  }
245  }
246 
248  template<typename item_t>
249  static void all_items_are_unique(const std::initializer_list<item_t>& collection) {all_items_are_unique(collection, "", xtd::diagnostics::stack_frame::empty());}
250  template<typename item_t>
251  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);}
252  template<typename item_t>
253  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());}
254  template<typename item_t>
255  static void all_items_are_unique(const std::initializer_list<item_t>& collection, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
256  try {
257  collection_assert::all_items_are_unique(collection, message, stack_frame);
258  } catch(...) {
259  base_assert::error();
260  }
261  }
263 
274  template<typename expected_t, typename actual_t>
275  static void are_equal(const expected_t& expected, const actual_t& actual) {are_equal(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
276 
287  template<typename expected_t, typename actual_t>
288  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());}
289 
300  template<typename expected_t, typename actual_t>
301  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);}
302 
313  template<typename expected_t, typename actual_t>
314  static void are_equal(const expected_t& expected, const actual_t& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
315  try {
316  collection_assert::are_equal(expected, actual, message, stack_frame);
317  } catch(...) {
318  base_assert::error();
319  }
320  }
321 
323  template<typename item_t>
324  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());}
325  template<typename item_t>
326  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);}
327  template<typename item_t>
328  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());}
329  template<typename item_t>
330  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) {
331  try {
332  collection_assert::are_equal(expected, actual, message, stack_frame);
333  } catch(...) {
334  base_assert::error();
335  }
336  }
337 
339  template<typename collection_t, typename item_t>
340  static void are_equal(const collection_t& expected, const std::initializer_list<item_t>& actual) {are_equal(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
341  template<typename collection_t, typename item_t>
342  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);}
343  template<typename collection_t, typename item_t>
344  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());}
345  template<typename collection_t, typename item_t>
346  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) {
347  try {
348  collection_assert::are_equal(expected, actual, message, stack_frame);
349  } catch(...) {
350  base_assert::error();
351  }
352  }
353 
355  template<typename item_t, typename collection_t>
356  static void are_equal(const std::initializer_list<item_t>& expected, const collection_t& actual) {are_equal(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
357  template<typename item_t, typename collection_t>
358  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);}
359  template<typename item_t, typename collection_t>
360  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());}
361  template<typename item_t, typename collection_t>
362  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) {
363  try {
364  collection_assert::are_equal(expected, actual, message, stack_frame);
365  } catch(...) {
366  base_assert::error();
367  }
368  }
370 
381  template<typename expected_t, typename actual_t>
382  static void are_equivalent(const expected_t& expected, const actual_t& actual) {are_equivalent(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
383 
394  template<typename expected_t, typename actual_t>
395  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());}
396 
407  template<typename expected_t, typename actual_t>
408  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);}
409 
420  template<typename expected_t, typename actual_t>
421  static void are_equivalent(const expected_t& expected, const actual_t& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
422  try {
423  collection_assert::are_equivalent(expected, actual, message, stack_frame);
424  } catch(...) {
425  base_assert::error();
426  }
427  }
428 
430  template<typename expected_t, typename actual_t>
431  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());}
432  template<typename expected_t, typename actual_t>
433  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);}
434  template<typename expected_t, typename actual_t>
435  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());}
436  template<typename expected_t, typename actual_t>
437  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) {
438  try {
439  collection_assert::are_equivalent(expected, actual, message, stack_frame);
440  } catch(...) {
441  base_assert::error();
442  }
443  }
444 
446  template<typename collection_t, typename item_t>
447  static void are_equivalent(const collection_t& expected, const std::initializer_list<item_t>& actual) {are_equivalent(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
448  template<typename collection_t, typename item_t>
449  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);}
450  template<typename collection_t, typename item_t>
451  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());}
452  template<typename collection_t, typename item_t>
453  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) {
454  try {
455  collection_assert::are_equivalent(expected, actual, message, stack_frame);
456  } catch(...) {
457  base_assert::error();
458  }
459  }
460 
462  template<typename item_t, typename collection_t>
463  static void are_equivalent(const std::initializer_list<item_t>& expected, const collection_t& actual) {are_equivalent(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
464  template<typename item_t, typename collection_t>
465  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);}
466  template<typename item_t, typename collection_t>
467  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());}
468  template<typename item_t, typename collection_t>
469  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) {
470  try {
471  collection_assert::are_equivalent(expected, actual, message, stack_frame);
472  } catch(...) {
473  base_assert::error();
474  }
475  }
477 
488  template<typename expected_t, typename actual_t>
489  static void are_not_equal(const expected_t& expected, const actual_t& actual) {are_not_equal(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
490 
501  template<typename expected_t, typename actual_t>
502  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());}
503 
514  template<typename expected_t, typename actual_t>
515  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);}
516 
527  template<typename expected_t, typename actual_t>
528  static void are_not_equal(const expected_t& expected, const actual_t& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
529  try {
530  collection_assert::are_not_equal(expected, actual, message, stack_frame);
531  } catch(...) {
532  base_assert::error();
533  }
534  }
535 
537  template<typename item_t>
538  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());}
539  template<typename item_t>
540  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);}
541  template<typename item_t>
542  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());}
543  template<typename item_t>
544  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) {
545  try {
546  collection_assert::are_not_equal(expected, actual, message, stack_frame);
547  } catch(...) {
548  base_assert::error();
549  }
550  }
551 
553  template<typename collection_t, typename item_t>
554  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());}
555  template<typename collection_t, typename item_t>
556  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);}
557  template<typename collection_t, typename item_t>
558  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());}
559  template<typename collection_t, typename item_t>
560  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) {
561  try {
562  collection_assert::are_not_equal(expected, actual, message, stack_frame);
563  } catch(...) {
564  base_assert::error();
565  }
566  }
567 
569  template<typename item_t, typename collection_t>
570  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());}
571  template<typename item_t, typename collection_t>
572  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);}
573  template<typename item_t, typename collection_t>
574  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());}
575  template<typename item_t, typename collection_t>
576  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) {
577  try {
578  collection_assert::are_not_equal(expected, actual, message, stack_frame);
579  } catch(...) {
580  base_assert::error();
581  }
582  }
584 
595  template<typename expected_t, typename actual_t>
596  static void are_not_equivalent(const expected_t& expected, const actual_t& actual) {are_not_equivalent(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
597 
608  template<typename expected_t, typename actual_t>
609  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());}
610 
621  template<typename expected_t, typename actual_t>
622  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);}
623 
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, const xtd::diagnostics::stack_frame& stack_frame) {
636  try {
637  collection_assert::are_not_equivalent(expected, actual, message, stack_frame);
638  } catch(...) {
639  base_assert::error();
640  }
641  }
642 
644  template<typename expected_t, typename actual_t>
645  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());}
646  template<typename expected_t, typename actual_t>
647  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);}
648  template<typename expected_t, typename actual_t>
649  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());}
650  template<typename expected_t, typename actual_t>
651  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) {
652  try {
653  collection_assert::are_not_equivalent(expected, actual, message, stack_frame);
654  } catch(...) {
655  base_assert::error();
656  }
657  }
658 
660  template<typename collection_t, typename item_t>
661  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());}
662  template<typename collection_t, typename item_t>
663  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);}
664  template<typename collection_t, typename item_t>
665  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());}
666  template<typename collection_t, typename item_t>
667  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) {
668  try {
669  collection_assert::are_not_equivalent(expected, actual, message, stack_frame);
670  } catch(...) {
671  base_assert::error();
672  }
673  }
674 
676  template<typename item_t, typename collection_t>
677  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());}
678  template<typename item_t, typename collection_t>
679  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);}
680  template<typename item_t, typename collection_t>
681  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());}
682  template<typename item_t, typename collection_t>
683  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) {
684  try {
685  collection_assert::are_not_equivalent(expected, actual, message, stack_frame);
686  } catch(...) {
687  base_assert::error();
688  }
689  }
691 
702  template<typename expected_t, typename actual_t>
703  static void contains(const expected_t& expected, const actual_t& actual) {contains(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
704 
715  template<typename expected_t, typename actual_t>
716  static void contains(const expected_t& expected, const actual_t& actual, const std::string& message) {contains(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
717 
728  template<typename expected_t, typename actual_t>
729  static void contains(const expected_t& expected, const actual_t& actual, const xtd::diagnostics::stack_frame& stack_frame) {contains(expected, actual, "", stack_frame);}
730 
741  template<typename expected_t, typename actual_t>
742  static void contains(const expected_t& expected, const actual_t& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
743  try {
744  collection_assert::contains(expected, actual, message, stack_frame);
745  } catch(...) {
746  base_assert::error();
747  }
748  }
749 
751  template<typename item_t>
752  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());}
753  template<typename item_t>
754  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);}
755  template<typename item_t>
756  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());}
757  template<typename item_t>
758  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) {
759  try {
760  collection_assert::contains(expected, actual, message, stack_frame);
761  } catch(...) {
762  base_assert::error();
763  }
764  }
765 
767  template<typename collection_t, typename item_t>
768  static void contains(const collection_t& expected, const std::initializer_list<item_t>& actual) {contains(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
769  template<typename collection_t, typename item_t>
770  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);}
771  template<typename collection_t, typename item_t>
772  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());}
773  template<typename collection_t, typename item_t>
774  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) {
775  try {
776  collection_assert::contains(expected, actual, message, stack_frame);
777  } catch(...) {
778  base_assert::error();
779  }
780  }
781 
783  template<typename item_t, typename collection_t>
784  static void contains(const std::initializer_list<item_t>& expected, const collection_t& actual) {contains(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
785  template<typename item_t, typename collection_t>
786  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);}
787  template<typename item_t, typename collection_t>
788  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());}
789  template<typename item_t, typename collection_t>
790  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) {
791  try {
792  collection_assert::contains(expected, actual, message, stack_frame);
793  } catch(...) {
794  base_assert::error();
795  }
796  }
798 
809  template<typename expected_t, typename actual_t>
810  static void does_not_contain(const expected_t& expected, const actual_t& actual) {does_not_contain(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
811 
822  template<typename expected_t, typename actual_t>
823  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());}
824 
835  template<typename expected_t, typename actual_t>
836  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);}
837 
848  template<typename expected_t, typename actual_t>
849  static void does_not_contain(const expected_t& expected, const actual_t& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
850  try {
851  collection_assert::does_not_contain(expected, actual, message, stack_frame);
852  } catch(...) {
853  base_assert::error();
854  }
855  }
856 
858  template<typename item_t>
859  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());}
860  template<typename item_t>
861  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);}
862  template<typename item_t>
863  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());}
864  template<typename item_t>
865  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) {
866  try {
867  collection_assert::does_not_contain(expected, actual, message, stack_frame);
868  } catch(...) {
869  base_assert::error();
870  }
871  }
872 
874  template<typename collection_t, typename item_t>
875  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());}
876  template<typename collection_t, typename item_t>
877  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);}
878  template<typename collection_t, typename item_t>
879  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());}
880  template<typename collection_t, typename item_t>
881  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) {
882  try {
883  collection_assert::does_not_contain(expected, actual, message, stack_frame);
884  } catch(...) {
885  base_assert::error();
886  }
887  }
888 
890  template<typename item_t, typename collection_t>
891  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());}
892  template<typename item_t, typename collection_t>
893  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);}
894  template<typename item_t, typename collection_t>
895  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());}
896  template<typename item_t, typename collection_t>
897  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) {
898  try {
899  collection_assert::does_not_contain(expected, actual, message, stack_frame);
900  } catch(...) {
901  base_assert::error();
902  }
903  }
905 
915  template<typename value_t>
916  static void is_empty(const value_t& value) {is_empty(value, "", xtd::diagnostics::stack_frame::empty());}
917 
928  template<typename value_t>
929  static void is_empty(const value_t& value, const xtd::diagnostics::stack_frame& stack_frame) {is_empty(value, "", stack_frame);}
930 
941  template<typename value_t>
942  static void is_empty(const value_t& value, const std::string& message) {is_empty(value, message, xtd::diagnostics::stack_frame::empty());}
943 
955  template<typename value_t>
956  static void is_empty(const value_t& value, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
957  try {
958  collection_assert::is_empty(value, message, stack_frame);
959  } catch(...) {
960  base_assert::error();
961  }
962  }
963 
965  template<typename value_t>
966  static void is_empty(const std::initializer_list<value_t>& value) {is_empty(value, "", xtd::diagnostics::stack_frame::empty());}
967  template<typename value_t>
968  static void is_empty(const std::initializer_list<value_t>& value, const xtd::diagnostics::stack_frame& stack_frame) {is_empty(value, "", stack_frame);}
969  template<typename value_t>
970  static void is_empty(const std::initializer_list<value_t>& value, const std::string& message) {is_empty(value, message, xtd::diagnostics::stack_frame::empty());}
971  template<typename value_t>
972  static void is_empty(const std::initializer_list<value_t>& value, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
973  try {
974  collection_assert::is_empty(value, message, stack_frame);
975  } catch(...) {
976  base_assert::error();
977  }
978  }
980 
990  template<typename value_t>
991  static void is_not_empty(const value_t& value) {is_not_empty(value, "", xtd::diagnostics::stack_frame::empty());}
992 
1003  template<typename value_t>
1004  static void is_not_empty(const value_t& value, const xtd::diagnostics::stack_frame& stack_frame) {is_not_empty(value, "", stack_frame);}
1005 
1016  template<typename value_t>
1017  static void is_not_empty(const value_t& value, const std::string& message) {is_not_empty(value, message, xtd::diagnostics::stack_frame::empty());}
1018 
1030  template<typename value_t>
1031  static void is_not_empty(const value_t& value, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
1032  try {
1033  collection_assert::is_not_empty(value, message, stack_frame);
1034  } catch(...) {
1035  base_assert::error();
1036  }
1037  }
1038 
1040  template<typename value_t>
1041  static void is_not_empty(const std::initializer_list<value_t>& value) {is_not_empty(value, "", xtd::diagnostics::stack_frame::empty());}
1042  template<typename value_t>
1043  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);}
1044  template<typename value_t>
1045  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());}
1046  template<typename value_t>
1047  static void is_not_empty(const std::initializer_list<value_t>& value, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
1048  try {
1049  collection_assert::is_not_empty(value, message, stack_frame);
1050  } catch(...) {
1051  base_assert::error();
1052  }
1053  }
1055 
1065  template<typename value_t>
1066  static void is_ordered(const value_t& value) {is_ordered(value, "", xtd::diagnostics::stack_frame::empty());}
1067 
1078  template<typename value_t>
1079  static void is_ordered(const value_t& value, const xtd::diagnostics::stack_frame& stack_frame) {is_ordered(value, "", stack_frame);}
1080 
1091  template<typename value_t>
1092  static void is_ordered(const value_t& value, const std::string& message) {is_ordered(value, message, xtd::diagnostics::stack_frame::empty());}
1093 
1105  template<typename value_t>
1106  static void is_ordered(const value_t& value, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
1107  try {
1108  collection_assert::is_ordered(value, message, stack_frame);
1109  } catch(...) {
1110  base_assert::error();
1111  }
1112  }
1113 
1115  template<typename value_t>
1116  static void is_ordered(const std::initializer_list<value_t>& value) {is_ordered(value, "", xtd::diagnostics::stack_frame::empty());}
1117  template<typename value_t>
1118  static void is_ordered(const std::initializer_list<value_t>& value, const xtd::diagnostics::stack_frame& stack_frame) {is_ordered(value, "", stack_frame);}
1119  template<typename value_t>
1120  static void is_ordered(const std::initializer_list<value_t>& value, const std::string& message) {is_ordered(value, message, xtd::diagnostics::stack_frame::empty());}
1121  template<typename value_t>
1122  static void is_ordered(const std::initializer_list<value_t>& value, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
1123  try {
1124  collection_assert::is_ordered(value, message, stack_frame);
1125  } catch(...) {
1126  base_assert::error();
1127  }
1128  }
1130  };
1131  }
1132 }
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition: stack_frame.h:29
static stack_frame empty() noexcept
Return an empty stack frame.
The base class for assert.
Definition: base_assert.h:25
static void does_not_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_valid class contains a collection of static methods that implement the most collection...
Definition: collection_valid.h:21
static void are_not_equal(const expected_t &expected, const actual_t &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that all collection items are not equal.
Definition: collection_valid.h:528
static void are_not_equivalent(const expected_t &expected, const actual_t &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that all collection items are not equivalent.
Definition: collection_valid.h:635
static void are_not_equivalent(const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame)
Validates that all collection items are not equivalent.
Definition: collection_valid.h:622
static void is_ordered(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame)
Validates that collection is ordered.
Definition: collection_valid.h:1079
static void are_equivalent(const expected_t &expected, const actual_t &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that all collection items are equivalent.
Definition: collection_valid.h:421
static void is_empty(const value_t &value)
Validates that collection contains an item.
Definition: collection_valid.h:916
static void are_equivalent(const expected_t &expected, const actual_t &actual)
Validates that all collection items are equivalent.
Definition: collection_valid.h:382
static void all_items_are_unique(const collection_t &collection, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that all collection items are unique.
Definition: collection_valid.h:239
static void are_equal(const expected_t &expected, const actual_t &actual, const std::string &message)
Validates that all collection items are equal.
Definition: collection_valid.h:288
static void are_not_equal(const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame)
Validates that all collection items are not equal.
Definition: collection_valid.h:515
static void all_items_are_unique(const collection_t &collection, const std::string &message)
Validates that all collection items are unique.
Definition: collection_valid.h:211
static void contains(const expected_t &expected, const actual_t &actual, const std::string &message)
Validates that collection contains all items.
Definition: collection_valid.h:716
static void all_items_are_not_null(const collection_t &collection)
Validates that all collection items are not null.
Definition: collection_valid.h:115
static void contains(const expected_t &expected, const actual_t &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that collection contains all items.
Definition: collection_valid.h:742
static void is_ordered(const value_t &value, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that collection is ordered.
Definition: collection_valid.h:1106
static void all_items_are_not_null(const collection_t &collection, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that all collection items are not null.
Definition: collection_valid.h:160
static void all_items_are_unique(const collection_t &collection)
Validates that all collection items are unique.
Definition: collection_valid.h:197
static void is_not_empty(const value_t &value, const std::string &message)
Validates that collection or traits does not contain any item.
Definition: collection_valid.h:1017
static void are_equivalent(const expected_t &expected, const actual_t &actual, const std::string &message)
Validates that all collection items are equivalent.
Definition: collection_valid.h:395
static void are_not_equal(const expected_t &expected, const actual_t &actual)
Validates that all collection items are not equal.
Definition: collection_valid.h:489
static void does_not_contain(const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame)
Validates that collection contains all items.
Definition: collection_valid.h:836
static void all_items_are_instances_of(const collection_t &collection, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that all collection items are of the type supplied or a derived type.
Definition: collection_valid.h:77
static void does_not_contain(const expected_t &expected, const actual_t &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that collection contains all items.
Definition: collection_valid.h:849
static void all_items_are_instances_of(const collection_t &collection)
Validates that all collection items are of the type supplied or a derived type.
Definition: collection_valid.h:38
static void are_equal(const expected_t &expected, const actual_t &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that all collection items are equal.
Definition: collection_valid.h:314
static void all_items_are_not_null(const collection_t &collection, const std::string &message)
Validates that all collection items are not null.
Definition: collection_valid.h:130
static void are_not_equivalent(const expected_t &expected, const actual_t &actual, const std::string &message)
Validates that all collection items are not equivalent.
Definition: collection_valid.h:609
static void is_empty(const value_t &value, const std::string &message)
Validates that collection contains an item.
Definition: collection_valid.h:942
static void all_items_are_not_null(const collection_t &collection, const xtd::diagnostics::stack_frame &stack_frame)
Validates that all collection items are not null.
Definition: collection_valid.h:145
static void are_equal(const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame)
Validates that all collection items are equal.
Definition: collection_valid.h:301
static void is_not_empty(const value_t &value)
Validates that collection does not contain any item.
Definition: collection_valid.h:991
static void is_ordered(const value_t &value, const std::string &message)
Validates that collection is ordered.
Definition: collection_valid.h:1092
static void is_ordered(const value_t &value)
Validates that collection is ordered.
Definition: collection_valid.h:1066
static void contains(const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame)
Validates that collection contains all items.
Definition: collection_valid.h:729
static void are_not_equivalent(const expected_t &expected, const actual_t &actual)
Validates that all collection items are not equivalent.
Definition: collection_valid.h:596
static void contains(const expected_t &expected, const actual_t &actual)
Validates that collection contains all items.
Definition: collection_valid.h:703
static void all_items_are_instances_of(const collection_t &collection, const std::string &message)
Validates that all collection items are of the type supplied or a derived type.
Definition: collection_valid.h:51
static void is_empty(const value_t &value, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that collection contains an item.
Definition: collection_valid.h:956
static void is_empty(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame)
Validates that collection contains an item.
Definition: collection_valid.h:929
static void are_equal(const expected_t &expected, const actual_t &actual)
Validates that all collection items are equal.
Definition: collection_valid.h:275
static void are_equivalent(const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame)
Validates that all collection items are equivalent.
Definition: collection_valid.h:408
static void are_not_equal(const expected_t &expected, const actual_t &actual, const std::string &message)
Validates that all collection items are not equal.
Definition: collection_valid.h:502
static void is_not_empty(const value_t &value, const xtd::diagnostics::stack_frame &stack_frame)
Validates that collection or traits does not contain any item.
Definition: collection_valid.h:1004
static void all_items_are_instances_of(const collection_t &collection, const xtd::diagnostics::stack_frame &stack_frame)
Validates that all collection items are of the type supplied or a derived type.
Definition: collection_valid.h:64
static void does_not_contain(const expected_t &expected, const actual_t &actual, const std::string &message)
Validates that collection contains all items.
Definition: collection_valid.h:823
static void is_not_empty(const value_t &value, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that collection or traits does not contain any item.
Definition: collection_valid.h:1031
static void does_not_contain(const expected_t &expected, const actual_t &actual)
Validates that collection contains all items.
Definition: collection_valid.h:810
static void all_items_are_unique(const collection_t &collection, const xtd::diagnostics::stack_frame &stack_frame)
Validates that all collection items are unique.
Definition: collection_valid.h:225
Contains xtd::tunit::collection_valid class.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17
Contains xtd::tunit::valid class.