xtd - Reference Guide 0.2.0
file_assume.h
Go to the documentation of this file.
1 #pragma once
5 #include "assume.h"
6 #include "file_assert.h"
7 
9 namespace xtd {
11  namespace tunit {
22  class file_assume final : private base_assert {
23  public:
25  file_assume() = delete;
27 
45  template<typename Char>
46  static void are_equal(const std::basic_istream<Char>& expected, const std::basic_istream<Char>& actual) {are_equal(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
47 
66  template<typename Char>
67  static void are_equal(const std::basic_istream<Char>& expected, const std::basic_istream<Char>& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_equal(expected, actual, "", stack_frame);}
68 
87  template<typename Char>
88  static void are_equal(const std::basic_istream<Char>& expected, const std::basic_istream<Char>& actual, const std::string& message) {are_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
89 
109  template<typename Char>
110  static void are_equal(const std::basic_istream<Char>& expected, const std::basic_istream<Char>& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
111  try {
112  file_assert::are_equal(expected, actual, message, stack_frame);
113  } catch (...) {
114  assert::abort();
115  }
116  }
117 
135  template<typename Char>
136  static void are_equal(const std::basic_string<Char>& expected, const std::basic_string<Char>& actual) {are_equal(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
137 
156  template<typename Char>
157  static void are_equal(const std::basic_string<Char>& expected, const std::basic_string<Char>& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_equal(expected, actual, "", stack_frame);}
158 
177  template<typename Char>
178  static void are_equal(const std::basic_string<Char>& expected, const std::basic_string<Char>& actual, const std::string& message) {are_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
179 
199  template<typename Char>
200  static void are_equal(const std::basic_string<Char>& expected, const std::basic_string<Char>& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {are_equal(std::basic_ifstream<Char>(expected), std::basic_ifstream<Char>(actual), message, stack_frame);}
201 
203  template<typename Char>
204  static void are_equal(const std::basic_string<Char>& expected, const Char* actual) {are_equal(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
205  template<typename Char>
206  static void are_equal(const std::basic_string<Char>& expected, const Char* actual, const xtd::diagnostics::stack_frame& stack_frame) {are_equal(expected, actual, "", stack_frame);}
207  template<typename Char>
208  static void are_equal(const std::basic_string<Char>& expected, const Char* actual, const std::string& message) {are_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
209  template<typename Char>
210  static void are_equal(const std::basic_string<Char>& expected, const Char* actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {are_equal(std::basic_ifstream<Char>(expected), std::basic_ifstream<Char>(actual), message, stack_frame);}
211  template<typename Char>
212  static void are_equal(const Char* expected, const std::basic_string<Char>& actual) {are_equal(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
213  template<typename Char>
214  static void are_equal(const Char* expected, const std::basic_string<Char>& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_equal(expected, actual, "", stack_frame);}
215  template<typename Char>
216  static void are_equal(const Char* expected, const std::basic_string<Char>& actual, const std::string& message) {are_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
217  template<typename Char>
218  static void are_equal(const Char* expected, const std::basic_string<Char>& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {are_equal(std::basic_ifstream<Char>(expected), std::basic_ifstream<Char>(actual), message, stack_frame);}
219  template<typename Char>
220  static void are_equal(const Char* expected, const Char* actual) {are_equal(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
221  template<typename Char>
222  static void are_equal(const Char* expected, const Char* actual, const xtd::diagnostics::stack_frame& stack_frame) {are_equal(expected, actual, "", stack_frame);}
223  template<typename Char>
224  static void are_equal(const Char* expected, const Char* actual, const std::string& message) {are_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
225  template<typename Char>
226  static void are_equal(const Char* expected, const Char* actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {are_equal(std::basic_ifstream<Char>(expected), std::basic_ifstream<Char>(actual), message, stack_frame);}
228 
246  template<typename Char>
247  static void are_not_equal(const std::basic_istream<Char>& expected, const std::basic_istream<Char>& actual) {are_not_equal(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
248 
267  template<typename Char>
268  static void are_not_equal(const std::basic_istream<Char>& expected, const std::basic_istream<Char>& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_not_equal(expected, actual, "", stack_frame);}
269 
288  template<typename Char>
289  static void are_not_equal(const std::basic_istream<Char>& expected, const std::basic_istream<Char>& actual, const std::string& message) {are_not_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
290 
310  template<typename Char>
311  static void are_not_equal(const std::basic_istream<Char>& expected, const std::basic_istream<Char>& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
312  try {
313  file_assert::are_not_equal(expected, actual, message, stack_frame);
314  } catch (...) {
315  assert::abort();
316  }
317  }
318 
336  template<typename Char>
337  static void are_not_equal(const std::basic_string<Char>& expected, const std::basic_string<Char>& actual) {are_not_equal(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
338 
357  template<typename Char>
358  static void are_not_equal(const std::basic_string<Char>& expected, const std::basic_string<Char>& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_not_equal(expected, actual, "", stack_frame);}
359 
378  template<typename Char>
379  static void are_not_equal(const std::basic_string<Char>& expected, const std::basic_string<Char>& actual, const std::string& message) {are_not_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
380 
400  template<typename Char>
401  static void are_not_equal(const std::basic_string<Char>& expected, const std::basic_string<Char>& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {are_not_equal(std::basic_ifstream<Char>(expected), std::basic_ifstream<Char>(actual), message, stack_frame);}
402 
404  template<typename Char>
405  static void are_not_equal(const std::basic_string<Char>& expected, const Char* actual) {are_not_equal(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
406  template<typename Char>
407  static void are_not_equal(const std::basic_string<Char>& expected, const Char* actual, const xtd::diagnostics::stack_frame& stack_frame) {are_not_equal(expected, actual, "", stack_frame);}
408  template<typename Char>
409  static void are_not_equal(const std::basic_string<Char>& expected, const Char* actual, const std::string& message) {are_not_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
410  template<typename Char>
411  static void are_not_equal(const std::basic_string<Char>& expected, const Char* actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {are_not_equal(std::basic_ifstream<Char>(expected), std::basic_ifstream<Char>(actual), message, stack_frame);}
412  template<typename Char>
413  static void are_not_equal(const Char* expected, const std::basic_string<Char>& actual) {are_not_equal(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
414  template<typename Char>
415  static void are_not_equal(const Char* expected, const std::basic_string<Char>& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_not_equal(expected, actual, "", stack_frame);}
416  template<typename Char>
417  static void are_not_equal(const Char* expected, const std::basic_string<Char>& actual, const std::string& message) {are_not_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
418  template<typename Char>
419  static void are_not_equal(const Char* expected, const std::basic_string<Char>& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {are_not_equal(std::basic_ifstream<Char>(expected), std::basic_ifstream<Char>(actual), message, stack_frame);}
420  template<typename Char>
421  static void are_not_equal(const Char* expected, const Char* actual) {are_not_equal(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
422  template<typename Char>
423  static void are_not_equal(const Char* expected, const Char* actual, const xtd::diagnostics::stack_frame& stack_frame) {are_not_equal(expected, actual, "", stack_frame);}
424  template<typename Char>
425  static void are_not_equal(const Char* expected, const Char* actual, const std::string& message) {are_not_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
426  template<typename Char>
427  static void are_not_equal(const Char* expected, const Char* actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {are_not_equal(std::basic_ifstream<Char>(expected), std::basic_ifstream<Char>(actual), message, stack_frame);}
429 
441  template<typename Char>
442  static void exists(const std::basic_string<Char>& file) {exists(file, "", xtd::diagnostics::stack_frame::empty());}
443 
456  template<typename Char>
457  static void exists(const std::basic_string<Char>& file, const xtd::diagnostics::stack_frame& stack_frame) {exists(file, "", stack_frame);}
458 
471  template<typename Char>
472  static void exists(const std::basic_string<Char>& file, const std::string& message) {exists(file, message, xtd::diagnostics::stack_frame::empty());}
473 
487  template<typename Char>
488  static void exists(const std::basic_string<Char>& file, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
489  try {
490  file_assert::exists(file, message, stack_frame);
491  } catch (...) {
492  assert::abort();
493  }
494  }
495 
497  template<typename Char>
498  static void exists(const Char* file) {exists(file, "", xtd::diagnostics::stack_frame::empty());}
499  template<typename Char>
500  static void exists(const Char* file, const xtd::diagnostics::stack_frame& stack_frame) {exists(file, "", stack_frame);}
501  template<typename Char>
502  static void exists(const Char* file, const std::string& message) {exists(file, message, xtd::diagnostics::stack_frame::empty());}
503  template<typename Char>
504  static void exists(const Char* file, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {exists(std::basic_string<Char>(file), message, stack_frame);}
506 
518  template<typename Char>
519  static void does_not_exist(const std::basic_string<Char>& file) {does_not_exist(file, "", xtd::diagnostics::stack_frame::empty());}
520 
533  template<typename Char>
534  static void does_not_exist(const std::basic_string<Char>& file, const xtd::diagnostics::stack_frame& stack_frame) {does_not_exist(file, "", stack_frame);}
535 
548  template<typename Char>
549  static void does_not_exist(const std::basic_string<Char>& file, const std::string& message) {does_not_exist(file, message, xtd::diagnostics::stack_frame::empty());}
550 
564  template<typename Char>
565  static void does_not_exist(const std::basic_string<Char>& file, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
566  try {
567  file_assert::does_not_exist(file, message, stack_frame);
568  } catch (...) {
569  assert::abort();
570  }
571  }
572 
574  template<typename Char>
575  static void does_not_exist(const Char* file) {does_not_exist(file, "", xtd::diagnostics::stack_frame::empty());}
576  template<typename Char>
577  static void does_not_exist(const Char* file, const xtd::diagnostics::stack_frame& stack_frame) {does_not_exist(file, "", stack_frame);}
578  template<typename Char>
579  static void does_not_exist(const Char* file, const std::string& message) {does_not_exist(file, message, xtd::diagnostics::stack_frame::empty());}
580  template<typename Char>
581  static void does_not_exist(const Char* file, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {does_not_exist(std::basic_string<Char>(file), message, stack_frame);}
583  };
584  }
585 }
static void does_not_exist(const std::basic_string< Char > &file)
Asserts that file not exists.
Definition: file_assert.h:555
static void does_not_exist(const std::basic_string< Char > &file, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that file not exists.
Definition: file_assume.h:565
The file_assume class contains a collection of static methods that implement the most file assertions...
Definition: file_assume.h:22
The base class for assert.
Definition: base_assert.h:25
static void exists(const std::basic_string< Char > &file)
Assumes that file exists.
Definition: file_assume.h:442
static void are_not_equal(const std::basic_istream< Char > &expected, const std::basic_istream< Char > &actual, const std::string &message)
Assumes that two files are not equal.
Definition: file_assume.h:289
static void are_equal(const std::basic_string< Char > &expected, const std::basic_string< Char > &actual)
Assumes that two files are equal.
Definition: file_assume.h:136
Contains xtd::tunit::file_assert class.
static void exists(const std::basic_string< Char > &file, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that file exists.
Definition: file_assume.h:457
static void does_not_exist(const std::basic_string< Char > &file)
Assumes that file not exists.
Definition: file_assume.h:519
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
static void exists(const std::basic_string< Char > &file, const std::string &message)
Assumes that file exists.
Definition: file_assume.h:472
static void abort()
Abort current test. This is used by the other Assert functions.
Definition: base_assert.h:36
static void exists(const std::basic_string< Char > &file)
Asserts that file exists.
Definition: file_assert.h:479
static void are_equal(const std::basic_string< Char > &expected, const std::basic_string< Char > &actual, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that two files are equal.
Definition: file_assume.h:157
static void are_not_equal(const std::basic_istream< Char > &expected, const std::basic_istream< Char > &actual)
Assumes that two files are not equal.
Definition: file_assume.h:247
static void are_not_equal(const std::basic_string< Char > &expected, const std::basic_string< Char > &actual)
Assumes that two files are not equal.
Definition: file_assume.h:337
static void does_not_exist(const std::basic_string< Char > &file, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that file not exists.
Definition: file_assume.h:534
Contains xtd::tunit::assume class.
static void are_equal(const std::basic_istream< Char > &expected, const std::basic_istream< Char > &actual, const std::string &message)
Assumes that two files are equal.
Definition: file_assume.h:88
static void does_not_exist(const std::basic_string< Char > &file, const std::string &message)
Assumes that file not exists.
Definition: file_assume.h:549
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition: stack_frame.h:34
static stack_frame empty() noexcept
Return an empty stack frame.
static void are_not_equal(const std::basic_istream< Char > &expected, const std::basic_istream< Char > &actual)
Asserts that two files are not equal.
Definition: file_assert.h:266
static void are_equal(const std::basic_istream< Char > &expected, const std::basic_istream< Char > &actual, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that two files are equal.
Definition: file_assume.h:67
static void are_not_equal(const std::basic_string< Char > &expected, const std::basic_string< Char > &actual, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that two files are not equal.
Definition: file_assume.h:358
static void exists(const std::basic_string< Char > &file, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that file exists.
Definition: file_assume.h:488
static void are_equal(const std::basic_istream< Char > &expected, const std::basic_istream< Char > &actual)
Assumes that two files are equal.
Definition: file_assume.h:46
static void are_equal(const std::basic_istream< Char > &expected, const std::basic_istream< Char > &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that two files are equal.
Definition: file_assume.h:110
static void are_not_equal(const std::basic_istream< Char > &expected, const std::basic_istream< Char > &actual, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that two files are not equal.
Definition: file_assume.h:268
static void are_equal(const std::basic_istream< Char > &expected, const std::basic_istream< Char > &actual)
Asserts that two files are equal.
Definition: file_assert.h:47
static void are_equal(const std::basic_string< Char > &expected, const std::basic_string< Char > &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that two files are equal.
Definition: file_assume.h:200
static void are_not_equal(const std::basic_istream< Char > &expected, const std::basic_istream< Char > &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that two files are not equal.
Definition: file_assume.h:311
static void are_not_equal(const std::basic_string< Char > &expected, const std::basic_string< Char > &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that two files are not equal.
Definition: file_assume.h:401
static void are_equal(const std::basic_string< Char > &expected, const std::basic_string< Char > &actual, const std::string &message)
Assumes that two files are equal.
Definition: file_assume.h:178
static void are_not_equal(const std::basic_string< Char > &expected, const std::basic_string< Char > &actual, const std::string &message)
Assumes that two files are not equal.
Definition: file_assume.h:379