#include <xtd/xtd.tunit>
private:
event_listener::on_unit_test_start(e);
console::out << "[==========] Running " << e.unit_test().test_count() << " tests from " << e.unit_test().test_cases_count() << " test case." << environment::new_line;
}
event_listener::on_unit_test_initialize_end(e);
console::out << "[----------] Global test environment set-up." << environment::new_line;
}
event_listener::on_class_start(e);
console::out << "[----------] " << e.test_class().test_count() << " tests from " << e.test_class().name() << environment::new_line;
}
event_listener::on_test_start(e);
console::out << "[ RUN ] " << e.test_class().name() << "." << e.test().name() << environment::new_line;
}
event_listener::on_test_succeed(e);
console::out << "[ OK ] " << e.test_class().name() << "." << e.test().name() << " (" << as<int>(e.test().elapsed_time().total_microseconds()) << " ms)" << environment::new_line;
}
event_listener::on_test_failed(e);
console::out << e.test().stack_frame().get_file_name() << ":" << e.test().stack_frame().get_file_line_number() << ": Failure" << environment::new_line;
if (e.test().actual() != "") console::out << " Actual: " << e.test().actual() << environment::new_line;
if (e.test().expect() != "") console::out << "Expected: " << e.test().expect() << environment::new_line;
if (e.test().message() != "") console::out << e.test().message() << environment::new_line;
console::out << "[ FAILED ] " << e.test_class().name() << "." << e.test().name() << " (" << as<int>(e.test().elapsed_time().total_milliseconds()) << " ms)" << environment::new_line;
}
event_listener::on_class_end(e);
console::out << "[----------] " << e.test_class().test_count() << " tests from " << e.test_class().name() << " (" << as<int>(e.test_class().elapsed_time().total_milliseconds()) << " ms)" << environment::new_line;
}
event_listener::on_unit_test_cleanup_end(e);
console::out << environment::new_line << "[----------] Global test environment tear-down" << environment::new_line;
}
event_listener::on_unit_test_end(e);
console::out << "[==========] " << e.unit_test().test_count() << " tests from " << e.unit_test().test_cases_count() << " test case ran. (" << as<int>(e.unit_test().elapsed_time().total_milliseconds()) << " ms total)" << environment::new_line;
console::out << "[ PASSED ] " << e.unit_test().succeed_test_count() << " tests." << environment::new_line;
if (e.unit_test().failed_test_count()) {
console::out << "[ FAILED ] " << e.unit_test().failed_test_count() << " test, listed below:" << environment::new_line;
for (string name : e.unit_test().failed_test_names())
console::out << "[ FAILED ] " << name << environment::new_line;
console::out << environment::new_line;
console::out << " " << e.unit_test().failed_test_count() << " FAILED TEST" << environment::new_line;
}
if (!e.unit_test().failed_test_count() && e.unit_test().ignored_test_count()) console::out << environment::new_line;
if (e.unit_test().ignored_test_count()) console::out << " YOU HAVE " << e.unit_test().ignored_test_count() << " DISABLED TESTS" << environment::new_line << environment::new_line;
}
};
class gtest_unit_test final :
public unit_test {
public:
gtest_unit_test() :
unit_test(new_uptr<gtest_event_listener>()) {}
};
namespace unit_tests {
class test_class_(test) {
}
}
assert::is_true(false, "Your message...");
}
}
};
}
auto main() -> int {
return gtest_unit_test().run();
}
Provides data for the xtd::tunit::class_test events.
Definition class_event_args.h:18
Represent the event listener class. Unit test call theses events when unit tests are processing.
Definition event_listener.h:23
Provides data for the xtd::tunit::test events.
Definition test_event_args.h:19
tunit_event_args is the base class for classes containing event data.
Definition tunit_event_args.h:19
The unit_test class is unit test base interface.
Definition unit_test.h:28
#define test_method_(method_name)
Add test method to class test.
Definition test_method_attribute.h:89
#define ignore_test_method_(method_name)
Add ignored test method to class test.
Definition test_method_attribute.h:73
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