10#include <tests/common.h>
13using namespace MaxOS::tests;
42 case TestStatus::PASS:
45 case TestStatus::SKIP:
48 case TestStatus::FAIL:
52 msg <<
" - " << m_name <<
"\n";
55 if (result == TestStatus::FAIL)
81Test::~Test() =
default;
92 m_condition(condition)
104 return TestStatus::PASS;
106 return TestStatus::FAIL;
111ConditionalTest::~ConditionalTest() =
default;
117 Logger::TEST() <<
"Running all tests... (" << (int )s_tests.size() <<
" tests found)\n";
118 for (
auto& test : s_tests)
128 for (
auto& test : s_tests)
129 if (test->type() == type)
139 s_tests.push_back(test);
146 register_tests_common();
static Logger TEST()
Gets active logger set to test level.
static Logger ERROR()
Gets active logger set to ERROR level.
Creates a string using a using a combination of parts with the '<<' operator. Simmilar to the logger.
String out
The output string.
Stores the left, top, width and height of a rectangle.
TestStatus execute() override
Executes the conditional test based on the provided condition function.
ConditionalTest(const string &name, TestType type, bool(*condition)())
Constructs a ConditionalTest with a name, type, and condition function.
static void test_kernel()
Setups the TestRunner and runs all kernel tests.
static void run_all_types(TestType type)
Runs all tests of a specific type.
static void run_all_tests()
Runs all registered tests.
static void add_all_tests()
Adds all predefined tests to the test runner.
static void add_test(Test *test)
Adds a test to the test runner.
const string & name() const
Gets the name of the test.
TestStatus run()
Runs the test and returns the result.
virtual TestStatus execute()=0
Executes the test and returns the status of the test.
Test(const string &name, TestType type)
Constructs a Test with a name and type, and registers it with the TestRunner.
TestType type() const
Gets the type of the test.
Defines a basic test class for MaxOS.
TestType
The different types of tests.
TestStatus
The possible outcomes of a test.