9#ifndef MAXOS_TESTS_TEST_H
10#define MAXOS_TESTS_TEST_H
14#include <common/macros.h>
17#define MAXOS_CONDITIONAL_TEST(name, type) \
18 auto CONCATENATE(test_, __COUNTER__) = new ConditionalTest(#name, type, []()
20namespace MaxOS::tests {
41 HARDWARE_COMMUNICATION,
56 "HARDWARE_COMMUNICATION",
88 const string&
name()
const;
101 template<
typename T1,
typename T2>
bool compare(T1
const& actual, T2
const& expected) {
104 if (actual == expected)
108 Logger::WARNING() <<
"Test failed comparison: expected [" << expected <<
"], got [" << actual <<
"]\n";
118 bool (*m_condition)();
static Logger WARNING()
Gets active logger set to WARNING level.
Stores the left, top, width and height of a rectangle.
A test that only checks a condition to determine pass/fail.
TestStatus execute() override
Executes the conditional test based on the provided condition function.
A class to run all tests.
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.
TestType type() const
Gets the type of the test.
Defines a Logger class for logging messages with different severity levels to multiple output streams...
Defines a String class for dynamically sized strings with various operations.
constexpr const char * TEST_TYPE_STRINGS[]
String representations of the TestType enum.
TestType
The different types of tests.
TestStatus
The possible outcomes of a test.
bool compare(T1 const &actual, T2 const &expected)
Compares two values and logs a warning if they are not equal.