| 9992 | namespace Catch { |
| 9993 | |
| 9994 | std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases ) { |
| 9995 | |
| 9996 | std::vector<TestCase> sorted = unsortedTestCases; |
| 9997 | |
| 9998 | switch( config.runOrder() ) { |
| 9999 | case RunTests::InLexicographicalOrder: |
| 10000 | std::sort( sorted.begin(), sorted.end() ); |
| 10001 | break; |
| 10002 | case RunTests::InRandomOrder: |
| 10003 | seedRng( config ); |
| 10004 | RandomNumberGenerator::shuffle( sorted ); |
| 10005 | break; |
| 10006 | case RunTests::InDeclarationOrder: |
| 10007 | // already in declaration order |
| 10008 | break; |
| 10009 | } |
| 10010 | return sorted; |
| 10011 | } |
| 10012 | bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ) { |
| 10013 | return testSpec.matches( testCase ) && ( config.allowThrows() || !testCase.throws() ); |
| 10014 | } |