mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 18:17:45 +00:00
LibTest: Expand test result bool to a TestResult
This will be used in the randomized tests a lot more than it is in the unit tests / benchmarks; randomized tests will run the test function multiple times, check the result and optionally start shrinking the failing input. Generators will also be able to fail, resulting in some of the new TestResult variants.
This commit is contained in:
parent
5a7f43ad38
commit
a60e3b17b1
4 changed files with 133 additions and 38 deletions
|
@ -13,6 +13,7 @@
|
|||
#include <AK/Function.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibTest/TestCase.h>
|
||||
#include <LibTest/TestResult.h>
|
||||
|
||||
namespace Test {
|
||||
|
||||
|
@ -40,7 +41,8 @@ public:
|
|||
m_cases.append(test_case);
|
||||
}
|
||||
|
||||
void current_test_case_did_fail() { m_current_test_case_passed = false; }
|
||||
TestResult current_test_result() const { return m_current_test_result; }
|
||||
void set_current_test_result(TestResult result) { m_current_test_result = result; }
|
||||
|
||||
void set_suite_setup(Function<void()> setup) { m_setup = move(setup); }
|
||||
|
||||
|
@ -51,8 +53,8 @@ private:
|
|||
u64 m_benchtime = 0;
|
||||
DeprecatedString m_suite_name;
|
||||
u64 m_benchmark_repetitions = 1;
|
||||
bool m_current_test_case_passed = true;
|
||||
Function<void()> m_setup;
|
||||
TestResult m_current_test_result = TestResult::NotRun;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue