43 template<
typename Char>
64 template<
typename Char>
85 template<
typename Char>
107 template<
typename Char>
109 std::basic_istream<Char> if_expected(expected.rdbuf());
110 std::basic_istream<Char> if_actual(actual.rdbuf());
112 if_expected.seekg(0, std::ios::end);
113 if_actual.seekg(0, std::ios::end);
114 size_t size_expected = if_expected.tellg();
115 size_t size_actual = if_actual.tellg();
116 if (size_expected != size_actual) {
117 base_assert::fail(
"istream length " + base_assert::to_string(size_expected), base_assert::to_string(size_actual), message, stack_frame);
121 if_expected.seekg(0, std::ios::beg);
122 if_actual.seekg(0, std::ios::beg);
123 for (
size_t offset = 0; offset < size_actual; ++offset) {
124 Char value_expected = if_expected.get();
125 Char value_actual = if_actual.get();
126 if (value_expected != value_actual) {
127 base_assert::fail(
"istream at offset " + base_assert::to_string(offset) +
" value " + base_assert::to_string(value_expected), base_assert::to_string(value_actual), message, stack_frame);
151 template<
typename Char>
172 template<
typename Char>
193 template<
typename Char>
215 template<
typename Char>
216 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);}
219 template<
typename Char>
221 template<
typename Char>
223 template<
typename Char>
225 template<
typename Char>
226 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);}
227 template<
typename Char>
229 template<
typename Char>
231 template<
typename Char>
233 template<
typename Char>
234 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);}
235 template<
typename Char>
237 template<
typename Char>
239 template<
typename Char>
241 template<
typename Char>
242 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);}
262 template<
typename Char>
283 template<
typename Char>
304 template<
typename Char>
326 template<
typename Char>
328 std::basic_istream<Char> if_expected(expected.rdbuf());
329 std::basic_istream<Char> if_actual(actual.rdbuf());
331 if_expected.seekg(0, std::ios::end);
332 if_actual.seekg(0, std::ios::end);
333 size_t size_expected = if_expected.tellg();
334 size_t size_actual = if_actual.tellg();
335 if (size_expected != size_actual) {
340 if_expected.seekg(0, std::ios::beg);
341 if_actual.seekg(0, std::ios::beg);
342 for (
size_t offset = 0; offset < size_actual; ++offset) {
343 Char value_expected = if_expected.get();
344 Char value_actual = if_actual.get();
345 if (value_expected != value_actual) {
350 base_assert::fail(
"not equal <" + __tunit_demangle(
typeid(expected).name()) +
">",
"<" + __tunit_demangle(
typeid(expected).name()) +
">", message, stack_frame);
370 template<
typename Char>
391 template<
typename Char>
412 template<
typename Char>
434 template<
typename Char>
435 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);}
438 template<
typename Char>
440 template<
typename Char>
442 template<
typename Char>
444 template<
typename Char>
445 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);}
446 template<
typename Char>
448 template<
typename Char>
450 template<
typename Char>
452 template<
typename Char>
453 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);}
454 template<
typename Char>
456 template<
typename Char>
458 template<
typename Char>
460 template<
typename Char>
475 template<
typename Char>
490 template<
typename Char>
505 template<
typename Char>
521 template<
typename Char>
523 if (std::basic_ifstream<Char>(file).good() ==
false)
524 base_assert::fail(
"file exists", base_assert::to_string(file), message, stack_frame);
530 template<
typename Char>
532 template<
typename Char>
534 template<
typename Char>
536 template<
typename Char>
551 template<
typename Char>
566 template<
typename Char>
581 template<
typename Char>
597 template<
typename Char>
599 if (std::basic_ifstream<Char>(file).good() ==
true)
600 base_assert::fail(
"not file exists", base_assert::to_string(file), message, stack_frame);
606 template<
typename Char>
608 template<
typename Char>
610 template<
typename Char>
612 template<
typename Char>
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 fail()
Throws an xtd::tunit::assertion_error exception. This is used by the other Assert functions.
Definition base_assert.h:70
static void succeed()
Generates a success with a generic message. This is used by the other Assert functions.
Definition base_assert.h:140
The file_assert class contains a collection of static methods that implement the most file assertions...
Definition file_assert.h:20
static void are_not_equal(const std::basic_istream< Char > &expected, const std::basic_istream< Char > &actual, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that two files are not equal.
Definition file_assert.h:284
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)
Asserts that two files are not equal.
Definition file_assert.h:327
static void exists(const std::basic_string< Char > &file, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that file exists.
Definition file_assert.h:522
static void does_not_exist(const std::basic_string< Char > &file, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that file not exists.
Definition file_assert.h:567
static void are_equal(const std::basic_string< Char > &expected, const std::basic_string< Char > &actual, const std::string &message)
Asserts that two files are equal.
Definition file_assert.h:194
static void does_not_exist(const std::basic_string< Char > &file)
Asserts that file not exists.
Definition file_assert.h:552
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:44
static void are_equal(const std::basic_istream< Char > &expected, const std::basic_istream< Char > &actual, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that two files are equal.
Definition file_assert.h:65
static void are_equal(const std::basic_istream< Char > &expected, const std::basic_istream< Char > &actual, const std::string &message)
Asserts that two files are equal.
Definition file_assert.h:86
static void exists(const std::basic_string< Char > &file, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that file exists.
Definition file_assert.h:491
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)
Asserts that two files are equal.
Definition file_assert.h:108
static void are_equal(const std::basic_string< Char > &expected, const std::basic_string< Char > &actual)
Asserts that two files are equal.
Definition file_assert.h:152
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:263
static void are_not_equal(const std::basic_istream< Char > &expected, const std::basic_istream< Char > &actual, const std::string &message)
Asserts that two files are not equal.
Definition file_assert.h:305
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)
Asserts that two files are not equal.
Definition file_assert.h:435
static void are_not_equal(const std::basic_string< Char > &expected, const std::basic_string< Char > &actual)
Asserts that two files are not equal.
Definition file_assert.h:371
static void does_not_exist(const std::basic_string< Char > &file, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that file not exists.
Definition file_assert.h:598
static void are_not_equal(const std::basic_string< Char > &expected, const std::basic_string< Char > &actual, const std::string &message)
Asserts that two files are not equal.
Definition file_assert.h:413
static void does_not_exist(const std::basic_string< Char > &file, const std::string &message)
Asserts that file not exists.
Definition file_assert.h:582
static void exists(const std::basic_string< Char > &file)
Asserts that file exists.
Definition file_assert.h:476
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)
Asserts that two files are equal.
Definition file_assert.h:216
static void are_equal(const std::basic_string< Char > &expected, const std::basic_string< Char > &actual, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that two files are equal.
Definition file_assert.h:173
static void exists(const std::basic_string< Char > &file, const std::string &message)
Asserts that file exists.
Definition file_assert.h:506
static void are_not_equal(const std::basic_string< Char > &expected, const std::basic_string< Char > &actual, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that two files are not equal.
Definition file_assert.h:392
Contains xtd::tunit::directory_assert class.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition system_report.h:17