| 11530 | namespace Catch { |
| 11531 | |
| 11532 | std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases ) { |
| 11533 | |
| 11534 | std::vector<TestCase> sorted = unsortedTestCases; |
| 11535 | |
| 11536 | switch( config.runOrder() ) { |
| 11537 | case RunTests::InLexicographicalOrder: |
| 11538 | std::sort( sorted.begin(), sorted.end() ); |
| 11539 | break; |
| 11540 | case RunTests::InRandomOrder: |
| 11541 | seedRng( config ); |
| 11542 | std::shuffle( sorted.begin(), sorted.end(), rng() ); |
| 11543 | break; |
| 11544 | case RunTests::InDeclarationOrder: |
| 11545 | // already in declaration order |
| 11546 | break; |
| 11547 | } |
| 11548 | return sorted; |
| 11549 | } |
| 11550 | bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ) { |
| 11551 | return testSpec.matches( testCase ) && ( config.allowThrows() || !testCase.throws() ); |
| 11552 | } |