| 331 | } |
| 332 | |
| 333 | bool TestContext::enterSubcase(const SubcaseSignature& sig) FL_NOEXCEPT { |
| 334 | // We're at subcase discovery depth mSubcaseDiscoveryDepth |
| 335 | // mSubcaseStack contains the path we're following this iteration |
| 336 | |
| 337 | if (mSubcaseDiscoveryDepth < mSubcaseStack.size()) { |
| 338 | // We're following a predetermined path |
| 339 | if (mSubcaseStack[mSubcaseDiscoveryDepth] == sig) { |
| 340 | // This is the subcase we should enter |
| 341 | mSubcaseDiscoveryDepth++; |
| 342 | mCurrentSubcaseDepth++; |
| 343 | mReporter->subcaseStart(sig.mName); |
| 344 | return true; |
| 345 | } |
| 346 | // Not the subcase we're looking for, skip it |
| 347 | return false; |
| 348 | } else { |
| 349 | // We're past our predetermined path, discovering new subcases |
| 350 | fl::u32 pathHash = hashCurrentPath(sig); |
| 351 | |
| 352 | if (isFullyTraversed(pathHash)) { |
| 353 | // This subcase path has already been fully explored |
| 354 | return false; |
| 355 | } |
| 356 | |
| 357 | if (!mShouldReenter) { |
| 358 | // First untraversed subcase at this level - enter it |
| 359 | mSubcaseDiscoveryDepth++; |
| 360 | mCurrentSubcaseDepth++; |
| 361 | mReporter->subcaseStart(sig.mName); |
| 362 | return true; |
| 363 | } else { |
| 364 | // We've already found a subcase to explore next time |
| 365 | // Just record this one for future exploration |
| 366 | if (mNextSubcaseStack.empty() || mNextSubcaseStack.size() == mSubcaseDiscoveryDepth) { |
| 367 | // Build the path to this subcase for next iteration |
| 368 | mNextSubcaseStack.clear(); |
| 369 | for (fl::size i = 0; i < mSubcaseDiscoveryDepth && i < mSubcaseStack.size(); ++i) { |
| 370 | mNextSubcaseStack.push_back(mSubcaseStack[i]); |
| 371 | } |
| 372 | mNextSubcaseStack.push_back(sig); |
| 373 | } |
| 374 | return false; |
| 375 | } |
| 376 | } |
| 377 | } |
| 378 | |
| 379 | void TestContext::exitSubcase(const SubcaseSignature& sig) FL_NOEXCEPT { |
| 380 | mCurrentSubcaseDepth--; |