xtd 0.2.0
Loading...
Searching...
No Matches
ostream_unit_test.cpp

Shows how to use generic xtd::tunit::ostream_unit_test class.

#include <xtd/xtd.tunit>
#include <sstream>
using namespace xtd;
using namespace xtd::tunit;
using namespace xtd::text;
namespace unit_tests {
class test_class_(test) {
void test_method_(test_case1) {
}
};
}
auto main() -> int {
// create your own ostream in this case a string stream for example
auto ss = std::stringstream {};
// create and run an ostream_unit_test
auto result = ostream_unit_test(ss).run();
// display string stream on console::out line by line
auto line = string_builder {};
while (std::getline(ss, line.chars()))
console::out << line << environment::new_line;
return result;
}
// This code can produce the following output :
//
// Start 1 test from 1 test case
// Run tests:
// SUCCEED unit_tests::test.test_case1 (0 ms total)
//
// Test results:
// SUCCEED 1 test.
// End 1 test from 1 test case ran. (0 ms total)
Represents a mutable string of characters. This class cannot be inherited.
Definition basic_string_builder.h:35
The ostream_unit_test class is ostream unit test interface.
Definition ostream_unit_test.h:22
int32 run() noexcept
Runs all tests in this unit_test object and prints the result.
#define test_method_(method_name)
Add test method to class test.
Definition test_method_attribute.h:89
Contains classes that represent ASCII and Unicode character encodings; abstract base classes for conv...
Definition basic_string_builder.h:16
The tunit namespace contains a unit test library.
Definition abort_error.h:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10