FastLED 3.10.8
Loading...
Searching...
No Matches

◆ runTestCase()

void fl::test::TestContext::runTestCase ( const TestCaseInfo & info)
private

Definition at line 243 of file fltest.cpp.hpp.

243 {
244 mStats.mTestCasesRun++;
245 mReporter->testCaseStart(info.mName.c_str());
246
247 mCurrentTestFailed = false;
248 mCurrentTestTimedOut = false;
249 mCurrentTestName = info.mName.c_str();
250 mSubcaseStack.clear();
251 mNextSubcaseStack.clear();
252 mFullyTraversedHashes.clear();
255 mShouldReenter = true;
256
257 // Reset skip flag for this test
258 skipState().skipped = false;
259
260 // Record test start time if we have a time function
261 if (mGetMillis) {
263 }
264
265 // Run the test multiple times to explore all subcase paths
266 // On each run, we follow the path in mNextSubcaseStack and then discover one new subcase
267 while (mShouldReenter && !mCurrentTestTimedOut && !skipState().skipped) {
268 mShouldReenter = false;
271
272 // Copy next stack to current stack for this iteration
274 mNextSubcaseStack.clear();
275
276 // Call the test function
277 info.mFunc();
278
279 // Check for skip (FL_SKIP was called)
280 if (skipState().skipped) {
281 break;
282 }
283
284 // Check for timeout after each iteration
285 if (mDefaultTimeoutMs > 0 && checkTimeout()) {
286 break;
287 }
288 }
289
290 mCurrentTestName = nullptr;
291
292 // Calculate test duration
293 fl::u32 testDurationMs = 0;
294 if (mGetMillis) {
295 testDurationMs = mGetMillis() - mCurrentTestStartMs;
296 mStats.mTotalDurationMs += testDurationMs;
297 }
298
299 if (skipState().skipped) {
300 mStats.mTestCasesSkipped++;
301 mReporter->testCaseEnd(true, testDurationMs); // Skipped tests count as "not failed"
303 mStats.mTestCasesFailed++;
304 mReporter->testCaseEnd(false, testDurationMs);
305 } else {
306 mStats.mTestCasesPassed++;
307 mReporter->testCaseEnd(true, testDurationMs);
308 }
309}
fl::u32 mDefaultTimeoutMs
Definition fltest.h:268
fl::vector< SubcaseSignature > mNextSubcaseStack
Definition fltest.h:253
fl::size mSubcaseDiscoveryDepth
Definition fltest.h:263
fl::size mCurrentSubcaseDepth
Definition fltest.h:262
GetMillisFunc mGetMillis
Definition fltest.h:266
fl::vector< fl::u32 > mFullyTraversedHashes
Definition fltest.h:254
fl::vector< SubcaseSignature > mSubcaseStack
Definition fltest.h:252
bool checkTimeout() FL_NO_EXCEPT
Check if current test has timed out (call periodically in long tests) Returns true if timed out.
fl::u32 mCurrentTestStartMs
Definition fltest.h:269
const char * mCurrentTestName
Definition fltest.h:270
IReporter * mReporter
Definition fltest.h:256
static SkipState & skipState() FL_NO_EXCEPT

References checkTimeout(), fl::FL_NO_EXCEPT, mCurrentSubcaseDepth, mCurrentTestFailed, mCurrentTestName, mCurrentTestStartMs, mCurrentTestTimedOut, mDefaultTimeoutMs, mFullyTraversedHashes, mGetMillis, mNextSubcaseStack, mReporter, mShouldReenter, mStats, mSubcaseDiscoveryDepth, mSubcaseStack, fl::test::SkipState::skipped, and fl::test::skipState().

Referenced by run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: