7#if defined(__cpp_lib_filesystem)
30#if defined(__cpp_lib_filesystem)
41 static void are_equal(
const std::filesystem::directory_entry& expected,
const std::filesystem::directory_entry& actual) {are_equal(expected, actual,
"",
xtd::diagnostics::stack_frame::empty());}
54 static void are_equal(
const std::filesystem::directory_entry& expected,
const std::filesystem::directory_entry& actual,
const xtd::diagnostics::stack_frame& stack_frame) {are_equal(expected, actual,
"", stack_frame);}
67 static void are_equal(
const std::filesystem::directory_entry& expected,
const std::filesystem::directory_entry& actual,
const std::string& message) {are_equal(expected, actual, message,
xtd::diagnostics::stack_frame::empty());}
81 static void are_equal(
const std::filesystem::directory_entry& expected,
const std::filesystem::directory_entry& actual,
const std::string& message,
const xtd::diagnostics::stack_frame& stack_frame) {
82 if (expected != actual)
83 base_assert::fail(base_assert::to_string(expected.path().string()), base_assert::to_string(actual.path().string()), message, stack_frame);
98 static void are_not_equal(
const std::filesystem::directory_entry& expected,
const std::filesystem::directory_entry& actual) {are_not_equal(expected, actual,
"",
xtd::diagnostics::stack_frame::empty());}
111 static void are_not_equal(
const std::filesystem::directory_entry& expected,
const std::filesystem::directory_entry& actual,
const xtd::diagnostics::stack_frame& stack_frame) {are_not_equal(expected, actual,
"", stack_frame);}
124 static void are_not_equal(
const std::filesystem::directory_entry& expected,
const std::filesystem::directory_entry& actual,
const std::string& message) {are_not_equal(expected, actual, message,
xtd::diagnostics::stack_frame::empty());}
138 static void are_not_equal(
const std::filesystem::directory_entry& expected,
const std::filesystem::directory_entry& actual,
const std::string& message,
const xtd::diagnostics::stack_frame& stack_frame) {
139 if (expected != actual)
140 base_assert::fail(base_assert::to_string(expected.path().string()), base_assert::to_string(actual.path().string()), message, stack_frame);
157 template<
typename Char>
172 template<
typename Char>
187 template<
typename Char>
203 template<
typename Char>
206 if(stat(directory.c_str(), &info ) != 0 || (info.st_mode & S_IFDIR) != S_IFDIR)
207 base_assert::fail(
"directory exists", base_assert::to_string(directory), message, stack_frame);
213 template<
typename Char>
215 template<
typename Char>
217 template<
typename Char>
219 template<
typename Char>
234 template<
typename Char>
249 template<
typename Char>
264 template<
typename Char>
280 template<
typename Char>
283 if(stat(directory.c_str(), &info ) == 0 && (info.st_mode & S_IFDIR) == S_IFDIR)
284 base_assert::fail(
"not directory exists", base_assert::to_string(directory), message, stack_frame);
290 template<
typename Char>
292 template<
typename Char>
294 template<
typename Char>
296 template<
typename Char>
303#define exists_(...) __CMD_ASSERT_ARGS(exists, __VA_ARGS__)
305#define does_not_exist_(...) __CMD_ASSERT_ARGS(does_not_exist, __VA_ARGS__)
Contains xtd::tunit::assert class.
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 directory_assert class contains a collection of static methods that implement the most directory ...
Definition: directory_assert.h:24
static void exists(const std::basic_string< Char > &directory, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that directory exists.
Definition: directory_assert.h:173
static void exists(const std::basic_string< Char > &directory, const std::string &message)
Asserts that directory exists.
Definition: directory_assert.h:188
static void does_not_exist(const std::basic_string< Char > &directory, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that file not exists.
Definition: directory_assert.h:250
static void does_not_exist(const std::basic_string< Char > &directory, const std::string &message)
Asserts that file not exists.
Definition: directory_assert.h:265
static void exists(const std::basic_string< Char > &directory, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that directory exists.
Definition: directory_assert.h:204
static void exists(const std::basic_string< Char > &directory)
Asserts that directory exists.
Definition: directory_assert.h:158
static void does_not_exist(const std::basic_string< Char > &directory)
Asserts that file not exists.
Definition: directory_assert.h:235
static void does_not_exist(const std::basic_string< Char > &directory, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that file not exists.
Definition: directory_assert.h:281
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17