xtd - Reference Guide  0.1.0
Modern c++17 framework to create console, gui and unit test applications on Windows, macOS and Linux.
xtd::tunit::file_assume Class Referencefinal

The file_assume class contains a collection of static methods that implement the most file assertions used in xtd::tUnit. More...

#include <file_assume.h>

Inheritance diagram for xtd::tunit::file_assume:
xtd::tunit::base_assert

Static Public Member Functions

template<typename Char >
static void are_equal (const std::basic_istream< Char > &expected, const std::basic_istream< Char > &actual)
 Assumes that two files are equal. More...
 
template<typename Char >
static void are_equal (const std::basic_istream< Char > &expected, const std::basic_istream< Char > &actual, const xtd::tunit::line_info &line_info)
 Assumes that two files are equal. More...
 
template<typename Char >
static void are_equal (const std::basic_istream< Char > &expected, const std::basic_istream< Char > &actual, const std::string &message)
 Assumes that two files are equal. More...
 
template<typename Char >
static void are_equal (const std::basic_istream< Char > &expected, const std::basic_istream< Char > &actual, const std::string &message, const xtd::tunit::line_info &line_info)
 Assumes that two files are equal. More...
 
template<typename Char >
static void are_equal (const std::basic_string< Char > &expected, const std::basic_string< Char > &actual)
 Assumes that two files are equal. More...
 
template<typename Char >
static void are_equal (const std::basic_string< Char > &expected, const std::basic_string< Char > &actual, const xtd::tunit::line_info &line_info)
 Assumes that two files are equal. More...
 
template<typename Char >
static void are_equal (const std::basic_string< Char > &expected, const std::basic_string< Char > &actual, const std::string &message)
 Assumes that two files are equal. More...
 
template<typename Char >
static void are_equal (const std::basic_string< Char > &expected, const std::basic_string< Char > &actual, const std::string &message, const xtd::tunit::line_info &line_info)
 Assumes that two files are equal. More...
 
template<typename Char >
static void are_not_equal (const std::basic_istream< Char > &expected, const std::basic_istream< Char > &actual)
 Assumes that two files are not equal. More...
 
template<typename Char >
static void are_not_equal (const std::basic_istream< Char > &expected, const std::basic_istream< Char > &actual, const xtd::tunit::line_info &line_info)
 Assumes that two files are not equal. More...
 
template<typename Char >
static void are_not_equal (const std::basic_istream< Char > &expected, const std::basic_istream< Char > &actual, const std::string &message)
 Assumes that two files are not equal. More...
 
template<typename Char >
static void are_not_equal (const std::basic_istream< Char > &expected, const std::basic_istream< Char > &actual, const std::string &message, const xtd::tunit::line_info &line_info)
 Assumes that two files are not equal. More...
 
template<typename Char >
static void are_not_equal (const std::basic_string< Char > &expected, const std::basic_string< Char > &actual)
 Assumes that two files are not equal. More...
 
template<typename Char >
static void are_not_equal (const std::basic_string< Char > &expected, const std::basic_string< Char > &actual, const xtd::tunit::line_info &line_info)
 Assumes that two files are not equal. More...
 
template<typename Char >
static void are_not_equal (const std::basic_string< Char > &expected, const std::basic_string< Char > &actual, const std::string &message)
 Assumes that two files are not equal. More...
 
template<typename Char >
static void are_not_equal (const std::basic_string< Char > &expected, const std::basic_string< Char > &actual, const std::string &message, const xtd::tunit::line_info &line_info)
 Assumes that two files are not equal. More...
 
template<typename Char >
static void does_not_exist (const std::basic_string< Char > &file)
 Assumes that file not exists. More...
 
template<typename Char >
static void does_not_exist (const std::basic_string< Char > &file, const xtd::tunit::line_info &line_info)
 Assumes that file not exists. More...
 
template<typename Char >
static void does_not_exist (const std::basic_string< Char > &file, const std::string &message)
 Assumes that file not exists. More...
 
template<typename Char >
static void does_not_exist (const std::basic_string< Char > &file, const std::string &message, const xtd::tunit::line_info &line_info)
 Assumes that file not exists. More...
 
template<typename Char >
static void exists (const std::basic_string< Char > &file)
 Assumes that file exists. More...
 
