FastLED 3.9.15
Loading...
Searching...
No Matches

◆ runTestCase()

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

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

234 {
235 mStats.mTestCasesRun++;
236 mReporter->testCaseStart(info.mName.c_str());
237
238 mCurrentTestFailed = false;
239 mCurrentTestTimedOut = false;
240 mCurrentTestName = info.mName.c_str();
241 mSubcaseStack.clear();
242 mNextSubcaseStack.clear();
243 mFullyTraversedHashes.clear();
246 mShouldReenter = true;
247
248 // Reset skip flag for this test
249 sCurrentTestSkipped = false;
250
251 // Record test start time if we have a time function
252 if (mGetMillis) {
254 }
255
256 // Run the test multiple times to explore all subcase paths
257 // On each run, we follow the path in mNextSubcaseStack and then discover one new subcase
259 mShouldReenter = false;
262
263 // Copy next stack to current stack for this iteration
265 mNextSubcaseStack.clear();
266
267 // Call the test function
268 info.mFunc();
269
270 // Check for skip (FL_SKIP was called)
272 break;
273 }
274
275 // Check for timeout after each iteration
276 if (mDefaultTimeoutMs > 0 && checkTimeout()) {
277 break;
278 }
279 }
280
281 mCurrentTestName = nullptr;
282
283 // Calculate test duration
284 fl::u32 testDurationMs = 0;
285 if (mGetMillis) {
286 testDurationMs = mGetMillis() - mCurrentTestStartMs;
287 mStats.mTotalDurationMs += testDurationMs;
288 }
289
291 mStats.mTestCasesSkipped++;
292 mReporter->testCaseEnd(true, testDurationMs); // Skipped tests count as "not failed"
294 mStats.mTestCasesFailed++;
295 mReporter->testCaseEnd(false, testDurationMs);
296 } else {
297 mStats.mTestCasesPassed++;
298 mReporter->testCaseEnd(true, testDurationMs);
299 }
300}
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
fl::u32 mCurrentTestStartMs
Definition fltest.h:269
bool checkTimeout() FL_NOEXCEPT
Check if current test has timed out (call periodically in long tests) Returns true if timed out.
const char * mCurrentTestName
Definition fltest.h:270
IReporter * mReporter
Definition fltest.h:256
static bool sCurrentTestSkipped

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

Referenced by run().

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