xtd 0.2.0
Loading...
Searching...
No Matches
file_assume.h
Go to the documentation of this file.
1
4#pragma once
5#include "assume.h"
6#include "file_assert.h"
7
9namespace xtd {
11 namespace tunit {
22 class tunit_export_ file_assume final : private base_assert {
23 public:
25 file_assume() = delete;
27
29
48 template<typename char_t>
49 static void are_equal(const std::basic_istream<char_t>& expected, const std::basic_istream<char_t>& actual) {are_equal(expected, actual, xtd::string::empty_string, xtd::diagnostics::stack_frame::empty());}
68 template<typename char_t>
69 static void are_equal(const std::basic_istream<char_t>& expected, const std::basic_istream<char_t>& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_equal(expected, actual, xtd::string::empty_string, stack_frame);}
88 template<typename char_t>
89 static void are_equal(const std::basic_istream<char_t>& expected, const std::basic_istream<char_t>& actual, const std::string& message) {are_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
109 template<typename char_t>
110 static void are_equal(const std::basic_istream<char_t>& expected, const std::basic_istream<char_t>& 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 }
134 template<typename char_t>
154 template<typename char_t>
155 static void are_equal(const xtd::basic_string<char_t>& expected, const xtd::basic_string<char_t>& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_equal(expected, actual, xtd::string::empty_string, stack_frame);}
174 template<typename char_t>
175 static void are_equal(const xtd::basic_string<char_t>& expected, const xtd::basic_string<char_t>& actual, const std::string& message) {are_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
195 template<typename char_t>
196 static void are_equal(const xtd::basic_string<char_t>& expected, const xtd::basic_string<char_t>& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {are_equal(std::basic_ifstream<char_t>(expected), std::basic_ifstream<char_t>(actual), message, stack_frame);}
197
199 template<typename char_t>
200 static void are_equal(const xtd::basic_string<char_t>& expected, const char_t* actual) {are_equal(expected, actual, xtd::string::empty_string, xtd::diagnostics::stack_frame::empty());}
201 template<typename char_t>
202 static void are_equal(const xtd::basic_string<char_t>& expected, const char_t* actual, const xtd::diagnostics::stack_frame& stack_frame) {are_equal(expected, actual, xtd::string::empty_string, stack_frame);}
203 template<typename char_t>
204 static void are_equal(const xtd::basic_string<char_t>& expected, const char_t* actual, const std::string& message) {are_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
205 template<typename char_t>
206 static void are_equal(const xtd::basic_string<char_t>& expected, const char_t* actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {are_equal(std::basic_ifstream<char_t>(expected), std::basic_ifstream<char_t>(actual), message, stack_frame);}
207 template<typename char_t>
208 static void are_equal(const char_t* expected, const xtd::basic_string<char_t>& actual) {are_equal(expected, actual, xtd::string::empty_string, xtd::diagnostics::stack_frame::empty());}
209 template<typename char_t>
210 static void are_equal(const char_t* expected, const xtd::basic_string<char_t>& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_equal(expected, actual, xtd::string::empty_string, stack_frame);}
211 template<typename char_t>
212 static void are_equal(const char_t* expected, const xtd::basic_string<char_t>& actual, const std::string& message) {are_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
213 template<typename char_t>
214 static void are_equal(const char_t* expected, const xtd::basic_string<char_t>& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {are_equal(std::basic_ifstream<char_t>(expected), std::basic_ifstream<char_t>(actual), message, stack_frame);}
215 template<typename char_t>
216 static void are_equal(const char_t* expected, const char_t* actual) {are_equal(expected, actual, xtd::string::empty_string, xtd::diagnostics::stack_frame::empty());}
217 template<typename char_t>
218 static void are_equal(const char_t* expected, const char_t* actual, const xtd::diagnostics::stack_frame& stack_frame) {are_equal(expected, actual, xtd::string::empty_string, stack_frame);}
219 template<typename char_t>
220 static void are_equal(const char_t* expected, const char_t* actual, const std::string& message) {are_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
221 template<typename char_t>
222 static void are_equal(const char_t* expected, const char_t* actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {are_equal(std::basic_ifstream<char_t>(expected), std::basic_ifstream<char_t>(actual), message, stack_frame);}
224
242 template<typename char_t>
243 static void are_not_equal(const std::basic_istream<char_t>& expected, const std::basic_istream<char_t>& actual) {are_not_equal(expected, actual, xtd::string::empty_string, xtd::diagnostics::stack_frame::empty());}
262 template<typename char_t>
263 static void are_not_equal(const std::basic_istream<char_t>& expected, const std::basic_istream<char_t>& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_not_equal(expected, actual, xtd::string::empty_string, stack_frame);}
282 template<typename char_t>
283 static void are_not_equal(const std::basic_istream<char_t>& expected, const std::basic_istream<char_t>& actual, const std::string& message) {are_not_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
303 template<typename char_t>
304 static void are_not_equal(const std::basic_istream<char_t>& expected, const std::basic_istream<char_t>& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
305 try {
306 file_assert::are_not_equal(expected, actual, message, stack_frame);
307 } catch (...) {
308 assert::abort();
309 }
310 }
328 template<typename char_t>
348 template<typename char_t>
349 static void are_not_equal(const xtd::basic_string<char_t>& expected, const xtd::basic_string<char_t>& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_not_equal(expected, actual, xtd::string::empty_string, stack_frame);}
368 template<typename char_t>
369 static void are_not_equal(const xtd::basic_string<char_t>& expected, const xtd::basic_string<char_t>& actual, const std::string& message) {are_not_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
389 template<typename char_t>
390 static void are_not_equal(const xtd::basic_string<char_t>& expected, const xtd::basic_string<char_t>& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {are_not_equal(std::basic_ifstream<char_t>(expected), std::basic_ifstream<char_t>(actual), message, stack_frame);}
391
393 template<typename char_t>
394 static void are_not_equal(const xtd::basic_string<char_t>& expected, const char_t* actual) {are_not_equal(expected, actual, xtd::string::empty_string, xtd::diagnostics::stack_frame::empty());}
395 template<typename char_t>
396 static void are_not_equal(const xtd::basic_string<char_t>& expected, const char_t* actual, const xtd::diagnostics::stack_frame& stack_frame) {are_not_equal(expected, actual, xtd::string::empty_string, stack_frame);}
397 template<typename char_t>
398 static void are_not_equal(const xtd::basic_string<char_t>& expected, const char_t* actual, const std::string& message) {are_not_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
399 template<typename char_t>
400 static void are_not_equal(const xtd::basic_string<char_t>& expected, const char_t* actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {are_not_equal(std::basic_ifstream<char_t>(expected), std::basic_ifstream<char_t>(actual), message, stack_frame);}
401 template<typename char_t>
402 static void are_not_equal(const char_t* expected, const xtd::basic_string<char_t>& actual) {are_not_equal(expected, actual, xtd::string::empty_string, xtd::diagnostics::stack_frame::empty());}
403 template<typename char_t>
404 static void are_not_equal(const char_t* expected, const xtd::basic_string<char_t>& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_not_equal(expected, actual, xtd::string::empty_string, stack_frame);}
405 template<typename char_t>
406 static void are_not_equal(const char_t* expected, const xtd::basic_string<char_t>& actual, const std::string& message) {are_not_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
407 template<typename char_t>
408 static void are_not_equal(const char_t* expected, const xtd::basic_string<char_t>& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {are_not_equal(std::basic_ifstream<char_t>(expected), std::basic_ifstream<char_t>(actual), message, stack_frame);}
409 template<typename char_t>
410 static void are_not_equal(const char_t* expected, const char_t* actual) {are_not_equal(expected, actual, xtd::string::empty_string, xtd::diagnostics::stack_frame::empty());}
411 template<typename char_t>
412 static void are_not_equal(const char_t* expected, const char_t* actual, const xtd::diagnostics::stack_frame& stack_frame) {are_not_equal(expected, actual, xtd::string::empty_string, stack_frame);}
413 template<typename char_t>
414 static void are_not_equal(const char_t* expected, const char_t* actual, const std::string& message) {are_not_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
415 template<typename char_t>
416 static void are_not_equal(const char_t* expected, const char_t* actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {are_not_equal(std::basic_ifstream<char_t>(expected), std::basic_ifstream<char_t>(actual), message, stack_frame);}
418
430 template<typename char_t>
444 template<typename char_t>
458 template<typename char_t>
459 static void does_not_exist(const xtd::basic_string<char_t>& file, const std::string& message) {does_not_exist(file, message, xtd::diagnostics::stack_frame::empty());}
473 template<typename char_t>
474 static void does_not_exist(const xtd::basic_string<char_t>& file, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
475 try {
476 file_assert::does_not_exist(file, message, stack_frame);
477 } catch (...) {
478 assert::abort();
479 }
480 }
481
483 template<typename char_t>
484 static void does_not_exist(const char_t* file) {does_not_exist(file, xtd::string::empty_string, xtd::diagnostics::stack_frame::empty());}
485 template<typename char_t>
486 static void does_not_exist(const char_t* file, const xtd::diagnostics::stack_frame& stack_frame) {does_not_exist(file, xtd::string::empty_string, stack_frame);}
487 template<typename char_t>
488 static void does_not_exist(const char_t* file, const std::string& message) {does_not_exist(file, message, xtd::diagnostics::stack_frame::empty());}
489 template<typename char_t>
490 static void does_not_exist(const char_t* file, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {does_not_exist(xtd::basic_string<char_t>(file), message, stack_frame);}
492
504 template<typename char_t>
518 template<typename char_t>
519 static void exists(const xtd::basic_string<char_t>& file, const xtd::diagnostics::stack_frame& stack_frame) {exists(file, xtd::string::empty_string, stack_frame);}
532 template<typename char_t>
533 static void exists(const xtd::basic_string<char_t>& file, const std::string& message) {exists(file, message, xtd::diagnostics::stack_frame::empty());}
547 template<typename char_t>
548 static void exists(const xtd::basic_string<char_t>& file, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
549 try {
550 file_assert::exists(file, message, stack_frame);
551 } catch (...) {
552 assert::abort();
553 }
554 }
555
557 template<typename char_t>
558 static void exists(const char_t* file) {exists(file, xtd::string::empty_string, xtd::diagnostics::stack_frame::empty());}
559 template<typename char_t>
560 static void exists(const char_t* file, const xtd::diagnostics::stack_frame& stack_frame) {exists(file, xtd::string::empty_string, stack_frame);}
561 template<typename char_t>
562 static void exists(const char_t* file, const std::string& message) {exists(file, message, xtd::diagnostics::stack_frame::empty());}
563 template<typename char_t>
564 static void exists(const char_t* file, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {exists(xtd::basic_string<char_t>(file), message, stack_frame);}
567 };
568 }
569}
Contains xtd::tunit::assume class.
Represents text as a sequence of character units.
Definition basic_string.h:79
static const basic_string empty_string
Represents the empty basic_string.
Definition basic_string.h:124
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition stack_frame.h:46
static stack_frame empty() noexcept
Return an empty stack frame.
The base class for assert.
Definition base_assert.h:29
The file_assume class contains a collection of static methods that implement the most file assertions...
Definition file_assume.h:22
static void are_equal(const std::basic_istream< char_t > &expected, const std::basic_istream< char_t > &actual, const std::string &message)
Assumes that two files are equal.
Definition file_assume.h:89
static void are_not_equal(const std::basic_istream< char_t > &expected, const std::basic_istream< char_t > &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that two files are not equal.
Definition file_assume.h:304
static void does_not_exist(const xtd::basic_string< char_t > &file, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that file not exists.
Definition file_assume.h:474
static void are_not_equal(const xtd::basic_string< char_t > &expected, const xtd::basic_string< char_t > &actual, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that two files are not equal.
Definition file_assume.h:349
static void are_not_equal(const std::basic_istream< char_t > &expected, const std::basic_istream< char_t > &actual)
Assumes that two files are not equal.
Definition file_assume.h:243
static void are_equal(const xtd::basic_string< char_t > &expected, const xtd::basic_string< char_t > &actual, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that two files are equal.
Definition file_assume.h:155
static void are_not_equal(const std::basic_istream< char_t > &expected, const std::basic_istream< char_t > &actual, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that two files are not equal.
Definition file_assume.h:263
static void are_equal(const std::basic_istream< char_t > &expected, const std::basic_istream< char_t > &actual, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that two files are equal.
Definition file_assume.h:69
static void are_equal(const xtd::basic_string< char_t > &expected, const xtd::basic_string< char_t > &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that two files are equal.
Definition file_assume.h:196
static void does_not_exist(const xtd::basic_string< char_t > &file, const std::string &message)
Assumes that file not exists.
Definition file_assume.h:459
static void does_not_exist(const xtd::basic_string< char_t > &file, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that file not exists.
Definition file_assume.h:445
static void exists(const xtd::basic_string< char_t > &file, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that file exists.
Definition file_assume.h:548
static void are_not_equal(const std::basic_istream< char_t > &expected, const std::basic_istream< char_t > &actual, const std::string &message)
Assumes that two files are not equal.
Definition file_assume.h:283
static void are_not_equal(const xtd::basic_string< char_t > &expected, const xtd::basic_string< char_t > &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that two files are not equal.
Definition file_assume.h:390
static void exists(const xtd::basic_string< char_t > &file)
Assumes that file exists.
Definition file_assume.h:505
static void are_equal(const xtd::basic_string< char_t > &expected, const xtd::basic_string< char_t > &actual)
Assumes that two files are equal.
Definition file_assume.h:135
static void are_equal(const std::basic_istream< char_t > &expected, const std::basic_istream< char_t > &actual)
Assumes that two files are equal.
Definition file_assume.h:49
static void are_not_equal(const xtd::basic_string< char_t > &expected, const xtd::basic_string< char_t > &actual)
Assumes that two files are not equal.
Definition file_assume.h:329
static void are_not_equal(const xtd::basic_string< char_t > &expected, const xtd::basic_string< char_t > &actual, const std::string &message)
Assumes that two files are not equal.
Definition file_assume.h:369
static void exists(const xtd::basic_string< char_t > &file, const std::string &message)
Assumes that file exists.
Definition file_assume.h:533
static void are_equal(const std::basic_istream< char_t > &expected, const std::basic_istream< char_t > &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 exists(const xtd::basic_string< char_t > &file, const xtd::diagnostics::stack_frame &stack_frame)
Assumes that file exists.
Definition file_assume.h:519
static void are_equal(const xtd::basic_string< char_t > &expected, const xtd::basic_string< char_t > &actual, const std::string &message)
Assumes that two files are equal.
Definition file_assume.h:175
static void does_not_exist(const xtd::basic_string< char_t > &file)
Assumes that file not exists.
Definition file_assume.h:431
Contains xtd::tunit::file_assert class.
#define tunit_export_
Define shared library export.
Definition tunit_export.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10