50 template<
class char_t>
71 template<
class char_t>
73 std::basic_istream<char_t> if_expected(expected.rdbuf());
74 std::basic_istream<char_t> if_actual(actual.rdbuf());
76 if_expected.seekg(0, std::ios::end);
77 if_actual.seekg(0, std::ios::end);
78 size_t size_expected =
static_cast<size_t>(if_expected.tellg());
79 size_t size_actual =
static_cast<size_t>(if_actual.tellg());
80 if (size_expected != size_actual) {
85 if_expected.seekg(0, std::ios::beg);
86 if_actual.seekg(0, std::ios::beg);
87 for (
size_t offset = 0; offset < size_actual; ++offset) {
88 char_t value_expected =
static_cast<char_t
>(if_expected.get());
89 char_t value_actual =
static_cast<char_t
>(if_actual.get());
90 if (value_expected != value_actual) {
115 template<
class char_t>
136 template<
class char_t>
140 template<
class char_t>
142 template<
class char_t>
144 template<
class char_t>
146 template<
class char_t>
147 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 =
xtd::diagnostics::stack_frame::current()) {are_equal(std::basic_ifstream<char_t>(expected), std::basic_ifstream<char_t>(actual), message, stack_frame);}
148 template<
class char_t>
149 static void are_equal(
const char_t* expected,
const char_t* actual,
const xtd::diagnostics::stack_frame& stack_frame =
xtd::diagnostics::stack_frame::current()) {are_equal(expected, actual, xtd::string::empty_string, stack_frame);}
150 template<
class char_t>
151 static void are_equal(
const char_t* expected,
const char_t* actual,
const std::string& message,
const xtd::diagnostics::stack_frame& stack_frame =
xtd::diagnostics::stack_frame::current()) {are_equal(std::basic_ifstream<char_t>(expected), std::basic_ifstream<char_t>(actual), message, stack_frame);}
172 template<
class char_t>
193 template<
class char_t>
195 std::basic_istream<char_t> if_expected(expected.rdbuf());
196 std::basic_istream<char_t> if_actual(actual.rdbuf());
198 if_expected.seekg(0, std::ios::end);
199 if_actual.seekg(0, std::ios::end);
200 size_t size_expected =
static_cast<size_t>(if_expected.tellg());
201 size_t size_actual =
static_cast<size_t>(if_actual.tellg());
202 if (size_expected != size_actual) {
207 if_expected.seekg(0, std::ios::beg);
208 if_actual.seekg(0, std::ios::beg);
209 for (
size_t offset = 0; offset < size_actual; ++offset) {
210 char_t value_expected =
static_cast<char_t
>(if_expected.get());
211 char_t value_actual =
static_cast<char_t
>(if_actual.get());
212 if (value_expected != value_actual) {
217 fail(
"not equal <" +
typeof_(expected).full_name() +
">",
"<" +
typeof_(expected).full_name() +
">", message, stack_frame);
237 template<
class char_t>
258 template<
class char_t>
262 template<
class char_t>
264 template<
class char_t>
266 template<
class char_t>
268 template<
class char_t>
269 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 =
xtd::diagnostics::stack_frame::current()) {are_not_equal(std::basic_ifstream<char_t>(expected), std::basic_ifstream<char_t>(actual), message, stack_frame);}
270 template<
class char_t>
271 static void are_not_equal(
const char_t* expected,
const char_t* actual,
const xtd::diagnostics::stack_frame& stack_frame =
xtd::diagnostics::stack_frame::current()) {are_not_equal(expected, actual, xtd::string::empty_string, stack_frame);}
272 template<
class char_t>
273 static void are_not_equal(
const char_t* expected,
const char_t* actual,
const std::string& message,
const xtd::diagnostics::stack_frame& stack_frame =
xtd::diagnostics::stack_frame::current()) {are_not_equal(std::basic_ifstream<char_t>(expected), std::basic_ifstream<char_t>(actual), message, stack_frame);}
288 template<
class char_t>
303 template<
class char_t>
305 auto is = std::basic_ifstream<char_t>(file);
307 else fail(
"not file exists",
to_string(file), message, stack_frame);
311 template<
class char_t>
313 template<
class char_t>
329 template<
class char_t>
344 template<
class char_t>
346 auto is = std::basic_ifstream<char_t>(file);
348 else fail(
"file exists",
to_string(file), message, stack_frame);
352 template<
class char_t>
354 template<
class char_t>
Represents text as a sequence of character units.
Definition basic_string.hpp:71
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition stack_frame.hpp:48
static stack_frame current(const xtd::diagnostics::source_location &value=xtd::diagnostics::source_location::current()) noexcept
Crates a new xtd::diagnostics::stack_frame object corresponding to the location of the call site.
The base class for assert.
Definition base_assert.hpp:30
static void fail(const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.
static void succeed(const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Generates a success with a generic message. This is used by the other assert functions.
static xtd::string to_string(const value_t &value)
Convert specified value to xtd::string.
Definition base_assert.hpp:142
The file_assert class contains a collection of static methods that implement the most file assertions...
Definition file_assert.hpp:23
static void does_not_exist(const xtd::basic_string< char_t > &file, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that file not exists.
Definition file_assert.hpp:289
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=xtd::diagnostics::stack_frame::current())
Asserts that two files are not equal.
Definition file_assert.hpp:194
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=xtd::diagnostics::stack_frame::current())
Asserts that two files are equal.
Definition file_assert.hpp:116
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=xtd::diagnostics::stack_frame::current())
Asserts that two files are not equal.
Definition file_assert.hpp:173
static void does_not_exist(const xtd::basic_string< char_t > &file, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that file not exists.
Definition file_assert.hpp:304
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=xtd::diagnostics::stack_frame::current())
Asserts that two files are not equal.
Definition file_assert.hpp:238
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=xtd::diagnostics::stack_frame::current())
Asserts that two files are equal.
Definition file_assert.hpp:72
static void exists(const xtd::basic_string< char_t > &file, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that file exists.
Definition file_assert.hpp:345
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=xtd::diagnostics::stack_frame::current())
Asserts that two files are equal.
Definition file_assert.hpp:51
static void exists(const xtd::basic_string< char_t > &file, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that file exists.
Definition file_assert.hpp:330
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=xtd::diagnostics::stack_frame::current())
Asserts that two files are equal.
Definition file_assert.hpp:137
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=xtd::diagnostics::stack_frame::current())
Asserts that two files are not equal.
Definition file_assert.hpp:259
Contains xtd::tunit::directory_assert class.
#define tunit_export_
Define shared library export.
Definition tunit_export.hpp:13
#define typeof_
Used to obtain the type object of a specified type or object.
Definition typeof.hpp:45
bool is(xtd::any value)
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:485
The tunit namespace contains a unit test library.
Definition abort_error.hpp:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8