49 template<
typename char_t>
69 template<
typename char_t>
89 template<
typename char_t>
110 template<
typename char_t>
112 std::basic_istream<char_t> if_expected(expected.rdbuf());
113 std::basic_istream<char_t> if_actual(actual.rdbuf());
115 if_expected.seekg(0, std::ios::end);
116 if_actual.seekg(0, std::ios::end);
117 size_t size_expected =
static_cast<size_t>(if_expected.tellg());
118 size_t size_actual =
static_cast<size_t>(if_actual.tellg());
119 if (size_expected != size_actual) {
120 fail(
"istream length " +
to_string(size_expected),
to_string(size_actual), message, stack_frame);
124 if_expected.seekg(0, std::ios::beg);
125 if_actual.seekg(0, std::ios::beg);
126 for (
size_t offset = 0; offset < size_actual; ++offset) {
127 char_t value_expected =
static_cast<char_t
>(if_expected.get());
128 char_t value_actual =
static_cast<char_t
>(if_actual.get());
129 if (value_expected != value_actual) {
130 fail(
"istream at offset " +
to_string(offset) +
" value " +
to_string(value_expected),
to_string(value_actual), message, stack_frame);
134 assert::succeed(message, stack_frame);
153 template<
typename char_t>
173 template<
typename char_t>
193 template<
typename char_t>
214 template<
typename char_t>
215 static void are_equal(
const std::basic_string<char_t>& expected,
const std::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);}
218 template<
typename char_t>
220 template<
typename char_t>
221 static void are_equal(
const std::basic_string<char_t>& expected,
const char_t* actual,
const xtd::diagnostics::stack_frame& stack_frame) {are_equal(expected, actual,
"", stack_frame);}
222 template<
typename char_t>
223 static void are_equal(
const std::basic_string<char_t>& expected,
const char_t* actual,
const std::string& message) {are_equal(expected, actual, message,
xtd::diagnostics::stack_frame::empty());}
224 template<
typename char_t>
225 static void are_equal(
const std::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);}
226 template<
typename char_t>
228 template<
typename char_t>
229 static void are_equal(
const char_t* expected,
const std::basic_string<char_t>& actual,
const xtd::diagnostics::stack_frame& stack_frame) {are_equal(expected, actual,
"", stack_frame);}
230 template<
typename char_t>
231 static void are_equal(
const char_t* expected,
const std::basic_string<char_t>& actual,
const std::string& message) {are_equal(expected, actual, message,
xtd::diagnostics::stack_frame::empty());}
232 template<
typename char_t>
233 static void are_equal(
const char_t* expected,
const std::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);}
234 template<
typename char_t>
236 template<
typename char_t>
237 static void are_equal(
const char_t* expected,
const char_t* actual,
const xtd::diagnostics::stack_frame& stack_frame) {are_equal(expected, actual,
"", stack_frame);}
238 template<
typename char_t>
240 template<
typename char_t>
241 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);}
261 template<
typename char_t>
281 template<
typename char_t>
301 template<
typename char_t>
322 template<
typename char_t>
324 std::basic_istream<char_t> if_expected(expected.rdbuf());
325 std::basic_istream<char_t> if_actual(actual.rdbuf());
327 if_expected.seekg(0, std::ios::end);
328 if_actual.seekg(0, std::ios::end);
329 size_t size_expected =
static_cast<size_t>(if_expected.tellg());
330 size_t size_actual =
static_cast<size_t>(if_actual.tellg());
331 if (size_expected != size_actual) {
332 assert::succeed(message, stack_frame);
336 if_expected.seekg(0, std::ios::beg);
337 if_actual.seekg(0, std::ios::beg);
338 for (
size_t offset = 0; offset < size_actual; ++offset) {
339 char_t value_expected =
static_cast<char_t
>(if_expected.get());
340 char_t value_actual =
static_cast<char_t
>(if_actual.get());
341 if (value_expected != value_actual) {
342 assert::succeed(message, stack_frame);
346 fail(
"not equal <" +
typeof_(expected).full_name() +
">",
"<" +
typeof_(expected).full_name() +
">", message, stack_frame);
365 template<
typename char_t>
386 template<
typename char_t>
406 template<
typename char_t>
427 template<
typename char_t>
428 static void are_not_equal(
const std::basic_string<char_t>& expected,
const std::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);}
431 template<
typename char_t>
433 template<
typename char_t>
434 static void are_not_equal(
const std::basic_string<char_t>& expected,
const char_t* actual,
const xtd::diagnostics::stack_frame& stack_frame) {are_not_equal(expected, actual,
"", stack_frame);}
435 template<
typename char_t>
436 static void are_not_equal(
const std::basic_string<char_t>& expected,
const char_t* actual,
const std::string& message) {are_not_equal(expected, actual, message,
xtd::diagnostics::stack_frame::empty());}
437 template<
typename char_t>
438 static void are_not_equal(
const std::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);}
439 template<
typename char_t>
441 template<
typename char_t>
442 static void are_not_equal(
const char_t* expected,
const std::basic_string<char_t>& actual,
const xtd::diagnostics::stack_frame& stack_frame) {are_not_equal(expected, actual,
"", stack_frame);}
443 template<
typename char_t>
444 static void are_not_equal(
const char_t* expected,
const std::basic_string<char_t>& actual,
const std::string& message) {are_not_equal(expected, actual, message,
xtd::diagnostics::stack_frame::empty());}
445 template<
typename char_t>
446 static void are_not_equal(
const char_t* expected,
const std::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);}
447 template<
typename char_t>
449 template<
typename char_t>
450 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,
"", stack_frame);}
451 template<
typename char_t>
452 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());}
453 template<
typename char_t>
454 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);}
468 template<
typename char_t>
482 template<
typename char_t>
496 template<
typename char_t>
511 template<
typename char_t>
513 auto is = std::basic_ifstream<char_t>(file);
514 if (
is.good() ==
true) {
516 fail(
"not file exists",
to_string(file), message, stack_frame);
518 assert::succeed(message, stack_frame);
522 template<
typename char_t>
524 template<
typename char_t>
526 template<
typename char_t>
528 template<
typename char_t>
529 static void does_not_exist(
const char_t* file,
const std::string& message,
const xtd::diagnostics::stack_frame& stack_frame) {does_not_exist(std::basic_string<char_t>(file), message, stack_frame);}
543 template<
typename char_t>
557 template<
typename char_t>
571 template<
typename char_t>
586 template<
typename char_t>
588 auto is = std::basic_ifstream<char_t>(file);
589 if (
is.good() ==
false)
590 fail(
"file exists",
to_string(file), message, stack_frame);
593 assert::succeed(message, stack_frame);
598 template<
typename char_t>
600 template<
typename char_t>
602 template<
typename char_t>
604 template<
typename char_t>
605 static void exists(
const char_t* file,
const std::string& message,
const xtd::diagnostics::stack_frame& stack_frame) {exists(std::basic_string<char_t>(file), message, stack_frame);}
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition stack_frame.h:37
static stack_frame empty() noexcept
Return an empty stack frame.
The base class for assert.
Definition base_assert.h:29
The file_assert class contains a collection of static methods that implement the most file assertions...
Definition file_assert.h:23
static void are_not_equal(const std::basic_string< char_t > &expected, const std::basic_string< char_t > &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that two files are not equal.
Definition file_assert.h:428
static void are_not_equal(const std::basic_istream< char_t > &expected, const std::basic_istream< char_t > &actual)
Asserts that two files are not equal.
Definition file_assert.h:262
static void are_equal(const std::basic_string< char_t > &expected, const std::basic_string< char_t > &actual)
Asserts that two files are equal.
Definition file_assert.h:154
static void exists(const std::basic_string< char_t > &file)
Asserts that file exists.
Definition file_assert.h:544
static void does_not_exist(const std::basic_string< char_t > &file, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that file not exists.
Definition file_assert.h:483
static void does_not_exist(const std::basic_string< char_t > &file, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that file not exists.
Definition file_assert.h:512
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)
Asserts that two files are equal.
Definition file_assert.h:111
static void are_equal(const std::basic_string< char_t > &expected, const std::basic_string< char_t > &actual, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that two files are equal.
Definition file_assert.h:174
static void does_not_exist(const std::basic_string< char_t > &file)
Asserts that file not exists.
Definition file_assert.h:469
static void exists(const std::basic_string< char_t > &file, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that file exists.
Definition file_assert.h:587
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)
Asserts that two files are equal.
Definition file_assert.h:70
static void are_not_equal(const std::basic_string< char_t > &expected, const std::basic_string< char_t > &actual, const std::string &message)
Asserts that two files are not equal.
Definition file_assert.h:407
static void are_equal(const std::basic_string< char_t > &expected, const std::basic_string< char_t > &actual, const std::string &message)
Asserts that two files are equal.
Definition file_assert.h:194
static void are_equal(const std::basic_istream< char_t > &expected, const std::basic_istream< char_t > &actual)
Asserts that two files are equal.
Definition file_assert.h:50
static void are_equal(const std::basic_istream< char_t > &expected, const std::basic_istream< char_t > &actual, const std::string &message)
Asserts that two files are equal.
Definition file_assert.h:90
static void exists(const std::basic_string< char_t > &file, const std::string &message)
Asserts that file exists.
Definition file_assert.h:572
static void are_not_equal(const std::basic_istream< char_t > &expected, const std::basic_istream< char_t > &actual, const std::string &message)
Asserts that two files are not equal.
Definition file_assert.h:302
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)
Asserts that two files are not equal.
Definition file_assert.h:282
static void does_not_exist(const std::basic_string< char_t > &file, const std::string &message)
Asserts that file not exists.
Definition file_assert.h:497
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)
Asserts that two files are not equal.
Definition file_assert.h:323
static void are_not_equal(const std::basic_string< char_t > &expected, const std::basic_string< char_t > &actual, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that two files are not equal.
Definition file_assert.h:387
static void exists(const std::basic_string< char_t > &file, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that file exists.
Definition file_assert.h:558
static void are_equal(const std::basic_string< char_t > &expected, const std::basic_string< char_t > &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that two files are equal.
Definition file_assert.h:215
static void are_not_equal(const std::basic_string< char_t > &expected, const std::basic_string< char_t > &actual)
Asserts that two files are not equal.
Definition file_assert.h:366
Contains xtd::tunit::directory_assert class.
#define tunit_export_
Define shared library export.
Definition tunit_export.h:13
#define typeof_
Used to obtain the type object of a specified type or object.
Definition typeof.h:45
bool is(std::any value)
Checks if the result of an expression is compatible with a given type.
Definition is.h:335
std::string to_string(const date_time &value, const std::string &fmt, const std::locale &loc)
Convert a specified value into a string with specified format and locale.
Definition date_time.h:1080
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10