| 9903 | namespace Catch { |
| 9904 | |
| 9905 | std::vector<TestCase> sortTests(IConfig const &config, std::vector<TestCase> const &unsortedTestCases) { |
| 9906 | |
| 9907 | std::vector<TestCase> sorted = unsortedTestCases; |
| 9908 | |
| 9909 | switch (config.runOrder()) { |
| 9910 | case RunTests::InLexicographicalOrder: |
| 9911 | std::sort(sorted.begin(), sorted.end()); |
| 9912 | break; |
| 9913 | case RunTests::InRandomOrder: |
| 9914 | seedRng(config); |
| 9915 | RandomNumberGenerator::shuffle(sorted); |
| 9916 | break; |
| 9917 | case RunTests::InDeclarationOrder: |
| 9918 | // already in declaration order |
| 9919 | break; |
| 9920 | } |
| 9921 | return sorted; |
| 9922 | } |
| 9923 | bool matchTest(TestCase const &testCase, TestSpec const &testSpec, IConfig const &config) { |
| 9924 | return testSpec.matches(testCase) && (config.allowThrows() || !testCase.throws()); |
| 9925 | } |