6 #if defined(__cpp_lib_filesystem) 22 #if defined(__cpp_lib_filesystem) 23 static void are_equal(
const std::filesystem::directory_entry& expected,
const std::filesystem::directory_entry& actual) {are_equal(expected, actual,
"",
line_info());}
46 static void are_equal(
const std::filesystem::directory_entry& expected,
const std::filesystem::directory_entry& actual,
const tunit::line_info&
line_info) {are_equal(expected, actual,
"", line_info);}
59 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, line_info());}
73 static void are_equal(
const std::filesystem::directory_entry& expected,
const std::filesystem::directory_entry& actual,
const std::string& message,
const tunit::line_info& line_info) {
74 if (expected != actual)
75 base_assert::fail(base_assert::to_string(expected.path().string()), base_assert::to_string(actual.path().string()), message, line_info);
90 static void are_not_equal(
const std::filesystem::directory_entry& expected,
const std::filesystem::directory_entry& actual) {are_not_equal(expected, actual,
"", line_info());}
103 static void are_not_equal(
const std::filesystem::directory_entry& expected,
const std::filesystem::directory_entry& actual,
const tunit::line_info& line_info) {are_not_equal(expected, actual,
"", line_info);}
116 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, line_info());}
130 static void are_not_equal(
const std::filesystem::directory_entry& expected,
const std::filesystem::directory_entry& actual,
const std::string& message,
const tunit::line_info& line_info) {
131 if (expected != actual)
132 base_assert::fail(base_assert::to_string(expected.path().string()), base_assert::to_string(actual.path().string()), message, line_info);
149 template<
typename Char>
150 static void exists(
const std::basic_string<Char>& directory) {
exists(directory,
"", line_info());}
164 template<
typename Char>
179 template<
typename Char>
180 static void exists(
const std::basic_string<Char>& directory,
const std::string& message) {
exists(directory, message, line_info());}
195 template<
typename Char>
196 static void exists(
const std::basic_string<Char>& directory,
const std::string& message,
const tunit::line_info& line_info) {
198 if(stat(directory.c_str(), &info ) != 0 || (info.st_mode & S_IFDIR) != S_IFDIR)
199 base_assert::fail(
"directory exists", base_assert::to_string(directory), message, line_info);
205 template<
typename Char>
206 static void exists(
const Char* directory) {
exists(directory,
"", line_info());}
207 template<
typename Char>
209 template<
typename Char>
210 static void exists(
const Char* directory,
const std::string& message) {
exists(directory, message, line_info());}
211 template<
typename Char>
212 static void exists(
const Char* directory,
const std::string& message,
const tunit::line_info& line_info) {
exists(std::basic_string<Char>(directory), message, line_info);}
226 template<
typename Char>
241 template<
typename Char>
256 template<
typename Char>
272 template<
typename Char>
275 if(stat(directory.c_str(), &info ) == 0 && (info.st_mode & S_IFDIR) == S_IFDIR)
276 base_assert::fail(
"not directory exists", base_assert::to_string(directory), message, line_info);
282 template<
typename Char>
284 template<
typename Char>
286 template<
typename Char>
288 template<
typename Char>
294 #define exists_(...) __CMD_ASSERT_ARGS(exists, __VA_ARGS__) 296 #define does_not_exist_(...) __CMD_ASSERT_ARGS(does_not_exist, __VA_ARGS__) static void does_not_exist(const std::basic_string< Char > &directory, const tunit::line_info &line_info)
Asserts that file not exists.
Definition: directory_assert.h:242
static void exists(const std::basic_string< Char > &directory)
Asserts that directory exists.
Definition: directory_assert.h:150
static void exists(const std::basic_string< Char > &directory, const std::string &message, const tunit::line_info &line_info)
Asserts that directory exists.
Definition: directory_assert.h:196
The directory_assert class contains a collection of static methods that implement the most directory ...
Definition: directory_assert.h:16
Contains tunit::assert class.
line_info information class is used to store current file, current line and current function informat...
Definition: line_info.h:13
static void fail()
Throws an tunit::assertion_error exception.
Definition: base_assert.h:60
static void exists(const std::basic_string< Char > &directory, const tunit::line_info &line_info)
Asserts that directory exists.
Definition: directory_assert.h:165
static void does_not_exist(const std::basic_string< Char > &directory, const std::string &message, const tunit::line_info &line_info)
Asserts that file not exists.
Definition: directory_assert.h:273
static void does_not_exist(const std::basic_string< Char > &directory)
Asserts that file not exists.
Definition: directory_assert.h:227
Definition: base_assert.h:15
static void succeed()
Generates a success with a generic message.
Definition: base_assert.h:130
The tunit namespace contains a unit test library.
Definition: abort_error.h:8
static void exists(const std::basic_string< Char > &directory, const std::string &message)
Asserts that directory exists.
Definition: directory_assert.h:180
static void does_not_exist(const std::basic_string< Char > &directory, const std::string &message)
Asserts that file not exists.
Definition: directory_assert.h:257