template<typename Char >
static void exists (const std::basic_string< Char > &file, const xtd::tunit::line_info &line_info)
 Assumes that file exists. More...
 
template<typename Char >
static void exists (const std::basic_string< Char > &file, const std::string &message)
 Assumes that file exists. More...
 
template<typename Char >
static void exists (const std::basic_string< Char > &file, const std::string &message, const xtd::tunit::line_info &line_info)
 Assumes that file exists. More...
 

Static Private Member Functions

static void abort ()
 Abort current test. This is used by the other Assert functions. More...
 
static void abort (const xtd::tunit::line_info &line_info)
 Abort current test. This is used by the other Assert functions. More...
 
static void abort (const std::string &message)
 Abort current test. This is used by the other Assert functions. More...
 
static void abort (const std::string &message, const xtd::tunit::line_info &line_info)
 Abort current test. This is used by the other Assert functions. More...
 
static void error ()
 
static void error (const std::string &actual, const std::string &expected, const std::string &message, const xtd::tunit::line_info &line_info)
 
static void fail ()
 Throws an xtd::tunit::assertion_error exception. This is used by the other Assert functions. More...
 
static void fail (const xtd::tunit::line_info &line_info)
 Throws an xtd::tunit::assertion_error exception. This is used by the other Assert functions. More...
 
static void fail (const std::string &message)
 Throws an xtd::tunit::assertion_error exception. This is used by the other Assert functions. More...
 
static void fail (const std::string &message, const xtd::tunit::line_info &line_info)
 Throws an xtd::tunit::assertion_error exception. This is used by the other Assert functions. More...
 
static void fail (const std::string &actual, const std::string &expected, const std::string &message, const xtd::tunit::line_info &line_info)
 
static void ignore ()
 Ignore current test. This is used by the other Assert functions. More...
 
static void ignore (const xtd::tunit::line_info &line_info)
 Ignore current test. This is used by the other Assert functions. More...
 
static void ignore (const std::string &message)
 Ignore current test. This is used by the other Assert functions. More...
 
static void ignore (const std::string &message, const xtd::tunit::line_info &line_info)
 Ignore current test. This is used by the other Assert functions. More...
 
template<typename TCollection >
static std::string join_items (const TCollection &collection)
 
static std::string join_items (const std::string &str)
 
static void succeed ()
 Generates a success with a generic message. This is used by the other Assert functions. More...
 
static void succeed (const xtd::tunit::line_info &line_info)
 Generates a success with a generic message. This is used by the other Assert functions. More...
 
static void succeed (const std::string &message)
 Generates a success with a generic message. This is used by the other Assert functions. More...
 
static void succeed (const std::string &message, const xtd::tunit::line_info &line_info)
 Generates a success with a generic message. This is used by the other Assert functions. More...
 
template<typename TValue >
static std::string to_string (const TValue &value)
 
template<typename TValue >
static std::string to_string (const TValue *value)
 

Detailed Description

The file_assume class contains a collection of static methods that implement the most file assertions used in xtd::tUnit.

Examples
This example show how to used some methods :
#include <xtd/xtd.tunit>
#include <stdexcept>
using namespace xtd::tunit;
namespace unit_tests {
// The class test must be declared with test_class_ helper.
class test_class_(test) {
public:
void test_method_(test_case1) {
}
void test_method_(test_case2) {
}
void test_method_(test_case3) {
assert::does_not_throw([] {throw std::range_error("error");});
}
};
}
int main() {
return console_unit_test().run();
}
// This code can produce the following output:
//
// Start 3 tests from 1 test case
// Run tests:
// SUCCEED test.test_case1 (0 ms total)
// FAILED test.test_case2 (0 ms total)
// Expected: false
// But was: true
// Stack Trace: in /Users/yves/Projects/xtd/examples/xtd.tunit.examples/assert/src/assert.cpp:14
// FAILED test.test_case3 (0 ms total)
// Expected: No Exception to be thrown
// But was: <std::range_error>
// Stack Trace: in /Users/yves/Projects/xtd/examples/xtd.tunit.examples/assert/src/assert.cpp:18
//
// Test results:
// SUCCEED 1 test.
// FAILED 2 tests.
// End 3 tests from 1 test case ran. (0 ms total)

The documentation for this class was generated from the following file: